Web services to get WhatsApp templates

Webservices to get WhatsApp templates


Templates

/webhook/templates


Use the templates node to get your WhatsApp templates.


This document covers:

  • Pre-requisites
  • Requests
  • Phone number format
  • Responses
  • Example



Prerequisites

  • A Woztell account activated.
  • To use the Woztell API, you must first authenticate yourself and receive a token that enables access to the service. Contact support@woztell.com for more information on how to do this.



Requests

Message API calls are sent to the /templates endpoint regardless of the templates. See the following documentation for information regarding the type of templates you want to send:

GET https://webservice.woztell.com/webhook/templates

{

"WOZTELL_ADMIN":"your-woztell-admin-email",

"WOZTELL_TOKEN":"your-woztell-token",

"WOZTELL_NUMBER":"your-woztell-number" }


Parameters:

Parameter name

Data type

Description

Possible Values

WOZTELL_ADMIN*

String

Email address of your Woztell account.

WOZTELL_TOKEN*

String

Your Woztell account token.

abc-defgh-ijk-123

WOZTELL_NUMBER

String

Woztell phone number validated by WhatsApp. If you do not send any number, the WhatsApp main number will be used.

"+1-631-555-1002", "16315551002", "001(631)555-1002"or "1 631 555 1002" 

* Required parameters.





Phone number formats

The phone number in the request can be in any WhatsApp format.



The recommended best practice is to specify the country code with the phone number, always and explicitly adding the prefix plus sign (+) to it.


Phone number

Translated phone number

"+1-631-555-1002"

"+16315551002"

"6315551002"

"+6315551002" (invalid)


"1-631-555-1002"

"+16315551002"


001 (516) 283-7151"

"+15162837151"


"+54 9 11 5612-1008"

"+5491156121008"




Response

The information about the types of error and status messages is described below:


STATUS

DESCRIPTION

ERROR

METHOD NOT ALLOWED

ERROR

INVALID AUTHORIZATION

ERROR

INVALID WOZTELL NUMBER



{

"STATUS":"ERROR",

"DESCRIPTION":"INVALID JSON DATA" }


STATUS

TEMPLATES

SUCCESS

JSON with templates


{

"STATUS":"SUCCESS",

"TEMPLATES": {

        "0": {

            "CODE": "ESP1",

            "TEXT": "You made a purchase for {{1}} using a credit card ending in {{2}}.",

            "PARAMETERS": "2"

        },

        ...

        "N": {

            "CODE": "ESP2",

            "TEXT": "I'm sorry that I wasn't able to respond to your concerns yesterday but I’m happy to assist you now. If you’d like to continue this discussion, please reply with ‘yes’.",

            "PARAMETERS": "0"

        }, }



Example

When a message is sent in a request, the customer will receive a message such as this

GET https://webservice.woztell.com/webhook/messages

{

"WOZTELL_ADMIN":"admin@woztell.com",

"WOZTELL_TOKEN":"123-45678-90abcdefg-hij-klmn",

"WOZTELL_NUMBER":"0016665554444" }



You can use this PHP to send WhatsApp messages using your Woztell account:

<?php

$curl = curl_init();

 

curl_setopt_array($curl, array(

  CURLOPT_URL => 'https://webservice.woztell.com/webhook/templates?WOZTELL_ADMIN=admin@woztell.com&WOZTELL_TOKEN=123-45678-90abcdefg-hij-klmn&WOZTELL_NUMBER=0016665554444',

  CURLOPT_RETURNTRANSFER => true,

  CURLOPT_ENCODING => '',

  CURLOPT_MAXREDIRS => 10,

  CURLOPT_TIMEOUT => 0,

  CURLOPT_FOLLOWLOCATION => true,

  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,

  CURLOPT_CUSTOMREQUEST => 'GET'

));

 

$response = curl_exec($curl);

 

curl_close($curl); echo $response;


If you need more help, please contact us in support@woztell.com