Quick Replies

cURL

curl --location 'https://api.gupshup.io/wa/api/v1/msg' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'apikey: {{APIKEY}}' \
--data-urlencode 'source={{SOURCE}}' \
--data-urlencode 'destination={{DESTINATION}}' \
--data-urlencode 'message={
	"type":"quick_reply",
	"msgid":"{{POSTBACK_TRACKING_ID}}",
	"content":{
		"type":"{{QUICK_REPLY_TYPE}}",
		"text":"{{BODY_CONTENT}}",
		"url":"{{HEADER_MEDIA_URL}}",
		"caption":"{{FOOTER}}",
		"header":"{{HEADER_TEXT}}",
		"filename":"{{FILE_NAME}}"
	},
	"options":[
		{
			"title":"{{BUTTON_TITLE}}",
			"postbackText":"{{POSTBACK_TRACKING_TEXT}}",
		}
	]
}' \
--data-urlencode 'src.name={{APP_NAME}}'

Sample Requests- Quick Replies

curl --location 'https://api.gupshup.io/wa/api/v1/msg' \
--header 'Cache-Control: no-cache' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'apikey: xvnwgh9vgbbl6gjeezymu5v5iepxq2zt' \
--header 'cache-control: no-cache' \
--data-urlencode 'channel=whatsapp' \
--data-urlencode 'source=918097424541' \
--data-urlencode 'destination=91735824xxxx' \
--data-urlencode 'message={
	"type":"quick_reply",
	"content":{
		"type":"text",
		"text":"body",
		"caption":"footer",
		"header":"header"
	},
	"options":[
		{
			"title":"button title 1",
			"postbackText":"tracking text"
		}
	]
}' \
--data-urlencode 'src.name=TedLasso'
curl --location 'https://api.gupshup.io/wa/api/v1/msg' \
--header 'Cache-Control: no-cache' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'apikey: xvnwgh9vgbbl6gjeezymu5v5iepxq2zt' \
--header 'cache-control: no-cache' \
--data-urlencode 'channel=whatsapp' \
--data-urlencode 'source=918097424541' \
--data-urlencode 'destination=91735824xxxx' \
--data-urlencode 'message={
	"type":"quick_reply",
	"content":{
		"type":"file",
		"text":"body",
		"caption":"footer",
		"url":"https://www.clickdimensions.com/links/TestPDFfile.pdf",
		"filename":"sample"
	},
	"options":[
		{
			"title":"button title 1",
			"postbackText":"tracking text"
		}
	]
}' \
--data-urlencode 'src.name=TedLasso'
curl --location 'https://api.gupshup.io/wa/api/v1/msg' \
--header 'Cache-Control: no-cache' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'apikey: xvnwgh9vgbbl6gjeezymu5v5iepxq2zt' \
--header 'cache-control: no-cache' \
--data-urlencode 'channel=whatsapp' \
--data-urlencode 'source=918097424541' \
--data-urlencode 'destination=91735824xxxx' \
--data-urlencode 'message={
	"type":"quick_reply",
	"content":{
		"type":"image",
		"text":"body",
		"caption":"footer",
		"url":"https://picsum.photos/200"
	},
	"options":[
		{
			"title":"button title 1",
			"postbackText":"tracking text"
		}
	]
}' \
--data-urlencode 'src.name=TedLasso'
curl --location 'https://api.gupshup.io/wa/api/v1/msg' \
--header 'Cache-Control: no-cache' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'apikey: xvnwgh9vgbbl6gjeezymu5v5iepxq2zt' \
--header 'cache-control: no-cache' \
--data-urlencode 'channel=whatsapp' \
--data-urlencode 'source=918097424541' \
--data-urlencode 'destination=91735824xxxx' \
--data-urlencode 'message={
	"type":"quick_reply",
	"content":{
		"type":"video",
		"text":"body",
		"caption":"footer",
		"url":"https://file-examples.com/storage/fe3cb26995666504a8d6180/2017/04/file_example_MP4_480_1_5MG.mp4"
	},
	"options":[
		{
			"title":"button title 1",
			"postbackText":"tracking text"
		}
	]
}' \
--data-urlencode 'src.name=TedLasso'

Header Parameters

ParameterTypeRequiredDescriptionExample
apikeystringYesAPI key for Gupshup account61b3021c97214370b341f8baaae0xxxx

Body Parameters

ParameterTypeRequiredDescriptionExample
sourceintegerYesSource phone number918929874278
destinationintegerYesDestination phone number918805162043
src.namestringYesApp nameaugust18
messageobjectYesMessage details (see below)

Message Object

The message object follows the schema below.

FieldTypeRequiredDescriptionExample
typestringYesType of session messagequick_reply
msgidstringNoTracking ID for postback textQR123456789
contentobjectYesContent of the messageSee content schema below
optionsarrayYesQuick reply options (up to 3)

Content Object

The content object contains the body and media of the message.

FieldTypeRequiredDescriptionExample
typestringYesContent typetext
textstringYesBody of the messageHello from Gupshup Team
urlstringNoURL of the media headerhttps://example.com/file.jpg
captionstringNoFooter textCheck this out!
filenamestringNoName of the file attachedfile.jpg

Options (Quick Reply)

Each option in the options array allows users to respond with a pre-defined message.

FieldTypeRequiredDescriptionExample
titlestringYesTitle of the quick reply buttonYes
postbackTextstringNoText sent back when the option is clickedUser clicked Yes

Responses

Success (200 OK)

On success, the API returns a status of submitted along with a unique messageId for tracking purposes.

FieldTypeDescriptionExample
statusstringStatus of the messagesubmitted
messageIdstringID of the sent message183dc8f1-7ecc-4419-895f-04fd0b1bfe07

Example Success Response

{
  "status": "submitted",
  "messageId": "183dc8f1-7ecc-4419-895f-04fd0b1bfe07"
}

Error Responses

400 Bad Request

This response indicates invalid input, such as an incorrect phone number or app details.

FieldTypeDescriptionExample
messagestringError messageInvalid Destination
statusstringStatus of the errorerror

401 Unauthorized

This response occurs when authentication fails due to an invalid API key.

FieldTypeDescriptionExample
messagestringError messageAuthentication Failed
statusstringStatus of the errorerror

429 Too Many Requests

This response indicates the rate limit has been exceeded.

FieldTypeDescriptionExample
messagestringError messageToo Many Requests
statusstringStatus of the errorerror
Language
Click Try It! to start a request and see the response here!