Gupshup

Usage Instructions

Integrate Gupshup's WhatsApp Business API into the workflow. Send text, media, quick reply buttons, list menus, and approved templates, look up templates and their approval status, and run workflows when a customer messages you or a message is delivered, read, or fails. WhatsApp only delivers free-form session messages within 24 hours of the customer's last message; outside that window, send an approved template. Requires a Gupshup API key, app name, and the app's WhatsApp number.

Actions

Gupshup Send WhatsApp Text

Send a free-form WhatsApp text message to a customer through Gupshup. WhatsApp only delivers session messages within 24 hours of the customer's last message to you. Outside that window the send fails (error 470), and only an approved template can be sent.

Input

ParameterTypeRequiredDescription
apiKeystringYesGupshup account API key, shown on the Gupshup dashboard. Sent as the apikey header.
appNamestringYesName of the Gupshup app that owns the source number (sent as src.name)
sourcestringYesYour WhatsApp Business number registered on the app, with country code, e.g. 919876543210
destinationstringYesCustomer WhatsApp number with country code, e.g. 919876543210 (a leading + is removed)
textstringYesMessage text. WhatsApp formatting like bold works.
previewUrlbooleanNoShow a link preview when the text contains a URL
replyToMessageIdstringNoMessage ID to reply to, shown as a quoted reply in WhatsApp. Must be less than 30 days old.

Output

ParameterTypeDescription
messageIdstringGupshup message ID. Message events (sent, delivered, read, failed) report it as gsId.
statusstringsubmitted (or success) means Gupshup accepted the request. Delivery is reported later as a message event.

Gupshup Send WhatsApp Media

Send an image, video, audio file, document, or sticker on WhatsApp through Gupshup, from a public URL or an uploaded media ID. WhatsApp only delivers session messages within 24 hours of the customer's last message to you. Outside that window the send fails (error 470), and only an approved template can be sent.

Input

ParameterTypeRequiredDescription
apiKeystringYesGupshup account API key, shown on the Gupshup dashboard. Sent as the apikey header.
appNamestringYesName of the Gupshup app that owns the source number (sent as src.name)
sourcestringYesYour WhatsApp Business number registered on the app, with country code, e.g. 919876543210
destinationstringYesCustomer WhatsApp number with country code, e.g. 919876543210 (a leading + is removed)
mediaTypestringYesimage, video, audio, document, or sticker
mediaUrlstringNoPublic HTTPS URL of the file. Provide this or Media ID.
mediaIdstringNoID of media already uploaded to Gupshup. Used instead of Media URL.
captionstringNoCaption shown under an image, video, or document
filenamestringNoFile name shown for a document, e.g. invoice-4821.pdf
replyToMessageIdstringNoMessage ID to reply to, shown as a quoted reply in WhatsApp. Must be less than 30 days old.

Output

ParameterTypeDescription
messageIdstringGupshup message ID. Message events (sent, delivered, read, failed) report it as gsId.
statusstringsubmitted (or success) means Gupshup accepted the request. Delivery is reported later as a message event.

Gupshup Send WhatsApp Buttons or List

Send a WhatsApp message with up to 3 quick reply buttons, or a list menu of up to 10 options, through Gupshup. The customer's choice arrives on the Gupshup Inbound Message trigger as a quick_reply or list_reply. WhatsApp only delivers session messages within 24 hours of the customer's last message to you. Outside that window the send fails (error 470), and only an approved template can be sent.

Input

ParameterTypeRequiredDescription
apiKeystringYesGupshup account API key, shown on the Gupshup dashboard. Sent as the apikey header.
appNamestringYesName of the Gupshup app that owns the source number (sent as src.name)
sourcestringYesYour WhatsApp Business number registered on the app, with country code, e.g. 919876543210
destinationstringYesCustomer WhatsApp number with country code, e.g. 919876543210 (a leading + is removed)
interactiveTypestringYesquick_reply (up to 3 buttons) or list (a menu of up to 10 rows)
bodystringYesMain message text
headerstringNoHeader text. Required for a list, where it is the list title.
footerstringNoFooter text shown in small grey type
buttonsjsonNoQuick reply buttons: up to 3 titles, comma-separated or a JSON array, e.g. ["Yes","No"] or [{"title":"Yes","postbackText":"confirm"}]
listButtonTitlestringNoFor a list: the label of the button that opens the menu, max 20 characters
sectionsjsonNoFor a list: rows as titles (comma-separated or a JSON array), or sections as [{"title":"Plans","options":[{"title":"Basic","description":"Rs 499/month","postbackText":"plan_basic"}]}]. Max 10 rows in total.
trackingIdstringNoYour ID for this message (msgid), returned as id in the reply payload so you can tell which menu was answered
replyToMessageIdstringNoMessage ID to reply to, shown as a quoted reply in WhatsApp. Must be less than 30 days old.

