Create a template


Explanation

Template messages need to get approval by WhatsApp (Meta) before you can start using them.

This API will guide you on submitting a new template.'


Create a Utility and Marketing template

(If you wish to create authentication template, please scroll down to the last part of this page.)


Remarks

  • If the template body is too general, it will not be approved.

  • You can use variables in this way: {{1}} and {{2}} and so on (up to 10 variables). this variables can be later set by you when you send the template to your clients.

  • A variable can be used only once inside the body. it means that if you used {{1}} somewhere in your body, you should not use {{1}} again.

  • You must have a reasonable number of variables compared to the rest of the text. Usually for every variable you need at least 3 words in your body. For example: if you have 5 variables, make sure the rest of the body has at least 15 words.

  • It usually takes up to 1 hour for a template to change status to be approved or rejected. you can't edit a rejected template, you must submit a new one with a new name.

  • Template name must be unique. If you delete a template, you can't use the same name for 30 days.

  • Template name must be lower case, English letters and numbers only. no spaces.

  • A template can contain more than just text. it can also have image/document/video as part of the template.

  • You can have up to 6000 templates in your account.

  • quick reply buttons must not contain variables, new lines, Emoji or any design symbols

  • A template can contain buttons for quick actions. You can have website / call / coupon / quick reply buttons, under those limitations:

    • A template can have a maximum of 10 buttons of all kinds.

    • You can have maximum of 1 'Call' button.

    • You can have maximum of 2 'Website' buttons.

    • You can have maximum of 10 'Quick reply' buttons.

    • You can have a maximum of 1 'Coupon' button.

  • If you wish to create a template that you will not be able to delete it after (an important template you wish to protect against accident delete) use this as the start of the template name: "reserved_".

  • The body of the template can't start with a variable and cant end with a variable.


Endpoint:

URL

https://api.99digital.co.il/whatsapp/v2/createTemplate

Method

JSON via POST


Template setup:

Each template needs to have a name and a language.


Content

Explanation

Mandatory

Example

limit (characters)

name

Name for your template, without spaces (use underscore instead), lower case, English only. template name must be unique

yes

website_login_new_client

512

language

language name

code to use

Hebrew

1

English

2

Arabic

3

Russian

4

Spanish

5

Chinese

6

Hindi

7

Thai

8

French

9

yes

1



Template structure:

Each template contains 4 parts:

  • header (media is optional).

  • body (mandatory).

  • footer (optional).

  • buttons (optional).


Content

Explanation

Mandatory

Number of variables allowed

Example

limit (characters)

header

Header allows you to choose media to be sent as part of the template

1 - no media

2 - image

3 - video

4 - document

yes

0

1


1

body

Your template message  goes here

\n for new line

text for bold

text for italic

~text~ for strike through

{{1}} - {{10}} for variables

yes

10

Hello {{1}}, and welcome to our website!

thank you for buying {{2}}. your order will be shipped on {{3}}.

1024 for total body content, including the variables data when sending the template

bodyVariableSample1-10

For any given variable you used in "body", you can provide a sample text for example.

for {{1}} use

bodyVariableSample1

for {{2}} use

bodyVariableSample2

and so on

No, but if not provided, auto variable sample will be generated for you

0

This is a sample text

500

footer

any footer you want to add.

no Emoji use, no variables.

no

0

this is footer, optional

60

buttons

1 - No buttons

2 - for "call to action" only

3 - for "quick reply" only

4 - both call to action and quick reply combination

yes. you must select 1/2/3/4

see below

see below

1


For the 'body' part, you can also use the following markups:



Buttons setup:

