You are on page 1of 11

API to create WhatsApp templates

1
© 2021 Gupshup

All rights reserved. No parts of this work may be reproduced in any form or by any means
-graphic, electronic, or mechanical, including photocopying, recording, taping, or information
storage and retrieval systems -without the written permission of the publisher. Products that
are referred to in this document may be either trademarks and/or registered trademarks of
the respective owners. The publisher and the author make no claim to these trademarks.
While every precaution has been taken in the preparation of this document, the publisher
and the author assume no responsibility for errors or omissions, or for damages resulting
from the use of the information contained in this document or from the use of programs and
source code that may accompany it. In no event shall the publisher and the author be liable
for any loss of profit or any other commercial damage caused or alleged to have been
caused directly or indirectly by this document.

Published: Nov 26, 2021

©Gupshup 2021 2
API to create WhatsApp template details

API End Point:


https://wamedia.smsgupshup.com/GatewayAPI/rest

Supported Methods: POST

API Request Parameters

The request parameters must be specified as form-data

Parameter Description Values

userid Your Enterprise Account ID 2000xxxxxx


Type: Integer
Mandatory: Yes

password Your Enterprise Account dgtlk


Password
Type: String
Mandatory: Yes

type The type of template messages text


Type: String
Mandatory: yes
Possible Values:
text|document|image|video

method Type: String create_whatsapp_hsm


Mandatory: yes
Must be : create_whatsapp_hsm

category Template category ALERT_UPDATE


Type: String
Mandatory: yes

©Gupshup 2021 3
Must be one of these :
ALERT_UPDATE,
ACCOUNT_UPDATE,
APPOINTMENT_UPDATE,
ISSUE_RESOLUTION,
PAYMENT_UPDATE,
PERSONAL_FINANCE_UPDATE,
RESERVATION_UPDATE,
SHIPPING_UPDATE,
TICKET_UPDATE,
TRANSPORTATION_UPDATE

language The language code of the en_US


template
Example: en_US
Type: String
Mandatory: yes
Language codes are attached
below.

template_name The unique name for the


template payment_reminder_en
Type: string glish
Mandatory: yes

template Actual template body in


encoded format
This%C2%A0is%20a
Type: String
%20test%20template
Mandatory: yes
%0Awith%0D%0A%7
B%7B1%7D%7D%0A
variables

©Gupshup 2021 4
template_variable_exa The sample variable values, %5B%E2%80%9CJud
mples must be encoded in the APi e%E2%80%9D%5D
request
Type: String
Mandatory: yes
Variable specification format
[“variable value 1”, “variable
value 2”...]

header The header of the template. This Test%20header%7B%


must be encoded 7B1%7D%7D
Only valid for non - media
templates
Type: String
Mandatory: No
Maximum 60 characters
(including variables)

header_examples The sample values for variable %5B%22Joe%22%5D


in the header.
For template of type text, the
header must be encoded.
For media templates, the header
example must have the sample
Type: String
Mandatory: No

footer The footer for the template must thanks%20for%20sho


be encoded. pping
Type: String
Mandatory: No
Maximum 60 characters

