AISARAISAR

Data types: messaging

Data-type reference for the messaging domain: channels, conversations, threads, contacts, attachments and conversation events.

A reference of the JSON shapes the API returns for messaging entities. Field sets are representative; nested references such as { "...Contact" } or [{ "...Thread" }] point to other types in this reference. Placeholder values "..." denote free-form strings, and {} denotes free-form objects.

Channels

Channel

json
{
  "id": 1,
  "company_id": 1,
  "channel_type_id": 1,
  "channel_type_provider_id": 1,
  "provider_key": "whatsapp",
  "provider_version": "1.0",
  "name": "...",
  "description": "...",
  "account_name": "...",
  "timezone": "UTC",
  "notes": "...",
  "status": "connected",
  "setup_state": "draft|pairing|ready|failed",
  "status_message": "...",
  "health": {},
  "external_ids": {},
  "config": {},
  "allow_broadcasts": true,
  "allow_automations": true,
  "allow_inbound_handling": true,
  "rate_limits": {},
  "quota_limits": {},
  "status_changed_at": "2024-01-01T00:00:00Z",
  "connected_at": "2024-01-01T00:00:00Z",
  "disconnected_at": null,
  "last_seen_at": "2024-01-01T00:00:00Z",
  "last_inbound_at": null,
  "last_outbound_at": null,
  "last_error_at": null,
  "last_error_code": null,
  "reconnect_attempts": 0,
  "created_at": "2024-01-01T00:00:00Z",
  "updated_at": "2024-01-01T00:00:00Z",
  "capabilities": {},
  "limits": {},
  "channel_type": {
    "id": 1,
    "key": "whatsapp",
    "name": "WhatsApp"
  }
}

capabilities and limits are the resolved values: the base values from ChannelType plus the overrides from ChannelTypeProvider.

provider_key is the provider's public identifier; internal runtime-library names are never exposed. QR channels map to neutral values: WhatsApp (QR) → whatsapp, Telegram (personal) → telegram, Instagram (unofficial) → instagram. Other providers are returned as-is: meta, meta_instagram, meta_threads, telegram_bot, sip_telephony, live_chat_widget, twilio. To distinguish the channel type, use channel_type.key.

ChannelType

json
{
  "id": 1,
  "key": "whatsapp",
  "name": "WhatsApp",
  "description": "...",
  "category": "messaging",
  "order_id": 1,
  "badge_label": "Popular",
  "badge_variant": "primary",
  "is_published": true,
  "capabilities": {},
  "limits": {},
  "provider_config": {},
  "created_at": "2024-01-01T00:00:00Z",
  "updated_at": "2024-01-01T00:00:00Z"
}

ChannelTypeProvider

json
{
  "id": 1,
  "channel_type_id": 1,
  "provider_key": "meta",
  "provider_version": "1",
  "capabilities_override": {},
  "limits_override": {},
  "config": {},
  "created_at": "2024-01-01T00:00:00Z",
  "updated_at": "2024-01-01T00:00:00Z"
}

ChannelProviderConfig

json
{
  "flag_key": {
    "value": true,
    "label": "...",
    "description": "..."
  }
}

ChannelAccess

json
{
  "id": 1,
  "model_type": "team",
  "model_id": 10,
  "rule": "allow",
  "created_at": "2024-01-01T00:00:00Z"
}

ChannelLog

json
{
  "id": "123",
  "level": "info",
  "code": "...",
  "message": "...",
  "context": {},
  "created_at": "2024-01-01T00:00:00Z"
}

Conversations & messages

Conversation

json
{
  "id": 1,
  "company_id": 1,
  "contact_id": 10,
  "subject": "Support request",
  "lifecycle_status": "active",
  "is_closed": false,
  "is_archived": false,
  "last_message_id": 1001,
  "last_message_at": "2026-02-09T18:00:00Z",
  "last_message": { "...Message" },
  "unread_count_for_current_user": 5,
  "closed_at": null,
  "archived_at": null,
  "reopened_at": null,
  "created_at": "2026-02-09T17:00:00Z",
  "updated_at": "2026-02-09T18:00:00Z",
  "contact": { "...Contact" },
  "threads": [{ "...Thread" }]
}

lifecycle_status: active|closed.

Thread