if you wish to use buttons, you need to choose between "call to action" or "quick reply" or using both.

  • call to action is a button that triggers an action. we have two types: url (which triggers website open with the phone's browser) and call (which makes a regular phone call to a number). you can use up to 1 call button and 2 website buttons in your template.

  • quick reply is a button that allows the user to click on it and return back webhook about the button text that was clicked. for example, a button name "sales" will return to your webhook url a reply saying that "sales" was clicked, so you can build your flow scenario according to that. you can have up to 10 buttons of quick reply type.

  • remember! total of 10 buttons is allowed from the two kinds.


Content

Explain

Option to select

Mandatory

Number of variables allowed

Example

Limit (characters)

callToAction

Here you can choose how you want to setup the call to action

1 - One website button only

2 - Call button only

3 - One website + Call button

4 - Two websites + Call button

5 - Two websites only

only if you selected "2" or "4" on "buttons"

-

3

1

callToActionWebsiteText

First website text to show

text to show for the link

only if you used 'callToAction' option 1 / 3 / 4 / 5

0

Click here for my website

20

callToActionWebsiteType

First website link type

1 - for static URL (meaning, no variable)


2 - for dynamic with one variable automatically added at the end of the URL

only if you used 'callToAction' option 1 / 3 / 4 / 5

0

1

1

callToActionWebsiteURL

First website link URL

The link to your website, you cannot use WhatsApp's groups, WhatsApp URL's for opening a conversation, and cannot use short URL services such as bitly.

only if you used 'callToAction' option 1 / 3 / 4 / 5

in case you choose "2" at the callToActionWebsiteType. the variable will be automatically put at the end. for example:

https://www.amazon.com/{{1}}

so when you send the template, you can provide what the {{1}} will be

https://www.google.com/

2000

callToActionWebsiteText2

Second website text to show, in case you want to use second website button. 

text to show for the link

only if you used 'callToAction' option 4 / 5

0

Click here for my second website

20

callToActionWebsiteType2

Second website link type

1 - for static URL (meaning, no variable)


2 - for dynamic with one variable automatically added at the end of the URL

only if you used 'callToAction' option 4 / 5

0

1

1

callToActionWebsiteURL2

Second website link URL

The link to your website, you cannot use WhatsApp's groups, WhatsApp URL's for opening a conversation, and cannot use short URL services such as bitly.

only if you used 'callToAction' option 4 / 5

in case you choose "2" at the callToActionWebsiteType2. the variable will be automatically put at the end. for example:

https://www.amazon.com/{{1}}

so when you send the template, you can provide what the {{1}} will be

https://www.amazon.com/

2000

callToActionCallText

The button text for the call

The text to show for the dial button

only if you used 'callToAction' option 2 / 3 / 4

0

Click here to call me

20

callToActionCallNumber

The number to dial to. the number is fixed.

the number to dial, with country code and +

only if you used 'callToAction' option 2 / 3 / 4

0

+972501234567

20

useCoupon

A coupon button is another type of "Call To Action" and can be added to any of the "callToAction" 1/3/4/5 options. when using coupon button the end user will receive copy code coupon message that can have expiration time.

if coupon code button is used, please notice the following limitations:

  • "body" parameter can only have 600 characters.

  • "header" can only be none/image/video and not a document.

  • at least one website url is required.

  • footer can not be used.

  • Only mobile phones using WhatsApp can see this template, not WhatsApp web.

0 to disable

1 to enable

no. default is 0.

0

1

1

couponTitle

The title of the coupon code that will be present next to the code in the template.

text to show for the coupon title

only if useCoupon is set to 1

0

Special offer!

16

couponExpiration

In case you want to use time limit for the coupon button. you will provide the expiration time when sending the template.

0 - to have a coupon without time limit.

1 - to limit the time to use the coupon.

only if useCoupon is set to 1

0

1

1

quickReply1-10

the quick reply buttons. up to 10 buttons

provide quickReply buttons as parameters (quickReply1, quickReply2, etc...)

Only if you selected 'buttons' parameter as 3 or 4

0

"customer service"

"sales"

"support"

25


Full Request

Parameter

Description / Example

apiKey

Your API key for the service

from

your WhatsApp account. international number without +. for example: 972771234567

name

any name for the template, cannot be used twice

language

1-10

header

2 for image

body

your template + variables goes here

\n for new line

text for bold

text for italic

~text~ for strike through

{{1}} for variable 1

{{2}} for variable 2

and so on (maximum 10 variables)

footer

footer text

buttons

3 for quick reply

callToAction

all what is relevant to buttons (phone calls, website(s), coupon code)

quickReply1-10

any text goes here


Full example 1:

here is an example of full template request. the request template is in English. 

The template contains:

  • no header.

  • body with 6 variables.

  • no footer.

  • 2 websites, 1 call button.

  • 5 buttons of "quick reply".


{
"apiKey": "your-api-key",
"from": "972501234567",
"name": "website_welcome",
"language": 2,
"header": 1,
"body": "*Hello {{1}}* and thank you for joining our exclusive website store!\nOur company has many secrets to discover.\nFor future connection, we received your phone number: {{2}} and your email address: {{3}}.\nYou can find shirts, hats, shoes and gloves at discounted prices. Hold on, wait a minute, i found something interesting! just for this week we offer: {{4}} at discounted price: {{5}} only when you buy it online or in-store shop at: {{6}}.\nWhat would you like to discover?",
"buttons": 4,
"callToAction": 4,
"callToActionWebsiteText": "Our Website",
"callToActionWebsiteType": 1,
"callToActionWebsiteURL": "https://www.example.com",
"callToActionWebsiteText2": "Our second website",
"callToActionWebsiteType2": 1,
"callToActionWebsiteURL2": "https://www.example-second-website.com",
"callToActionCallText": "Click to call us",
"callToActionCallNumber": "+972522222222",
"quickReply1": "Shirts",
"quickReply2": "Hats",
"quickReply3": "Shoes",
"quickReply4": "Gloves",
"quickReply5": "Something else"
}

The template submission will look like this:


When you send the template to your client, you need to fill the {{1}}, {{2}}, {{3}}, {{4}}, {{5}} and {{6}}.


Full example 2:

here is a sample of full template request. the request is appointment update template, in English.

the template contains:

  • image header

  • body with 2 variables

  • footer

  • buttons: call to action (one website + one call button)


{
"apiKey": "your-api-key",
"from": "972501234567",
"name": "friday_appointment_reminder",
"language": 2,
"header": 2,
"body": "*Hello {{1}}* we would like to remind you for the appointment you have with us on {{2}}. \n please arrive with your ID card.",
"footer": "Our address: 51D street.",
"buttons": 2,
"callToAction": 3,
"callToActionWebsiteText": "Click for navigation",
"callToActionWebsiteType": 1,
"callToActionWebsiteURL": "https://waze.com/ul",
"callToActionCallText": "Call Us",
"callToActionCallNumber": "+972779111111"
}


The template submission will look like this:



Full example 3:

here is a sample of full template request. the request is payment update template, in English.

the template contains:

  • document header

  • body with 2 variables

  • no footer

  • buttons: call to action (dynamic website)


{
"apiKey": "your-api-key",
"from": "972501234567",
"name": "payment_reminder_1",
"language": 2,
"header": 4,
"body": "*Dear {{1}}*\n your invoice for December 2021 is attached. Total amount is {{2}} USD. \n Please pay as soon as you can. \n The invoice is due in a week. 💳",
"buttons": 2,
"callToAction": 1,
"callToActionWebsiteText": "Click to pay",
"callToActionWebsiteType": 2,
"callToActionWebsiteURL": "https://paypal.com/"
}

The template submission will look like this:




Full example 4:

here is a sample of full template request. the request is transportation update template, in English.

the template contains:

  • no header

  • body with no variables

  • footer

  • no buttons


{
"apiKey": "your-api-key",
"from": "972501234567",
"name": "the_bus_is_coming",
"language": 2,
"header": 1,
"body": "*Dear NetBus user*\n Your bus is on its way. \n stay sharp. 🚍🚍🚍🚍",
"footer": "The wheels on the bus go round and round",
"buttons": 1
}


The template submission will look like this:



Full example 5:

here is a sample of full template request in English. the request is weekend sale with coupon code

the template contains:

  • no header

  • body with 2 variables

  • 1 website button (static website)

  • 1 phone button

  • 1 coupon code button with expiration time.


{
"apiKey": "your-api-key",
"from": "972501234567",
"name": "weekend_sale",
"language": 2,
"header": 1,
"body": "*Hello {{1}}*\n We value our VIP clients very much and would like to offer you {{2}} off for the weekend sale only!",
"buttons": 2,
"callToAction": 3,
"callToActionWebsiteText": "Click here for more",
"callToActionWebsiteType": 1,
"callToActionWebsiteURL": "https://www.amazon.com/store/",
"callToActionCallText": "Call Us",
"callToActionCallNumber": "+9725011223344",
"useCoupon": 1,
"couponTitle": "Weekend Sale!",
"couponExpiration": 1
}


The template submission will look like this:


(The 'Copy offer code' text is fixed and can't be changed, each template language will show the relevant translation. when the user clicks on it, it will copy the code. when sending the template, the expiration will show the relevant timer).


Response:

"status": "OK",
"name": "template name",
"timestamp": 1710861707,
"body": "The body text you wrote",
"category": 1,
"reason": 1


Response-Explain:

Parameter

Description

status

OK (template submitted to Meta) or FAIL (template error)

name

The template name you submitted

timestamp

The timestamp

body

the body message you submitted

category

The temporarily category that Meta selected for the template.

value

meaning

1

Utility template

2

Marketing template


The reason its 'temporarily' is because until the template is approved, the category can be changed by Meta. The final and actual category is determined when the template is approved and can be abtained by the 'Get template' api.

reason

'reason' is the status explanation in case of FAIL

1

not FAIL. the status is OK

2

Your "from" number account does not exist OR JSON syntax error

3

wrong apiKey

4

 'name' is either empty / too long / invalid / already exist in your account

5

'language' code is incorrect

6

'header' code is incorrect

7

The 'body' has one of the following issues:

- has more than 10 variables.

- text is too long.

- same variable appeared more than once.

- there are only parameters and no regular text.

- the body can't have more than two consecutive new lines (\n\n\n) together.

8

'footer' is too long or incorrect

9

'buttons' must be 1/2/3/4

10

you used 'call to action' / quick reply button, but didn't provide callToAction correct code or quick reply button

11

callToActionWebsiteText is invalid / too long

12

callToActionWebsiteType must be 1/2

13

callToActionWebsiteURL is invalid / too long

14

callToActionCallText is invalid / too long

15

callToActionCallNumber is invalid / too long

16

you used 'quick reply' button, but did not provide any buttons

17

You used more than 10 buttons

18

the number of bodyVariableSample you provided does not much the number of variables sent in 'body'

19

you must provide headerSample https URL of a file / file is invalid or too big

20

'callToActionWebsiteSample(1/2)' is mandatory for 'dynamic' callToActionWebsiteType(1/2)

21

quickReply button(s) are too long

22

The template contains too many variables compared to the length of the rest of text. Decrease the number of variables or increase the body length.

23

callToActionWebsiteText2 is invalid / too long

24

callToActionWebsiteType2 must be 1/2

25

callToActionWebsiteURL2 is invalid / too long

26

couponTitle is required / too long / wrong

27

couponExpiration is invalid

30

Unknown error, please check your syntax

31

quick reply buttons must not contain any emoji

32

Template content is authentication template, please change your syntax to match

33

Unable to create this kind of template, please contact support for more information

35

Permission denied to create templates, please contact our support




Create an Authentication template

Authentication code template is a different kind of template you can create.

It is still a template, but its different than the regular template creation and it doesn't contain the normal structure: header,body,footer,buttons.

Authentication code template is OTP, one time password code that you can send to your clients over WhatsApp. it looks like this:



Remarks

  • The template text is fixed and can't be changed (per language).

  • The "Copy code" button is fixed and can't be changed (per language).

  • The template will have "copy code" that will copy the code from WhatsApp for easy usage.

  • You can only create authentication template is your daily limit is 1000 or more.

  • The authentication template , when sending it, can only be visible from a mobile phone. if the WhatsApp Web is used by your client, the template message with the code will not be visible for him.


Endpoint (same as regular template creation):

URL

https://api.99digital.co.il/whatsapp/v2/createTemplate

Method

JSON via POST


Body:

Each template needs to have a name and a language.

Content

Explanation

Mandatory

Example

limit (characters)

Explanation

apiKey

Your API key for the service

Yes




from

Your WhatsApp account number

Yes




name

Name for your template, without spaces (use underscore instead), lower case, English only. template name must be unique

yes

login_code

512


language

language name

code to use

Hebrew

1

English

2

Arabic

3

Russian

4

Spanish

5

Chinese

6

Hindi

7

Thai

8

French

9

yes

1



authentication

1

(fixed, always)

yes

1

1

This is for our system to know you are building an authentication template

add_security_text

0 - no security message

1 - with security message

(default is 0)

No

1

1

This is a fixed text along with your code. as in the above screenshot, the text "For your security, do not share this code." will be added (based on your template language)

code_expiration

0-90 minutes for code expiration

(default is 0 - no expiration)

no

5

2

If you wish your code to expire, you can provide the code expiration in minutes between 1 to 90.

when the time is up, the "copy code" button will not be available and the text "the code has expired" will be instead.


Response:

"status": "OK",
"name": "template name",
"timestamp": 1710861707,
"category": 3,
"reason": 1


Response-Explain:

Parameter

Description

status

OK (template submitted to Meta) or FAIL (template error)

name

The template name you submitted

timestamp

The timestamp

category

The temporarily category.

value

meaning

3

Authentication template

reason

'reason' is the status explanation in case of FAIL

1

not FAIL. the status is OK

2

Your "from" number account does not exist OR JSON syntax error

3

wrong apiKey

4

 'name' is either empty / too long / invalid / already exist in your account

5

'language' code is incorrect

33

add_security_text is wrong or invalid

35

code_expiration is wrong or invalid or not in range