post https://partner.gupshup.io/partner/app//v3/message
Use this API to send message with a flow.
After you create a WhatsApp Flow, you can send it. To send a message with a flow, we have introduced a new type of the Interactive Object called flow.
Request Parameters
Key | Description | Values | Data Types | Required/Optional | Constraints |
---|---|---|---|---|---|
Authorization | Access Token for the application | {PARTNER_APP_TOKEN} | String | Required | Should be a valid Partner App Access Token. |
APP ID | App ID to fetch the access token | bf9ee64c-3d4d-4ac4-xxxx-732e577007c4 | String | Required | The Id should be a valid app Id of Gupshup |
messaging_product | Messaging product | String | Required | ||
recipient_type | Recipient type | individual | String | Required | |
to | Destination phone no where the message need to be send | 91785876xxxx | String | Required | Must be a valid phone number. |
type | Messaging type | interactive | String | Required | Type should be interactive to send address message. |
interactive | Add sticker body | "interactive": { "{{Flow_BODY}}" } | Object | Required | Key should be interactive to send flow message. |
Sample Request
curl --location --request POST 'https://partner.gupshup.io/partner/app/{{APP_ID}}/v3/message' \
--header 'Authorization: {{PARTNER_APP_TOKEN}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"recipient_type": "individual",
"messaging_product": "whatsapp",
"to": "{{WHATSAPP_USER_PHONE_NUMBER}}",
"type": "interactive",
"interactive": {
"type": "flow",
"header": {
"type": "{{TYPE}}",
"text": "{{FLOW_MSG_HEADER}}"
},
"body": {
"text": "{{FLOW_MSG_BODY}}}"
},
"footer": {
"text": "{{FLOW_MSG_FOOTER}}"
},
"action": {
"name": "flow",
"parameters": {
"flow_message_version": "{{FLOW_MSG_VERSION}}",
"flow_token": "{{FLOW_TOKEN}}",
"flow_id": "{{FLOW_ID}}",
"flow_cta": "{{FLOW_CTA}}",
"flow_action": "{{FLOW_ACTION}}",
"flow_action_payload": {
"screen": "{{SCREEN_NAME}}",
"data": {
"product_name": "{{PRODUCT_NAME}}",
"product_description": "{{DESCRIPTION}}",
"product_price": {{PRODUCT_PRICE}}
}
}
}
}
}
}'
Sample Response
{
"messages": [
{
"id": "GUPSHUP_MESSAGE_ID"
}
],
"messaging_product": "whatsapp",
"contacts": [
{
"input": "DESTINATION_PHONE_NO",
"wa_id": "DESTINATION_PHONE_NO"
}
]
}
Status Codes
Status Code | Response | Comments |
---|---|---|
Success | ||
200 | { "messages": [ { "id": "GUPSHUP_MESSAGE_ID" } ], "messaging_product": "whatsapp", "contacts": [ { "input": "DESTINATION_PHONE_NO", "wa_id": "DESTINATION_PHONE_NO" } ] } | |
Error | ||
401 | { "status": "error", "message": "Authentication Failed" } | When API key authentication fails |
400 | { "message": "Callback Billing must be enabled for this API", "status": "error" } | If Callback billing is not enabled for the app |
400 | { "message": "Invalid App Details", "status": "error" } | If app details are not found |