AISARAISAR
REST API

Integrations (webhooks)

Configuration of AISAR outbound webhooks: a `webhook`-type integration subscribes to a set of platform events (see the webhook events reference) and POSTs a signed body to the given URL whenever they fire. Bearer/basic auth on the receiving end, retry with a bounded attempt count, and channel filtering are all supported. Bitrix24 and amoCRM connect through their own OAuth flows in the my.aisar.app dashboard and are not covered by this reference.

Endpoints

MethodPath
GET/v1/integrations

List integrations (filterable by type, status)

POST/v1/integrations

Create a webhook integration

GET/v1/integrations/{integration}

Get an integration (with credential and mappings)

PATCH/v1/integrations/{integration}

Update an integration

DELETE/v1/integrations/{integration}

Delete an integration

GET/v1/integrations/{integration}/logs

Webhook delivery logs

POST/v1/integrations/test-webhook

Send a one-off test delivery to a given URL (no integration saved)

Examples

Create a webhook integration

Request

bash
curl -X POST https://api.aisar.app/v1/integrations \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "webhook",
    "name": "n8n Production",
    "status": "active",
    "settings": {
      "url": "https://example.com/webhook",
      "authType": "bearer",
      "selectedEventKeys": ["message.created", "conversation.created"],
      "channelFilter": "all",
      "timeoutSeconds": 30,
      "retryEnabled": true,
      "maxAttempts": 6
    },
    "secrets": { "bearerToken": "your-receiving-endpoint-secret" }
  }'

Response

json
{
  "data": {
    "id": 14,
    "type": "webhook",
    "name": "n8n Production",
    "status": "active",
    "health": {
      "last_success_at": null,
      "last_failure_at": null,
      "last_error": null,
      "consecutive_failures": 0
    },
    "settings": {
      "url": "https://example.com/webhook",
      "authType": "bearer",
      "selectedEventKeys": ["message.created", "conversation.created"],
      "channelFilter": "all",
      "timeoutSeconds": 30,
      "retryEnabled": true,
      "maxAttempts": 6
    },
    "credential": {
      "secrets": { "bearerToken": "your-receiving-endpoint-secret" },
      "expires_at": null,
      "last_refreshed_at": null,
      "rotated_at": null,
      "created_at": "2026-03-15T10:00:00.000000Z",
      "updated_at": "2026-03-15T10:00:00.000000Z"
    },
    "external_entities": [],
    "mappings": [],
    "funnel_mappings": [],
    "created_at": "2026-03-15T10:00:00.000000Z",
    "updated_at": "2026-03-15T10:00:00.000000Z"
  }
}

Webhook delivery logs

Request

bash
curl "https://api.aisar.app/v1/integrations/14/logs?limit=50" \
  -H "Authorization: Bearer YOUR_API_TOKEN"

Response

json
{
  "data": [
    {
      "id": 8801,
      "level": "info",
      "code": "webhook.delivery",
      "message": "Webhook delivered.",
      "context": {
        "event_key": "message.created",
        "status": "success",
        "status_code": 200,
        "duration_ms": 420
      },
      "created_at": "2026-03-15T10:05:00.000000Z"
    }
  ]
}