How do I send a template message using the API? Gupshup February 10, 2022 14:43 Updated You can send an approved template message using the send message API. Click here to refer API document. Related articles How to get a verified tick? How will my display name show to end users? Is there an API to check my account's wallet balance? Why do I get a "Media URL Not Whitelisted" error? How do I whitelist a media URL? Can i send image/video/audio/document with caption? How do I block a spam user? Is there an API for blocking users for sending spam messages? Comments 11 comments Sort by Date Votes Juan Souteras December 02, 2021 15:35 How can I specify the name of the document in a template message? 1 Kauntal Patel December 06, 2021 15:22 Hi Juan, We have updated the CURL given in this FAQ. For your direct answer, here is the payload: {"type":"document","document":{"link":"https://www.buildquickbots.com/whatsapp/media/sample/pdf/sample01.pdf","filename": "Sample funtional resume"}} 1 Juan Souteras December 06, 2021 15:30 Great! I will try it. Thanks! 0 Hafizh Fauzan December 14, 2021 09:59 Hi, when i tried the CURL, it says "Mapped Bot Not Found", is there any solution with this? Thanks 4 Satya B February 11, 2022 10:50 Is it solved Hafizh Fauzan? 0 María Citlali Hernández Escareño February 19, 2022 01:27 Hi when I try to use the new template messaging API I am getting the next error: payload: { code: 1008, reason: "Required parameter is missing:Missing mandatory parameter 'to'" }But I can't find nothing related to "to" parameter in https://www.gupshup.io/developer/docs/bot-platform/guide/whatsapp-api-documentation#templateAPIEndpointThanks and I appreciate any help. 2 Almashines India April 26, 2022 11:37 In reply to @Hafizh Fauzan, In case of error message "Mapped Bot Not Found", try adding src.name param in curl request. 0 varshitha s July 05, 2022 13:34 @María Citlali Hernández EscareñoDid u solve ua issue ?if yes can u please tell, i'am dealing with similar issue 0 Carlos March 02, 2023 19:26 in reply to @María Citlali Hernández Escareño and @varshitha s I get this error when I try to send templates from sandbox. payload: { code: 1008, reason: "Required parameter is missing:Missing mandatory parameter 'to'"} But it does not appear when the application is live. I guess the templates can't be used from sandbox. 0 Luis Ernesto Mendoza Sánchez April 24, 2023 06:53 2023 and the error:Required parameter is missing:Missing mandatory parameter 'to'... persist 0 terentvi May 06, 2023 20:48 Hi, The problem was solved by converting list to json: Python example: import requestsimport jsonurl = 'https://api.gupshup.io/sm/api/v1/template/msg'headers = {'apikey': 'XXXXX', 'Content-Type': 'application/x-www-form-urlencoded'}template = {'id': 'XXXXX', 'params': ['var1', 'var2']}template_json_object = json.dumps(template)data = {'source': 'XXXXX', 'destination': 'XXXXX', 'template': template_json_object}requests.post(url, data=data, headers=headers) CURL example: curl --location --request POST 'http://api.gupshup.io/sm/api/v1/template/msg' \--header 'apikey: XXXXX' \--header 'Content-Type: application/x-www-form-urlencoded' \--data-urlencode 'source=XXXXX' \--data-urlencode 'destination=XXXXX' \--data-urlencode 'template={"id": "XXXXX", "params": ["var1","var2"]}' -- Best regards, Andrey AiApps.Pro 0 Please sign in to leave a comment.
Comments
11 comments
How can I specify the name of the document in a template message?
Hi Juan,
We have updated the CURL given in this FAQ.
For your direct answer, here is the payload:
Great! I will try it.
Thanks!
Hi, when i tried the CURL, it says "Mapped Bot Not Found", is there any solution with this? Thanks
Is it solved Hafizh Fauzan?
Hi
when I try to use the new template messaging API I am getting the next error:
payload: {
code: 1008,
reason: "Required parameter is missing:Missing mandatory parameter 'to'"
}
But I can't find nothing related to "to" parameter in https://www.gupshup.io/developer/docs/bot-platform/guide/whatsapp-api-documentation#templateAPIEndpoint
Thanks and I appreciate any help.
In reply to @Hafizh Fauzan,
In case of error message "Mapped Bot Not Found", try adding src.name param in curl request.
@María Citlali Hernández Escareño
Did u solve ua issue ?
if yes can u please tell, i'am dealing with similar issue
in reply to @María Citlali Hernández Escareño and @varshitha s
I get this error when I try to send templates from sandbox.
payload: {
code: 1008,
reason: "Required parameter is missing:Missing mandatory parameter 'to'"
}
But it does not appear when the application is live.
I guess the templates can't be used from sandbox.
2023 and the error:
Required parameter is missing:Missing mandatory parameter 'to'...
persist
Hi,
The problem was solved by converting list to json:
Python example:
Please sign in to leave a comment.