Send Flow Message

Use this API to send message with a flow.

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…
📘

Note:

Marketing Messages sent via Cloud API will be deprecated by October 2027, Update your endpoints to MM Lite for marketing messages.


📘

Note:

  1. Use the recipient parameter only when BSUID is enabled for the app.
  2. When both to and recipient fields are used in the payload, the to field gets the priority.

Request Parameters

KeyDescriptionValueData typeRequired/OptionalConstraints
AuthorizationAccess Token for the application{{PARTNER_APP_TOKEN}}StringRequiredShould be a valid Partner App Access Token
appIdApp ID to fetch the access token{{APP_ID}}StringRequired
  • The Id should be a valid app Id of Gupshup. - The App must be associated with the account that owns the PARTNER_APP_TOKEN being used
messaging_productMessaging productwhatsappStringRequired
recipient_typeRecipient typeindividualStringRequired
toDestination phone no where the message needs to be send91785876xxxxStringRequired (Can be optional if BSUID is enabled for the app and recipient parameter is used instead)Must be a valid phone number
recipientDestination BSUID where the message needs to be sentIN.461449821882xxxxStringOptionalMust be a valid BSUID
typeMessaging typetemplateStringRequiredType should be a template to send template message.
templateTemplate message inside body. For flow templates, add a button component with sub_typeflow, index0 and an action parameter holding the flow_token.

"template":

{"name": "Template"......}

objectRequiredKey should be a template to send template message.
📘

Dynamic flows (data_exchange)

For a template whose flow button uses data_exchange, pass a flow_token in the button component. WhatsApp sends this token to your flow endpoint with every data exchange request, so you can use it to identify the user or session. The first screen comes from your endpoint. See Dynamic flow prerequisites.

Sample Request - Dynamic flow template

curl --location 'https://partner.gupshup.io/partner/app/{{APP_ID}}/v3/message' \
--header 'Authorization: {{PARTNER_APP_TOKEN}}' \
--header 'Content-Type: application/json' \
--data '{
  "messaging_product": "whatsapp",
  "recipient_type": "individual",
  "to": "{{DESTINATION_PHONE_NO}}",
  "type": "template",
  "template": {
    "name": "dynamic_flow_signup",
    "language": { "code": "en" },
    "components": [
      {
        "type": "button",
        "sub_type": "flow",
        "index": "0",
        "parameters": [
          { "type": "action", "action": { "flow_token": "{{FLOW_TOKEN}}" } }
        ]
      }
    ]
  }
}'

The same request sends a dynamic flow template whose button uses navigate (see Template definition). Only the first screen differs: it comes from the flow JSON instead of your endpoint.

Sample Request - Static flow template

curl --location 'https://partner.gupshup.io/partner/app/{{APP_ID}}/v3/message' \
--header 'Authorization: {{PARTNER_APP_TOKEN}}' \
--header 'Content-Type: application/json' \
--data '{
  "messaging_product": "whatsapp",
  "recipient_type": "individual",
  "to": "{{DESTINATION_PHONE_NO}}",
  "type": "template",
  "template": {
    "name": "static_flow_signup",
    "language": { "code": "en" },
    "components": [
      {
        "type": "button",
        "sub_type": "flow",
        "index": "0",
        "parameters": [
          { "type": "action", "action": { "flow_token": "{{FLOW_TOKEN}}" } }
        ]
      }
    ]
  }
}'

If the template body has variables, add a body component with their values before the button component.

📘

Delivery errors arrive asynchronously

