Here are the parameters used to create a template:
PARAMETER | FORMAT | REQUIRED | DESCRIPTION | DEFAULT |
name | string | Yes | Template name | |
language | string | Yes | Language code Please refer to the “supported language” code section | |
category | enum | Yes | Template category Supported Category: – MARKETING – UTILITY – AUTHENTICATION | |
header | string | Optional | Message header | |
headerFormat | string | Optional | Message header format | TEXT |
headerExample | array | Optional | This field is required when dynamic variable exist in the header | |
body | string | Yes | Message body | |
bodyExample | array | Optional | This field is required when dynamic variable exist in the body | |
footer | string | Optional | Message footer | |
otpAddSecurityRecommendation | boolean | Optional | Available only when creating an Authentication type template. Set to true if you want the template to include the string, For your security, do not share this code. | false |
otpMessageTtl | string | Optional | Available only when creating an Authentication type template. Sets authentication message Time-to-live (TTL) in seconds (must be >30s) | 600 |
otpExpiredAfter | string | Optional | Available only when creating an Authentication type template. Indicates the number of minutes the password or code is valid. If included, the code expiration warning and this value will be displayed in the delivered message. If omitted, the code expiration warning will not be displayed in the delivered message. Minimum 1, maximum 90. | 5 |
otpCopyButtonText | string | Optional | Available only when creating an Authentication type template. Copy code button label text. If omitted, the text will default to a pre-set value localized to the template’s language. Maximum 25 characters. |
Sample request using CURL:
Sample 1: Create English Template
$ curl -X POST https://api.geniq.io/rest/v1/whatsapp/message_templates \
-H 'Authorization: Bearer [TOKEN]' \
-H 'Content-Type: application/json' \
-d '{
"name":"sample_1",
"language":"en",
"category":"MARKETING",
"header":"Hi",
"headerFormat": "text",
"body": "This is the body",
"footer": "Thanks"
}' \
Sample 2: Create Chinese Template
$ curl -X POST https://api.geniq.io/rest/v1/whatsapp/message_templates \
-H 'Authorization: Bearer [TOKEN]' \
-H 'Content-Type: application/json' \
-d '{
"name":"sample_2",
"language":"zh_CN",
"category":"MARKETING",
"header":"您好",
"headerFormat": "text",
"body": "这是一则测试版模",
"footer": "谢谢"
}' \
Sample 3: Create Emoji Template
$ curl -X POST https://api.geniq.io/rest/v1/whatsapp/message_templates \
-H 'Authorization: Bearer [TOKEN]' \
-H 'Content-Type: application/json' \
-d '{
"name":"sample_3",
"language":"en",
"category":"UTILITY",
"header":"Hi",
"headerFormat": "text",
"body": "This is an emoji template 😀 😃 😄 😁 😆 😅 😂 😉 😌 😍 🥰 😘",
"footer": "Regards"
}' \
Sample 4: Create Template with Placeholder(s)
$ curl -X POST https://api.geniq.io/rest/v1/whatsapp/message_templates \
-H 'Authorization: Bearer [TOKEN]' \
-H 'Content-Type: application/json' \
-d '{
"name":"sample_4",
"language":"en",
"category":"MARKETING",
"header":"Hi {{1}}",
"headerFormat": "text",
"headerExample": [
"User"
],
"body": "Nice to meet you, {{1}}. Welcome to wonderland {{2}}",
"bodyExample": [
"Ali",
"Bye"
],
"footer": "Thanks"
}' \
Sample 5: Create Template (Authentication)
$ curl -X POST https://api.geniq.io/rest/v1/whatsapp/message_templates \
-H 'Authorization: Bearer [TOKEN]' \
-H 'Content-Type: application/json' \
-d '{
"name":"auth_sample_1",
"language":"en",
"category":"AUTHENTICATION"
}' \
Sample 6: Create Template (Authentication)
$ curl -X POST https://api.geniq.io/rest/v1/whatsapp/message_templates \
-H 'Authorization: Bearer [TOKEN]' \
-H 'Content-Type: application/json' \
-d '{
"name":"auth_sample_2",
"language":"en",
"category":"AUTHENTICATION",
"otpAddSecurityRecommendation": true,
"otpMessageTtl": "60",
"otpExpiredAfter": "1",
"otpCopyButtonText": "Copy"
}' \
Parameters returned in the API response:
PARAMETER | FORMAT | DESCRIPTION |
responseCode | string | Response code returned from the API call. Refer to section “Response Codes” for list of possible values |
responseMessage | string | Response message returned from the API call |
id | string | Template ID |
Sample Response:
{
"responseCode": "0",
"responseMessage": "Success",
"id":"778322986552978"
}