Lalexi
APIСправочникMessages

Send a message

Sends a message into the conversation as you — exactly as if you had typed it in Lalexi: on a messenger channel it goes out from the connected account, counts against the workspace's message limit, and its delivery status arrives later (message.updated). With note: true it is a private note for your team and is not sent to the contact.

Files go as multipart/form-data in attachments[]: at most 10, each within the workspace's upload limit (40 MB unless set otherwise).

Supports Idempotency-Key.

POST
/conversations/{conversation_id}/messages

Authorization

personalToken
AuthorizationBearer <token>

Your personal access token from Profile → Access Token in Lalexi. It acts with exactly your role: what you may see and do in the workspace, and nothing more. Everything done with it is recorded as done by you.

In: header

Path Parameters

conversation_id*integer

The conversation's number — the one in its Lalexi URL.

Header Parameters

Idempotency-Key?string

Your key for this request (up to 255 characters). A repeat with the same key within 24 hours returns the first answer and sends nothing new; 409 idempotency_in_progress while the first one runs; 422 idempotency_key_reused for the same key with a different request.

Lengthlength <= 255
X-Workspace-Id?integer

The workspace to work in (an id from GET /me). Optional when you belong to a single workspace; required otherwise (400 workspace_required).

Request Body

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://app.lalexi.com/v1/conversations/0/messages" \  -H "Idempotency-Key: crm-order-1042-confirmation" \  -H "X-Workspace-Id: 7" \  -H "Content-Type: application/json" \  -d '{    "text": "Your order has shipped."  }'
{
  "id": 0,
  "conversation_id": 0,
  "type": "incoming",
  "text": "string",
  "deleted": true,
  "sender": {
    "type": "agent",
    "id": 0,
    "name": "string"
  },
  "status": "sent",
  "error_code": "message_limit_reached",
  "attachments": [
    {
      "id": 0,
      "type": "image",
      "url": "string",
      "file_name": "string",
      "size": 0,
      "content_type": "image/png"
    }
  ],
  "via": "api",
  "external_id": "string",
  "created_at": "2019-08-24T14:15:22Z",
  "updated_at": "2019-08-24T14:15:22Z"
}
{
  "error": {
    "code": "workspace_required",
    "message": "You belong to several workspaces: pass the X-Workspace-Id header."
  }
}
{
  "error": {
    "code": "invalid_api_key",
    "message": "The API key is missing or invalid."
  }
}
{
  "error": {
    "code": "forbidden",
    "message": "You are not allowed to do this."
  }
}
{
  "error": {
    "code": "not_found",
    "message": "Resource not found."
  }
}
{
  "error": {
    "code": "idempotency_in_progress",
    "message": "A request with this Idempotency-Key is still running."
  }
}
{
  "error": {
    "code": "attachment_invalid",
    "message": "Attachment invalid",
    "details": {
      "attachments": [
        "each at most 40 MB"
      ]
    }
  }
}
{
  "error": {
    "code": "rate_limited",
    "message": "Too many requests. Retry after the number of seconds in Retry-After."
  }
}
{
  "error": {
    "code": "internal_error",
    "message": "Something went wrong on our side."
  }
}