AISARAISAR
REST API

Message templates

Message templates are used to send structured, variable-driven messages outside the 24-hour free-form messaging window — primarily WhatsApp Business HSM templates that go through Meta moderation. The API covers template CRUD, submitting for approval (`submit`), archiving, and syncing approval status back from Meta. An approved template is sent to a contact via `POST /messages/send-template` (see the Messages group).

Endpoints

MethodPath
GET/v1/templates

List templates with pagination, search, and facets by status/language/channel.

GET/v1/templates/channel-types

Channel types that templates can be created for.

GET/v1/templates/{template}

Get a template by id (body, parameters, buttons).

GET/v1/templates/{template}/channels

Channels the template is available to send on.

POST/v1/templates

Create a draft template.

PATCH/v1/templates/{template}

Update a draft template.

DELETE/v1/templates/{template}

Delete a template.

POST/v1/templates/{template}/submit

Submit the template for Meta moderation (WhatsApp Business).

POST/v1/templates/{template}/publish

Publish an approved template (make it available for sending).

POST/v1/templates/{template}/archive

Archive a template.

POST/v1/templates/{template}/unarchive

Unarchive a template.

POST/v1/templates/sync

Sync moderation statuses of all company templates from Meta.

Examples

Create a template

Request

bash
curl -X POST "https://api.aisar.app/v1/templates" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "channel_type": "whatsapp_business",
    "name": "Order shipped",
    "language": "ru",
    "category": "utility",
    "body": "Здравствуйте, {{1}}! Ваш заказ №{{2}} передан в доставку.",
    "parameters": [
      { "name": "first_name", "type": "text", "sample_value": "Иван", "position": 1 },
      { "name": "order_number", "type": "text", "sample_value": "1045", "position": 2 }
    ]
  }'

Response

json
{
  "data": {
    "id": 12,
    "company_id": 1,
    "channel_type": { "id": 4, "key": "whatsapp_business", "name": "WhatsApp Business" },
    "name": "Order shipped",
    "slug": "order_shipped",
    "status": "draft",
    "language": "ru",
    "category": "utility",
    "body": "Здравствуйте, {{1}}! Ваш заказ №{{2}} передан в доставку.",
    "parameters": [
      { "id": 1, "name": "first_name", "type": "text", "sample_value": "Иван", "position": 1 },
      { "id": 2, "name": "order_number", "type": "text", "sample_value": "1045", "position": 2 }
    ],
    "buttons": [],
    "uses_count": 0,
    "created_at": "2026-02-09T18:00:00Z",
    "updated_at": "2026-02-09T18:00:00Z"
  }
}

Submit a template for moderation

Request

bash
curl -X POST "https://api.aisar.app/v1/templates/12/submit" \
  -H "Authorization: Bearer YOUR_API_TOKEN"

Response

json
{
  "data": {
    "message": "Template submitted for review.",
    "template": {
      "id": 12,
      "status": "pending"
    }
  }
}