Skip to main content
Skip table of contents

Developer Integrations

Sending Message Templates via the API

First, you need to authorize using a LiveChat token. The most straightforward path is to use Personal Access Tokens (PAT):

  1. Go to Developer Console.

  2. Click Tools > Personal Access Tokens > Create new token.

  3. Selectchats--access:rwscope and click Create token.

  4. Store Base64 Encoded Token for authorization.

Now, you can make authorized calls to the API.
Base API URL: https://lwb-api.livechat-integrations.com

Send Message Template

Once you create the PAT token in the console, please store the Base64 encoded version and add it to the Authorization header.
Required headers:

  • Authorization: Basic {token}

  • Content-Type: application/json

API Call:

  • POST /whatsapp-numbers/{id}/template-messages

To receive the number id, you need to email contact@livechat-integrations.com. This will be available in the API at a later date.

Body:

Params

Type

Required

to

string

yes

Customer number with country code, without “+” symbol.

template

Template object

yes

Template Object

schedule

RFC3339 datetime

no

The time when the message will be sent in the future. Defaults to current time. The format is RFC3339.

Example: "2006-01-02T15:04:05Z07:00"

Fetch template messages

Required headers:

Authorization: Basic {token}

API Call:

GET /whatsapp-numbers/{id}/template-messages

To receive the number id, you need to email contact@livechat-integrations.com. This will be available in the API at a later date.

Receiving Status webhooks

Defining webhooks

Registration of the webhooks is a semi-manual process. All you need to do is provide us with the webhook URL. In response, you will receive a webhook secret that will be used later for verification purposes.

To register a webhook, please contact us at contact@livechat-integrations.com

The webhooks are implemented according to the Standard Webhooks Specification.

Webhooks specs

Headers

webhook-id

the unique webhook identifier 

webhook-signature

the signature of this webhook

webhook-timestamp

integer unix timestamp (seconds since epoch)

Body

The webhook body has following structure:

CODE
{

  "type": "message.status",

  "timestamp": "2024-10-02T09:50:53.124072075Z",

  "data": {

    // status update from meta

  }

}

The data part contains Status object from meta system.

Examples:

Message sent

CODE
{

  "type": "message.status",

  "timestamp": "2024-10-02T09:50:37.917941416Z",

  "data": {

    "id": "wamid.HBgLNDg2MDk2NTU5MTEVAgARGBJGOERCNzY1MTdBQUE4REM3RUMA",

    "status": "sent",

    "timestamp": 1727862637,

    "conversation": {

      "id": "8eaad41770498bb225fa838b44c2531b",

      "origin": {

        "type": "marketing"

      },

      "expiration_timestamp": 1727949060

    },

    "pricing": {

      "billable": true,

      "pricing_model": "CBP",

      "category": "marketing"

    },

    "recipient_id": "48635625362"

  }

}

Message delivered

CODE
{

  "type": "message.status",

  "timestamp": "2024-10-02T09:50:38.917102501Z",

  "data": {

    "id": "wamid.HBgLNDg2MDk2NTU5MTEVAgARGBJGOERCNzY1MTdBQUE4REM3RUMA",

    "status": "delivered",

    "timestamp": 1727862637,

    "conversation": {

      "id": "8eaad41770498bb225fa838b44c2531b",

      "origin": {

        "type": "marketing"

      }

    },

    "pricing": {

      "billable": true,

      "pricing_model": "CBP",

      "category": "marketing"

    },

    "recipient_id": "48635625362"

  }

}

Message read

CODE
{

  "type": "message.status",

  "timestamp": "2024-10-02T09:50:53.124072075Z",

  "data": {

    "id": "wamid.HBgLNDg2MDk2NTU5MTEVAgARGBJGOERCNzY1MTdBQUE4REM3RUMA",

    "status": "read",

    "timestamp": 1727862652,

    "recipient_id": "48635625362"

  }

}

Message failed (wrong number)

CODE
{

  "type": "message.status",

  "timestamp": "2024-10-02T10:13:41.724930177Z",

  "data": {

    "id": "wamid.HBgMNDg2MDk2NTU5MTExFQIAERgSMTQ4MUY0NkZBQzQwQzYxMDNBAA==",

    "status": "failed",

    "timestamp": 1727864020,

    "errors": [

      {

        "code": 131026,

        "title": "Message undeliverable",

        "message": "Message undeliverable",

        "error_data": {

          "details": "Message Undeliverable."

        }

      }

    ],

    "recipient_id": "48635625362"

  }

}

Signature verification

You can use code samples from standard-webhooks for signature verification.

More information here: Verifying webhook authenticity.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.