1. Home
  2. Docs
  3. WhatsApp
  4. Manage WhatsApp Template

Manage WhatsApp Template

API URL Endpoint:
https://api.geniq.io/rest/v1/whatsapp/message_templates

Create Template Parameters

PARAMETERFORMATREQUIREDDESCRIPTIONDEFAULT
namestringYesTemplate name
languagestringYesLanguage code
Refer to the supported language code section:
https://www.geniq.io/docs/whatsapp-messaging/supported-languages/
typestringYesTemplate type
headerstringOptionalMessage header
bodystringYesMessage body
footerstringOptionalMessage footer

Sample request using CURL:

Sample 1: Create English Template

$ curl -X POST https://api.geniq.io/rest/v1/whatsapp/message_templates \
-H 'Authorization: Basic dXNlcjE6cGFzczE=' \
-d "name=template1" \
-d "language=en" \
-d "type=text" \
-d "header=Hi all," \
-d "body=This is a test message" \
-d "footer=Regards"

Sample 2: Create Chinese Template

$ curl -X POST https://api.geniq.io/rest/v1/whatsapp/message_templates \
-H 'Authorization: Basic dXNlcjE6cGFzczE=' \
-d "name=template2" \
-d "language=zh_CN" \
-d "type=text" \
-d "header=您好," \
-d "body=这是一则测试版模" \
-d "footer=谢谢"

Sample request using CURL:

Sample 3: Create Emoji Template

$ curl -X POST https://api.geniq.io/rest/v1/whatsapp/message_templates \
-H 'Authorization: Basic dXNlcjE6cGFzczE=' \
-d "name=template1" \
-d "language=en" \
-d "type=text" \
-d "header=Hi all," \
-d "body=This is an emoji template 😀 😃 😄 😁 😆 😅 😂 🤣 🥲 😊 😇 🙂 🙃 😉 😌 😍 🥰 😘 " \
-d "footer=Regards"

Sample 4: Create Template with Placeholder(s)

$ curl -X POST https://api.geniq.io/rest/v1/whatsapp/message_templates \
-H 'Authorization: Basic dXNlcjE6cGFzczE=' \
-d "name=template1" \
-d "language=en" \
-d "type=text" \
-d "header=Hi {{1}}," \
-d "body=Nice to meet you, {{1}}.
Welcome to wonderland {{2}}" \
-d "footer=Regards,"

Parameters returned in the API response:

PARAMETERFORMATDESCRIPTION
responseCodestringResponse code. Possible values:
0: Success
8: Account Invalid Configuration
88: General Failure
311: WhatsApp Template rejected
312: WhatsApp Template with same content already existed
responseMessagestringResponse message
idstringTemplate id

Sample Response:

{
    "responseCode": "0",
    "responseMessage": "Success",
    "id":"778322986552978"
}

Retrieve Template(s)

PARAMETERFORMATREQUIREDDESCRIPTIONDEFAULT
limitintegerOptionalLimit the total number of result return
categorystringOptionalTemplate Category
Category list:
UTILITY
AUTHENTICATION 
MARKETING
namestringOptionalThe name for a message template
languagestringOptionalLanguage.
Refer to the supported language code section.
https://www.geniq.io/docs/whatsapp-messaging/supported-languages/
statusstringOptionalStatus
Possible status:
APPROVED
IN_APPEAL
PENDING
REJECTED
PENDING_DELETION
DELETED
DISABLED
LOCKED
contentstringOptionalThe content for a template
beforestringOptionalPage cursor. Previous page.
afterstringOptionalPage cursor. Next page.

Sample request using CURL:

$ curl -X GET https://api.geniq.io/rest/v1/whatsapp/message_templates \
-H 'Authorization: Basic dXNlcjE6cGFzczE=' \
-d "limit=1" \
-d "category=UTILITY" \
-d "status=APPROVED"

Parameters returned in the API response:

PARAMETERFORMATDESCRIPTION
responseCodestringResponse code. Possible values:
0: Success
8: Account Invalid Configuration
88: General Failure
responseMessagestringResponse message
data[0].namestringTemplate name
data[0].components[0].typestringTemplate type (Header)
data[0].components[0].formatstringTemplate format (Header)
data[0].components[0].textstringTemplate text (Header)
data[0].components[1].typestringTemplate type (Body)
data[0].components[1].textstringTemplate text (Body)
data[0].components[2].typestringTemplate type (Footer)
data[0].components[2].textstringTemplate text (Footer)
paging.cursors.beforestringPrevious page number
paging.cursors.afterstringNext page number

Sample Response:

{
    "responseCode": "0",
    "responseMessage": "Success",
    "data": [
        {
            "name": "template1",
            "components": [
                {
                    "type": "HEADER",
                    "format": "TEXT",
                    "text": "Hi all,"
                },
                {
                    "type": "BODY",
                    "text": "This is a test message"
                },
                {
                    "type": "FOOTER",
                    "text": "Regards"
                }
            ],
            "language": "en",
            "status": "APPROVED",
            "category": "TRANSACTIONAL",
            "id": "778322986552978"
        }
    ],
    "paging": {
        "cursors": {
            "before": "MAZDZD",
            "after": "MAZDZD"
        }
    }
}

Delete Template

PARAMETERFORMATREQUIREDDESCRIPTIONDEFAULT
namestringYesTemplate name
idstringOptionalTemplate id

Sample request using CURL:

$ curl -X DELETE https://api.geniq.io/rest/v1/whatsapp/message_templates \
-H 'Authorization: Basic dXNlcjE6cGFzczE=' \
-d "name=template1" 

Parameters returned in the API response:

PARAMETERFORMATDESCRIPTION
responseCodestringResponse code. Possible values:
0: Success
8: Account Invalid Configuration
88: General Failure
responseMessagestringResponse message

Sample Response:

{
    "responseCode": "0",
    "responseMessage": "Success",
    "id":"778322986552978"
}