Templates

You can send a template message to a specific phone number using WhatsApp’s Template Messages.

Warning

You must have a Whatsapp-approved template message to use this feature. The approved template message must be saved on the Connexease platform. Contact Connexease for confirmation of the template message and registration of the approved template message on the platform.

Getting Templates

GET /templates/

Lists your existing template messages.

Status Codes:

Example request:

GET /templates/?is_active=true HTTP/1.1
Authorization: JWT ZG9udHRyeW1lIQ==
Host: api.connexease.com
Accept: application/json
Query Parameters:
 
  • is_active (string) – Optional filter attribute for active/inactive templates. Allowed values: true/false

Example successful response:

HTTP/1.1 200 OK
Content-Type: application/json

[
    {
        "uuid": "520a311e-988a-4d56-9acb-7132758e5114",
        "account": {
            "uuid": "a0ea3538-5e4a-4a6a-a452-6f856bb2ef53",
            "name": "Acme Ltd.",
            "is_active": true
        },
        "channels": [
            {
                "uuid": "e0b3a3f7-5447-4a4d-b4fe-d6d651611b08",
                "name": "WhatsApp Channel",
                "is_active": true
            }
        ],
        "namespace": "f4b2b57e-19ea-48f9-8a13-2d99283cda38",
        "element_name": "custom_custom",
        "is_active": true,
        "content": "Hi $1, the problem you reported on $2 has been resolved.",
        "params": {
            "fields": [
                {
                    "label": "Customer Name",
                    "placeholder": "$1"
                },
                {
                    "label": "Date",
                    "placeholder": "$2"
                }
            ]
        }
    }
]

Example failed response:

HTTP/1.1 403 Forbidden
Content-Type: application/json

{
  "detail": "Invalid Authorization header. No credentials provided."
}

Send Template Message

POST /template_message/single/

Send template message to single receiver.

Status Codes:

Example request:

POST /template_message/single/ HTTP/1.1
Authorization: JWT ZG9udHRyeW1lIQ==
Host: api.connexease.com
Accept: application/json

{
    "template_uuid": "520a311e-988a-4d56-9acb-7132758e5114",
    "channel_uuid": "b51386d9-dc40-4fdf-82f9-fb342c82c4e9",
    "params": {
        "phone_number":"905311111111",
        "name":"John",
        "customer_uuid":"94640ead-8904-45df-9392-242f0d521682",
        "unassign_and_archive": true,
        "group":"b5cad8f4-5008-47ec-b3b8-bcd7e3014da4",
        "$1":"John Doe",
        "$2":"08/10/2019"
    }
}

Warning

If there are many variables in your template message, you should put that value in params. For example, if there are 3 variables, params should include $1, $2, $3. If there is no variable, it should only contain the phone number. If there is no phone number, it should contain the customer_uuid.

Example Media template message with media:

POST /template_message/single/ HTTP/1.1
Authorization: JWT ZG9udHRyeW1lIQ==
Host: api.connexease.com
Accept: application/json

{
    "template_uuid": "520a311e-988a-4d56-9acb-7132758e5114",
    "channel_uuid": "b51386d9-dc40-4fdf-82f9-fb342c82c4e9",
    "params": {
        "phone_number":"905311111111",
        "name":"John",
        "customer_uuid":"94640ead-8904-45df-9392-242f0d521682",
        "unassign_and_archive": true,
        "group":"b5cad8f4-5008-47ec-b3b8-bcd7e3014da4",
        "$1":"John Doe",
        "$2":"08/10/2019",
        "data": {
            "url": "https://cdn.allinone.connexease.com/8a870125-7538-4ce1-8b31-a3a9e0ea26bc.jpg"
        }
    }
}

Example Media template message with location:

POST /template_message/single/ HTTP/1.1
Authorization: JWT ZG9udHRyeW1lIQ==
Host: api.connexease.com
Accept: application/json

