post https://partner.gupshup.io/partner/app//template/msg
Use this API to send messages with Template ID
Parameters
Key | Description | Required/Optional | Type | Value |
---|---|---|---|---|
Authorization | Access Token for the application | Required | String | {{PARTNER_APP_TOKEN}} |
APP ID | Unique Identifier for Gupshup App | Required | String | {{APP_ID}} |
source | Phone number to send a message from. Required phone Number With Country Code | Required | Integer | 91891056XXXX |
src.name | App name | String | Required | Appname1 |
sandbox | Should be boolean value | Boolean | Optional | false |
destination | Phone number of the customer to send the message to. Required phone Number With Country Code. | Required | Integer | 918286836XXX |
template | MPM Template For the MPM template, params must include all params including a product ID (which is to be used as a thumbnail (last in the list)). For MPM template messages template section must be provided with valid Ids template={ "id":"3b9bf65b-979c-44d3-a269-dec2f20c4e52", "params":[ "zqc2qfz5fm" ], "mpm":{ "sections":\[{ "title":"Products", "products":[ "zqc2qfz5fm" ] }, { "title":"Products2", "products":[ "xyli96fcbn" ] }] } } Catalog Template The catalog template is only supported on CAPI. For catalog template Params should contain the productId which will be sent as thumbnail for the catalog (Must be the last element in templateParams list). | Optional | String | {"id": "007b7c0e-fc8d-4698-a9a8-3938151dd5da","params": ["monday","2020-12-20","apps"]} |
src.name | App name, whose appId used while creating template | Required | String | GupshupDevAssistant01 |
message | Required when templateType is 'LOCATION'. Add video or image id/link for media LTO templates | Optional | String | |
channel | Messaging channel to send message on. | Optional | String | |
Token | Your app token, please refer Get access token api to get the token from partner documentation. | Required | String | sk_61b3021c97xxx4370b341f8baaae0xxxx |
Sample Request
curl --location --request POST 'https://partner.gupshup.io/partner/app/{{APP_ID}}/template/msg' \
--header 'Connection: keep-alive' \
--header 'Authorization: {{PARTNER_APP_TOKEN}}' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'source={{SOUCR_PHONE_NUMBER}}' \
--data-urlencode 'sandbox=false' \
--data-urlencode 'destination={{DESTINATION_PHONE_NUMBER}}' \
--data-urlencode 'template={"id":"{{TEMPLATE_ID}}","params":["summer2023","summer2023","250FF"],"expiration":1703160863000}' \
--data-urlencode 'src.name={{SOURCE_APP_NAME}}'
Sample Response
{
"status": "submitted",
"messageId": "b****acb-3***-4***-98**-64*****ea9**"
}
Status Codes
Status Code | Response | Comment |
---|---|---|
Success | ||
200 | { "status": "submitted", "messageId": <messageId> } | |
Error | ||
400 | { "message": "Invalid Destination", "status": "error" } | If the destination is missing. |
400 | { "message": "Invalid App Details", "status": "error" } | If the source is missing or app details are not found"If the source is unavailable or the application details cannot be found. |
500 | { "status": "error", "message": "Internal server error. Please try again later and If Issue still persist than contact Gupshup Dev Support" } | For any Internal Error |