Template Message API

This endpoint (JSON containing 'type_template' object) sends a template message to a phone number on WhatsApp.

URL:​ ​https://waapi.pepipost.com/api/v2/message/

Method: POST

Parameters

Parameter

Description

Data Type

Required

recipient_whatsapp

Recipient’s phone number. Must be a valid number. Phone number must include a country code otherwise message might not get delivered.

String

Yes

recipient_type

Indicate whether the recipient is an individualor a group.

Specifying recipient_type in the request is optional when the value is individual. However, recipient_type is required when using group.

String

No

message_type

Type of a message.

Default : template

String

Yes

ttl

Time to live. If the message is not processed within your specified time period(days), the message will not be sent.

Number

No

source

Source id of the origin. Source id must be valid and obtained from source creation API.

String

Yes

x-apiheader

Any custom data which user needs to send. X-apiheader can be used instead of message id for mapping messages

String

No

type_media_template

The object used to send media with your template message

Object

Required to send media

type

Allowed values : document image video

String

Yes

url

URL on which the media is hosted

String

Yes

type_template

The object to indicate the template to be used to send a message to a recipient

Object

Yes

name

Name of the template

String

Yes in Text type message

attributes

Values of the variables of the template

String

No

locale

The approved language associated with the template that would be used to send the message

String

Yes

policy

Indicate how WhatsApp should treat the message. deterministic or fallback

String

No

Request Body

curl -X POST \
  https://waapi.pepipost.com/api/v2/message/ \
  -H 'Authorization: Bearer AUTH_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
	"message": [{
	    "recipient_whatsapp": "<mobile-number-with-country-code>", 
	    "message_type": "template",
	    "source": "<source-id>", 
	    "x-apiheader": "<custom-data>",
	    "type_template": [{
	        "name": "<template-name>", 
	        "attributes": ["sample1", "sample2"], // comma separated template attributes
	        "language": {
	            "locale": "<template-language>",
	            "policy": "deterministic" 
	        }
	    }] 
}]

Last updated