{
    "template_uuid": "520a311e-988a-4d56-9acb-7132758e5114",
    "channel_uuid": "b51386d9-dc40-4fdf-82f9-fb342c82c4e9",
    "params": {
        "phone_number":"905311111111",
        "name":"John",
        "customer_uuid":"94640ead-8904-45df-9392-242f0d521682",
        "unassign_and_archive": true,
        "group":"b5cad8f4-5008-47ec-b3b8-bcd7e3014da4",
        "$1":"John Doe",
        "$2":"08/10/2019",
        "data": {
            "latitude": "41.0321733",
            "longitude": "28.9858517"
        }
    }
}

Example successful response:

HTTP/1.1 200 OK
Content-Type: application/json

{
    "account": {
        "uuid": "2fbcadf6-c91a-4d1f-9ed4-d4ef5f6d1362",
        "name": "Acme Ltd"
    },
    "channel": {
        "uuid": "9cbee132-db65-4437-8825-844ca1dcfc1e",
        "name": "Whatsapp",
    },
    "uuid": "e94f00c6-0193-49db-b93b-c8931b56ba16",
    "customer": {
        "uuid": "d46fd69a-0584-41d3-8c0a-f90a4435b27b",
        "name": "John Doe",
        "mail": "[email protected]",
        "phone_number": "+90518384443"
    },
    "type": null,
    "custom_fields": {
    },
    "data": {
        "pdf": "PDF URL"
    },
    "created_at": "2018-03-27 10:00:19.697269+00:00",
    "is_archived": false,
    "archived_at": "None",
    "archived_by": null,
    "assigned_at": "None",
    "assigned_to": null,
    "assigned_group": {
        "uuid": "d46fd69a-0584-41d3-8c0a-f90a4435b27b",
        "name": "Only US Region"
    }
}

Example failed response:

HTTP/1.1 400 Bad Request
Content-Type: application/json

{
    "error": "Missing template message parameter!",
    "info": true
}
HTTP/1.1 400 Bad Request
Content-Type: application/json

{
    "error": "Missing channel uuid parameter!",
    "info": true
}
HTTP/1.1 400 Bad Request
Content-Type: application/json

{
    "error": "Missing phone number parameter!",
    "info": true
}
HTTP/1.1 400 Bad Request
Content-Type: application/json

{
    "error": "There is no template available for this informations!",
    "info": true
}
HTTP/1.1 400 Bad Request
Content-Type: application/json

{
    "error": "This template message is not active!",
    "info": true
}
HTTP/1.1 403 Forbidden
Content-Type: application/json

{
    "detail": "Invalid Authorization header. No credentials provided."
}

Send Bulk Template Message

POST /accounts/{{account_uuid}}/jobs/

Send template message to many receivers.

Status Codes:

Example request:

POST /accounts/c4b7de0b-66bc-4505-90b9-fc196053bbfb/jobs/ HTTP/1.1
Authorization: JWT ZG9udHRyeW1lIQ==
Host: api.connexease.com
Accept: application/json

{
  "type": "1",
  "data": {
    "url": "https://cdn.allinone.connexease.com/f70159fd-8953-480b-9db6-db707eec6471.csv",
    "template_uuid": "89621dd3-484b-4213-a75d-97ef9f0ee6d",
    "channel_uuid": "b51386d9-dc40-4fdf-82f9-fb342c82c4e9",
    "params": {
      "unassign_and_archive": true,
      "group": "b5cad8f4-5008-47ec-b3b8-bcd7e3014da4",
      "data": {}
    }
  }
}

Warning

If there are many variables in your template message, you should put that in order in excel file. For example, if there are 3 variables, params should include $1, $2, $3. If template message has media, like image, put the cdn in params in data. Limitation of csv file and in progress jobs can be changed from admin panel for each account.

Example successful response:

HTTP/1.1 200 OK
Content-Type: application/json

{
    "id": 65,
    "uuid": "52433012-5b8a-412c-a94a-aec006de710b",
    "type": 1,
    "status": "NEW",
    "started_at": null,
    "finished_at": null,
    "data": {
        "url": "https://cdn.allinone.connexease.com/f70159fd-8953-480b-9db6-db707eec6471.csv",
        "template_uuid": "89621dd3-484b-4213-a75d-97ef9f0ee6d",
        "params": {
            "unassign_and_archive": false,
            "group": "b5cad8f4-5008-47ec-b3b8-bcd7e3014da4",
            "data": {}
        }
    },
    "progress": 0
}

