1MSG
ReferenceInbox API

Поиск диалогов

GET
/api/v1/inbox/conversations/search

Ищет по имени контакта, телефону и тексту сообщений в одном канале. channelId обязателен. query — не короче 3 символов; на более короткий запрос вернутся два пустых списка.

Authorization

bearer
headerAuthorizationBearer <token>

Ключ выдаётся в Settings → Developer → API key. Методам Inbox нужен доступ Inbox, методам Campaigns — доступ Campaigns.

Query Parameters

query*string

Не меньше 3 символов.

channelId?string

Канал, в котором искать. Обязательно.

Response Body

application/json
  1. response
contacts*array<>

Диалоги, найденные по имени или телефону контакта.

messages*array<>

Диалоги, найденные по тексту сообщений. Диалог, который уже есть в contacts, здесь не повторяется.

curl -X GET 'https://api.1msg.io/api/v1/inbox/conversations/search?query=7900'
{  "contacts": [    {      "id": "string",      "channelId": "string",      "contactId": "string",      "status": "OPEN",      "assignedTo": "string",      "assignedUser": {        "id": "b2bb82f0-2253-4e05-b955-a21f3d699caa",        "name": "QA Stage",        "avatar": null      },      "lastMessageAt": "2019-08-24T14:15:22Z",      "isUnread": true,      "tags": [        "string"      ],      "lastMessagePreview": "string",      "lastMessageType": "string",      "lastMessageDirection": "INBOUND",      "lastMessageStatus": "string",      "unreadCount": 0,      "isBlocked": true,      "title": "string",      "lastCustomerMessageAt": "2019-08-24T14:15:22Z",      "createdAt": "2019-08-24T14:15:22Z",      "updatedAt": "2019-08-24T14:15:22Z",      "contact": {        "id": "string",        "phoneNumber": "79001234567",        "name": "string",        "avatar": "string"      },      "channelType": "WABA",      "customerPhone": "string"    }  ],  "messages": [    {      "id": "string",      "channelId": "string",      "contactId": "string",      "status": "OPEN",      "assignedTo": "string",      "assignedUser": {        "id": "b2bb82f0-2253-4e05-b955-a21f3d699caa",        "name": "QA Stage",        "avatar": null      },      "lastMessageAt": "2019-08-24T14:15:22Z",      "isUnread": true,      "tags": [        "string"      ],      "lastMessagePreview": "string",      "lastMessageType": "string",      "lastMessageDirection": "INBOUND",      "lastMessageStatus": "string",      "unreadCount": 0,      "isBlocked": true,      "title": "string",      "lastCustomerMessageAt": "2019-08-24T14:15:22Z",      "createdAt": "2019-08-24T14:15:22Z",      "updatedAt": "2019-08-24T14:15:22Z",      "contact": {        "id": "string",        "phoneNumber": "79001234567",        "name": "string",        "avatar": "string"      },      "channelType": "WABA",      "customerPhone": "string"    }  ]}