Output

ParameterTypeDescription
messageIdstringGupshup message ID. Message events (sent, delivered, read, failed) report it as gsId.
statusstringsubmitted (or success) means Gupshup accepted the request. Delivery is reported later as a message event.

Gupshup Send WhatsApp Template

Send an approved WhatsApp template message through Gupshup, filling its {{1}}, {{2}}... placeholders in order. Templates are the only messages WhatsApp delivers outside the 24-hour customer service window, so use one for the first message to a lead, reminders, and any follow-up after the customer has been quiet for 24 hours. The template must be APPROVED; check with List Templates.

Input

ParameterTypeRequiredDescription
apiKeystringYesGupshup account API key, shown on the Gupshup dashboard. Sent as the apikey header.
appNamestringYesName of the Gupshup app that owns the source number (sent as src.name)
sourcestringYesYour WhatsApp Business number registered on the app, with country code, e.g. 919876543210
destinationstringYesCustomer WhatsApp number with country code, e.g. 919876543210 (a leading + is removed)
templateIdstringYesGupshup template ID (the id from List Templates, not the template name)
templateParamsjsonNoValues for the template placeholders in order, as a JSON array or comma-separated list, e.g. ["Asha","15 Jan","10:30"]
headerMediaTypestringNoFor a media-header template: image, video, or document
headerMediaUrlstringNoPublic URL of the header image, video, or PDF
headerMediaIdstringNoUploaded media ID for the header, used instead of the URL
postbackTextsjsonNoPostback text for quick reply buttons, as [{"index":0,"text":"confirm"}] with a 0-based button index

Output

ParameterTypeDescription
messageIdstringGupshup message ID. Message events (sent, delivered, read, failed) report it as gsId.
statusstringsubmitted (or success) means Gupshup accepted the request. Delivery is reported later as a message event.

Gupshup List WhatsApp Templates

List the WhatsApp templates on a Gupshup app with their approval status, category, language, and body. Use it to find the template ID to send and to confirm a template is APPROVED, since only approved templates can be sent outside the 24-hour customer service window.

Input

ParameterTypeRequiredDescription
apiKeystringYesGupshup account API key, shown on the Gupshup dashboard. Sent as the apikey header.
appIdstringYesGupshup app ID (a UUID shown on the app dashboard, not the app name)
templateStatusstringNoOnly templates with this status, e.g. APPROVED
templateCategorystringNoOnly templates in this category: MARKETING, UTILITY, or AUTHENTICATION
languageCodestringNoOnly templates in this language, e.g. en
pageNonumberNoPage number, starting at 0 (default 0)
pageSizenumberNoTemplates per page (default 100)

Output

ParameterTypeDescription
templatesarrayTemplates on the app, with their approval status
↳ idstringGupshup template ID, used to send the template
↳ elementNamestringTemplate name
↳ statusstringApproval status, e.g. APPROVED, PENDING, REJECTED, PAUSED, or FAILED. Only APPROVED templates can be sent.
↳ categorystringMARKETING, UTILITY, or AUTHENTICATION
↳ templateTypestringTEXT, IMAGE, VIDEO, DOCUMENT, or LOCATION
↳ languageCodestringLanguage code, e.g. en
↳ datastringTemplate body with {{n}} placeholders
↳ qualitystringQuality rating, e.g. GREEN
↳ externalIdstringMeta template ID
↳ buttonSupportedstringButton types on the template
↳ createdOnnumberCreation time (epoch ms)
↳ modifiedOnnumberLast change time (epoch ms)
countnumberNumber of templates returned on this page

Gupshup Get WhatsApp Template

Get one WhatsApp template on a Gupshup app by its template ID, including its approval status, category, and body. Check that the status is APPROVED before sending it.

Input

ParameterTypeRequiredDescription
apiKeystringYesGupshup account API key, shown on the Gupshup dashboard. Sent as the apikey header.
appIdstringYesGupshup app ID (a UUID shown on the app dashboard, not the app name)
templateIdstringYesGupshup template ID

Output

ParameterTypeDescription
messageIdstringGupshup message ID of a sent message (gsId on status events)
statusstringSend result (submitted or success), or template approval status (Get Template)
templatesjsonTemplates from List Templates (id, elementName, status, category, templateType, languageCode, data, quality, externalId, buttonSupported, createdOn, modifiedOn)
countnumberNumber of templates returned
idstringTemplate ID (Get Template)
elementNamestringTemplate name
categorystringTemplate category
templateTypestringTemplate type, e.g. TEXT or IMAGE
languageCodestringTemplate language code
datastringTemplate body with placeholders
qualitystringTemplate quality rating
externalIdstringMeta template ID
buttonSupportedstringButton types on the template
createdOnnumberTemplate creation time (epoch ms)
modifiedOnnumberTemplate last change time (epoch ms)