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:

JSON
{
  "type": "webhook_type", // one of webhook types
  "timestamp": "2024-10-02T09:50:53.124072075Z",
  "data": {
    // status update from meta
  }
}

The data part contains Status object from meta system.

Webhook types:

message.status

Message status allows you to receive the statuses of sent messages. Please make sure that you store the message ID on your side.

Examples:

Message sent

JSON
{

  "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

JSON
{
  "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

JSON
{
  "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)

JSON
{
  "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"
  }
}

message.nfm_reply

NFM Reply allows responses to the WhatsApp Flows feature to be received on your end. Learn more about https://business.whatsapp.com/products/whatsapp-flows

Examples:

Response received

Please note that response_json contains a JSON response serialized as a string.

JSON
{
  "type": "message.nfm_reply",
  "timestamp": "2025-05-07T08:58:48.81251522Z",
  "data": {
    "id": "wamid.HBgLNDg2MDk2NTU5MTEVAgASGBQzQTQzNkI3MzZFNjNGRkIwQzAxRgA=",
    "from": "48123456789",
    "recipient_type": "",
    "timestamp": "1746608324",
    "type": "interactive",
    "interactive": {
      "type": "nfm_reply",
      "nfm_reply": {
        "response_json": "{\"flow_token\":\"unused\",\"screen_0_firstName_0\":\"John\",\"screen_0_Dropdown_4\":\"0_Male\",\"screen_0_lastName_1\":\"Doe\",\"screen_3_CheckboxGroup_0\":[\"0_Email\"],\"screen_2_TextArea_0\":\"Something\",\"screen_1_RadioButtonsGroup_1\":\"0_Yes\",\"screen_1_OptIn_0\":true}",
        "body": "Sent",
        "name": "flow"
      }
    },
    "context": {
      "ID": "wamid.HBgLNDg2MDk2NTU5MTEVAgARGBIxQkFDMzEyRjVDRDE4MTVCOTUA",
      "from": "15123456789",
      "forwarded": false
    }
  }
}

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.