Send message

Sends a message to the customer identified by customer_token. If the customer doesn't exist (or no token is provided), a new customer is created.

The shape of message depends on message.type. See the request examples for each supported type.

Path Parameters
  • customer_token
    Type: string
    required

    Customer token. If unknown, pass any unique value — a new customer will be created.

Body
required
application/json
  • message
    required
    • type
      Discriminator
      enum
      const:  
      text
      required
      values
      • text
    • message
      Type: string
      required

      Message body.

    • payload
      Type: string

      Optional payload string returned to your bot flow.

  • customer
    Type: object

    Optional customer fields used when creating a new customer.

Responses
  • application/json
  • application/json
Request Example for post/send/{customer_token}/
curl 'https://chat.landbot.io/v1/send/{customer_token}/' \
  --request POST \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Token YOUR_CHANNEL_TOKEN' \
  --data '{
  "customer": {
    "name": "Samuel"
  },
  "message": {
    "type": "text",
    "message": "Hello",
    "payload": "$1"
  }
}'
{
  "success": true,
  "customer": {
    "id": 42,
    "name": "Samuel",
    "phone": "34697882898",
    "email": "sam@helloumi.com",
    "postal_code": "46021",
    "country": "GB",
    "token": "SDFRL4TOMFTEWERY262NF"
  }
}