json
{
  "id": 1,
  "conversation_id": 1,
  "company_id": 1,
  "contact_id": 10,
  "channel_id": 3,
  "contact_account_id": 44,
  "funnel_id": 5,
  "funnel_stage_id": 8,
  "lifecycle_status": "active",
  "is_closed": false,
  "is_archived": false,
  "is_group": false,
  "external_thread_id": "1203630...@g.us",
  "last_message_id": 1001,
  "last_message_at": "2026-02-09T18:00:00Z",
  "conversation_last_message_id": 1001,
  "conversation_last_message_at": "2026-02-09T18:00:00Z",
  "closed_at": null,
  "archived_at": null,
  "reopened_at": null,
  "created_at": "2026-02-09T17:00:00Z",
  "updated_at": "2026-02-09T18:00:00Z",
  "contact_account": { "...ContactAccount" },
  "funnel_stage": { "...FunnelStage" },
  "events": [{ "...ConversationEvent" }],
  "conversation": { "...Conversation" }
}

Contact

json
{
  "id": 10,
  "company_id": 1,
  "created_user_id": 7,
  "salutation": "Mr",
  "firstName": "John",
  "lastName": "Doe",
  "secondName": null,
  "displayName": "John Doe",
  "dob": null,
  "title": null,
  "photo": "https://api.aisar.app/v1/contacts/10/photo?signature={signature}",
  "comments": null,
  "company": null,
  "status": "lead",
  "merged_into_contact_id": null,
  "merged_at": null,
  "merged_by_user_id": null,
  "phones": [{ "phone": "+77000001122", "type": "mobile" }],
  "emailes": [{ "email": "john@example.com", "type": "work" }],
  "contactAccounts": [{ "...ContactAccount" }]
}

The array of email addresses uses the historical key name emailes (not emails). The photo field is a temporary signed URL: the signature parameter in the example is a placeholder.

MessageAttachment

json
{
  "id": 501,
  "type": "image",
  "url": "https://api.aisar.app/v1/messages/1001/attachments/501/media?signature={signature}",
  "thumbnail_url": null,
  "filename": "12.jpg",
  "mime_type": "image/jpeg",
  "size": 23927,
  "duration": null,
  "metadata": {}
}

url is a temporary signed download link; the signature parameter in the example is a placeholder.

ConversationEvent

json
{
  "id": 1,
  "company_id": 1,
  "conversation_id": 1,
  "thread_id": 1,
  "type": "comment",
  "author_user_id": 7,
  "comment": "Conversation closed by operator.",
  "from_lifecycle_status": "active",
  "to_lifecycle_status": "closed",
  "payload": {},
  "created_at": "2026-02-09T18:10:00Z",
  "updated_at": "2026-02-09T18:10:00Z",
  "author": { "id": 7, "name": "Jane", "lastname": "Doe", "email": "...", "photo": null }
}

type: created|comment|status_changed|archived|unarchived|assigned|unassigned.

ConversationParticipant

json
{
  "id": 1,
  "company_id": 1,
  "conversation_id": 1,
  "member_type": "user",
  "member_id": 7,
  "role": "assignee",
  "is_primary": true,
  "joined_at": "2026-02-09T18:00:00Z",
  "left_at": null,
  "added_by_user_id": 1,
  "removed_by_user_id": null,
  "created_at": "2026-02-09T18:00:00Z",
  "updated_at": "2026-02-09T18:00:00Z",
  "added_by": { "id": 1, "name": "Jane", "lastname": "Doe", "email": "..." },
  "removed_by": null
}

member_type: user|team|bot. role: the meaningful role is assignee (the responsible operator); the default is participant.

ConversationTag

json
{
  "id": 1,
  "company_id": 1,
  "conversation_id": 1,
  "name": "vip",
  "color": "#22c55e",
  "source": "manual",
  "created_by_user_id": 7,
  "created_at": "2026-02-09T18:00:00Z",
  "updated_at": "2026-02-09T18:00:00Z",
  "created_by": { "id": 7, "name": "Jane", "lastname": "Doe", "email": "..." }
}

source: manual|automation|integration.

ConversationNote

json
{
  "id": 1,
  "company_id": 1,
  "conversation_id": 1,
  "thread_id": 2,
  "author_user_id": 7,
  "body": "Closed after successful resolution.",
  "is_private": true,
  "pinned_at": null,
  "edited_at": null,
  "metadata": {},
  "created_at": "2026-02-09T18:00:00Z",
  "updated_at": "2026-02-09T18:00:00Z",
  "author": { "id": 7, "name": "Jane", "lastname": "Doe", "email": "..." }
}

ConversationRead

json
{
  "id": 501,
  "company_id": 1,
  "conversation_id": 1,
  "thread_id": 2,
  "user_id": 7,
  "last_read_message_id": 1001,
  "first_read_at": "2026-02-09T18:05:00Z",
  "last_read_at": "2026-02-09T18:10:00Z",
  "created_at": "2026-02-09T18:10:00Z",
  "updated_at": "2026-02-09T18:10:00Z",
  "user": { "id": 7, "name": "Jane", "lastname": "Doe", "email": "..." }
}