Lalexi
APIReferenceBroadcasts

Create a broadcast

A draft: nothing goes out until POST /broadcasts/{id}/schedule. Each item goes out from its channel_id, one by one with delay_seconds between them. Items that cannot be sent (a number you do not work in or that cannot write first, a bad phone, a missing text) are left out and listed in errors by their index; the rest make the broadcast. When none is left, nothing is created (422 invalid_items). Counts against the limit of 10 pieces of queued messenger work a minute per key (history imports, chat filters, broadcasts, rephrasing).

POST
/broadcasts

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

Header Parameters

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

application/json

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/broadcasts" \  -H "X-Workspace-Id: 7" \  -H "Content-Type: application/json" \  -d '{    "name": "string",    "items": [      {        "channel_id": 0,        "text": "string"      }    ]  }'
{
  "broadcast": {
    "id": 0,
    "name": "string",
    "status": "draft",
    "items_total": 0,
    "items_by_status": {
      "property1": 0,
      "property2": 0
    },
    "created_at": "2019-08-24T14:15:22Z",
    "scheduled_at": "2019-08-24T14:15:22Z",
    "completed_at": "2019-08-24T14:15:22Z"
  },
  "errors": [
    {
      "index": 0,
      "message": "string"
    }
  ]
}
{
  "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": "validation_failed",
    "message": "The request is invalid.",
    "details": {
      "email": [
        "is invalid"
      ]
    }
  }
}
{
  "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."
  }
}
{
  "error": {
    "code": "upstream_unavailable",
    "message": "The messaging service is unavailable. Nothing was sent; try again."
  }
}