This API returns 200 with a message id once the message is accepted, even when the template is still PENDING or has FAILED. Delivery problems (for example 131049, the marketing frequency cap, or a template that isn't approved) are reported in the failed status event on your webhook.

Template definition (for reference)

📘

Not a request to this API

These show how the flow button is defined inside the template. Create the template with the Flow template API, then send it with one of the sample requests above.

Static flow (navigate)

The flow opens on navigate_screen. Here the flow is given inline as flow_json (a flow_id of a published flow works too).

{
	"name": "example_template_name",
	"language": "en_US",
	"category": "MARKETING",
	"components": [
		{
			"type": "body",
			"text": "This is a flows as template demo"
		},
		{
			"type": "BUTTONS",
			"buttons": [
				{
					"type": "FLOW",
					"text": "Sign up",
					"flow_action": "navigate",
					"navigate_screen": "WELCOME_SCREEN",
					"flow_json": "{\"version\":\"7.0\",\"screens\":[{\"id\":\"WELCOME_SCREEN\",\"title\":\"Welcome\",\"terminal\":true,\"success\":true,\"data\":{},\"layout\":{\"type\":\"SingleColumnLayout\",\"children\":[{\"type\":\"TextHeading\",\"text\":\"Hello World\"},{\"type\":\"TextBody\",\"text\":\"Let's start building things!\"},{\"type\":\"Footer\",\"label\":\"Complete\",\"on-click-action\":{\"name\":\"complete\",\"payload\":{}}}]}}]}"
				}
			]
		}
	]
}

Dynamic flow (data_exchange)

The flow must be published with an endpoint_uri. There is no navigate_screen: the first screen comes from your endpoint.

{
	"name": "example_dynamic_template_name",
	"language": "en_US",
	"category": "MARKETING",
	"components":
	[
		{
			"type": "body",
			"text": "This is a dynamic flows as template demo"
		},
		{
			"type": "BUTTONS",
			"buttons":
			[
				{
					"type": "FLOW",
					"text": "Sign up",
					"flow_id": "{{FLOW_ID}}",
					"flow_action": "data_exchange"
				}
			]
		}
	]
}

Dynamic flow opened with navigate

The flow is published with an endpoint_uri, but the template opens it on a fixed first screen from the flow JSON (navigate_screen). WhatsApp doesn't call your endpoint when the flow opens. It calls the endpoint ("action": "data_exchange", with the same flow_token) when the user submits a screen whose action is data_exchange.

{
	"name": "example_dynamic_navigate_template_name",
	"language": "en_US",
	"category": "MARKETING",
	"components":
	[
		{
			"type": "body",
			"text": "Complete your sign-up in two quick steps. Tap below to start."
		},
		{
			"type": "BUTTONS",
			"buttons":
			[
				{
					"type": "FLOW",
					"text": "Start sign-up",
					"flow_id": "{{FLOW_ID}}",
					"flow_action": "navigate",
					"navigate_screen": "{{FIRST_SCREEN_ID}}"
				}
			]
		}
	]
}
Template flow_actionFlow has endpoint_uriFirst screenEndpoint called
navigateNo (static)navigate_screen from the flow JSONNever
navigateYes (dynamic)navigate_screen from the flow JSONOn each data_exchange action
data_exchangeYes (dynamic)Returned by the endpoint (INIT)When the flow opens, then on each data_exchange action

Sample Response

{
	"messages": 
	[
		{
			"id": "GUPSHUP_MESSAGE_ID"
		}
	],
	"messaging_product": "whatsapp",
	"contacts": 
	[
		{
			"input": "DESTINATION_PHONE_NO",
			"wa_id": "DESTINATION_PHONE_NO"
		}
	]
}

Status Codes

Status CodeResponseComments
Success
200

{

"messages":[{"id": "GUPSHUP_MESSAGE_ID"}
],
"messaging_product": "whatsapp",
"contacts":
[
{
"input": "DESTINATION_PHONE_NO",
"wa_id": "DESTINATION_PHONE_NO"
}
]
}

Error
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
401

{

"status": "error",
"message": "Authentication Failed"}

When API key authentication fails
Path Params
string
required

Unique identifier of the app.

Body Params
string
required
string
string
required

Destination phone number. Optional when BSUID is enabled and recipient is used.

string

Destination BSUID (only when BSUID is enabled for the app).

string
required
template
object
required

Template name, language and components. For flow templates, add a button component (sub_type flow, index 0) with an action parameter holding flow_token.

Headers
string
required

Your app token, please refer Get access token api to get the token from partner documentation.

Responses

Language
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json