©Gupshup 2021 5
quick_reply_buttons The buttons to be specified for %5B%22Agree%22%
Quick replies 2C%22Disagree%22
Type: String %2C%22Cancel%22
Mandatory: No %5D
Maximum 3 buttons and each
button name can be maximum
20 characters . This must be
encoded in the API request.
["Button1 name","Button2
name","Button3 name"]

call_to_action_buttons The CTA buttons to be specified %5B%7B%22text%22


for the template, it must be %3A%22Dynamic%20
encoded %0AButton%22%2C%
Type: String 22type%22%3A%22ur
Mandatory: No l%22%2C%22url%22
Types : %3A%22http%3A%2F
1) Only 1 click to call- visit %2Fwww.africau.edu
website (static) %22%2C%22urlType
[{"text":"Button1name”,"type":"ur %22%3A%22dynamic
l","url":"http://www.africau.edu"," %22%7D%2C%5D
urlType":"static"}]

2) Only 1 click to call- visit


website (dynamic)
[{"text":"Button1name","type":"ur
l","url":"http://www.africau.edu","
urlType":"dynamic","example":["
http://www.africau.edu/sddssads
ad"]}]

3) Only 1 click to call -


Phone number
[{"text":"Dynamic

©Gupshup 2021 6
Button","type":"phone_number",
"phone_number":"91989898989
8998"}]

4) 1 Click to call - website


and 1 click to call phone
number
[{"text":"Call
Us","type":"phone_number","ph
one_number":"91989898989899
8"},{"text":"Visit
Us","type":"url","url":"http://www.
africau.edu","urlType":"dynamic"
,"example":["http://www.africau.e
du/sddssadsad"]}]

Sample text template creation:

curl --location --request POST 'https://wamedia.smsgupshup.com/GatewayAPI/rest' \


--form 'userid="2000xxxxxx"' \
--form 'password="XXXXXXXX"' \
--form 'method="create_whatsapp_hsm"' \
--form 'template_name="test_template3"' \
--form 'category="ALERT_UPDATE"' \
--form 'language="en_US"' \
--form
'template="This%C2%A0is%20a%20test%20template%0Awith%0D%0A%7B%7B1%7D%7
D%0Avariables"' \
--form 'type="text"' \
--form 'template_variable_examples="%5B%22Jon%22%2C%22Denver%22%5D"' \
--form 'header="Testing%20template%20%7B%7B1%7D%7D"' \
--form 'header_examples="%5B%22alexa%22%5D"' \
--form 'footer="thanks%20for%20shopping"' \

©Gupshup 2021 7
--form
'quick_reply_buttons="%5B%22Agree%22%2C%22Disagree%22%2C%22Cancel%22%5D
"'

Sample media template creation:

curl --location --request POST 'https://wamedia.smsgupshup.com/GatewayAPI/rest' \


--form 'userid="2000xxxxxx"' \
--form 'password="XXXXXXXX"' \
--form 'method="create_whatsapp_hsm"' \
--form 'template_name="test_template3"' \
--form 'category="ALERT_UPDATE"' \
--form 'language="en_US"' \
--form
'template="This%C2%A0is%20a%20test%20template%0Awith%0D%0A%7B%7B1%7D%7
D%0Avariables"' \
--form 'type="image"' \
--form 'template_variable_examples="%5B%22Jon%22%2C%22Denver%22%5D"' \
--form 'header_examples=@"NPZ7j7b7r/shopping.png"' \
--form 'footer="thanks%20for%20shopping"' \
--form
'quick_reply_buttons="%5B%22Agree%22%2C%22Disagree%22%2C%22Cancel%22%5D
"'

Template language codes :

Language Code

Afrikaans af

Albanian sq

Arabic ar

Azerbaijani az

Bengali bn

Bulgarian bg

Catalan ca

Chinese (CHN) zh_CN

©Gupshup 2021 8
Chinese (HKG) zh_HK

Chinese (TAI) zh_TW

Croatian hr

Czech cs

Danish da

Dutch nl

English en

English (UK) en_GB

English (US) en_US

Estonian et

Filipino fil

Finnish fi

French fr

Georgian ka

German de

Greek el

Gujarati gu

Hausa ha

Hebrew he

Hindi hi

Hungarian hu

Indonesian id

Irish ga

Italian it

Japanese ja

Kannada kn

Kazakh kk

©Gupshup 2021 9
Kinyarwanda rw_RW

Korean ko

Kyrgyz (Kyrgyzstan) ky_KG

Lao lo

Latvian lv

Lithuanian lt

Macedonian mk

Malay ms

Malayalam ml

Marathi mr

Norwegian nb

Persian fa

Polish pl

Portuguese (BR) pt_BR

Portuguese (POR) pt_PT

Punjabi pa

Romanian ro

Russian ru

Serbian sr

Slovak sk

Slovenian sl

Spanish es

Spanish (ARG) es_AR

Spanish (SPA) es_ES

Spanish (MEX) es_MX

Swahili sw

Swedish sv

©Gupshup 2021 10
Tamil ta

Telugu te

Thai th

Turkish tr

Ukrainian uk

Urdu ur

Uzbek uz

Vietnamese vi

Zulu zu

©Gupshup 2021 11

You might also like