Example failed response:

HTTP/1.1 400 Bad Request
Content-Type: application/json

{
    "error": [
        "Something wrong with the file. Please edit it and try again."
    ],
    "info": [
        "True"
    ]
}
HTTP/1.1 400 Bad Request
Content-Type: application/json

{
    "error": "Missing phone number parameter!",
    "info": true
}
HTTP/1.1 400 Bad Request
Content-Type: application/json

{
    "error": "There is no template available for this informations!",
    "info": true
}
HTTP/1.1 400 Bad Request
Content-Type: application/json

{
    "error": [
        "The CSV file must contain a maximum of 10 lines."
    ],
    "info": [
        "True"
    ]
}
HTTP/1.1 400 Bad Request
Content-Type: application/json

{
    "error": [
        "Account has 6 IN_PROGRESS background jobs.It exceeded 5."
    ],
    "info": [
        "True"
    ]
}

Example failed response:

HTTP/1.1 401 Forbidden
Content-Type: application/json

{
  "detail": "Authentication credentials were not provided."
}

Getting Status of Bulk Template Messages

GET /accounts/{{account_uuid}}/jobs/

Lists bulk template messages that are scheduled to be sent.

Status Codes:

Example request:

GET /accounts/c4b7de0b-66bc-4505-90b9-fc196053bbfb/jobs/ HTTP/1.1
Authorization: JWT ZG9udHRyeW1lIQ==
Host: api.connexease.com
Accept: application/json

Example successful response:

HTTP/1.1 200 OK
Content-Type: application/json

[
    {
        "id": 65,
        "uuid": "52433012-5b8a-412c-a94a-aec006de710b",
        "type": 1,
        "status": "IN_PROGRESS",
        "started_at": null,
        "finished_at": null,
        "data": {
            "url": "https://cdn.allinone.connexease.com/f70159fd-8953-480b-9db6-db707eec6471.csv",
            "params": {
                "data": {},
                "group": "b5cad8f4-5008-47ec-b3b8-bcd7e3014da4",
                "unassign_and_archive": false
            },
            "template_uuid": "89621dd3-484b-4213-a75d-97ef9f0ee6d"
        },
        "progress": 55
    },
    {
        "id": 57,
        "uuid": "758b1d41-7479-4112-b62b-ce967c09041f",
        "type": 1,
        "status": "FAILED",
        "started_at": "2023-01-10T13:04:12.178662",
        "finished_at": "2023-01-10T13:04:21.071890",
        "data": {
            "url": "https://cdn.allinone.connexease.com/537e381f-e427-4d0f-acbd-568337cf492c.csv",
            "params": {
                "data": {},
                "group": "b5cad8f4-5008-47ec-b3b8-bcd7e3014da4",
                "unassign_and_archive": true
            },
            "template_uuid": "89621dd3-484b-4213-a75d-97ef9f0ee7df",
            "failure_reason": "Template message not found."
        },
        "progress": 0
    },
    {
        "id": 44,
        "uuid": "f5a833ec-40f1-4b69-b0ba-584048d8bc9e",
        "type": 1,
        "status": "FINISHED",
        "started_at": null,
        "finished_at": null,
        "data": {
            "url": "https://cdn.allinone.connexease.com/f70159fd-8953-480b-9db6-db707eec6471.csv",
            "params": {
                "data": {},
                "group": "b5cad8f4-5008-47ec-b3b8-bcd7e3014da4",
                "unassign_and_archive": false
            },
            "template_uuid": "89621dd3-484b-4213-a75d-97ef9f0ee7d"
        },
        "progress": 0
    }
]

Example failed response:

HTTP/1.1 401 Forbidden
Content-Type: application/json

{
  "detail": "Authentication credentials were not provided."
}