messagesIntegration with an external messenger

You can configure integration with an external messenger using webhooks. A webhook is the sending of requests on events.

Integration setup

  1. Create a channel of type "Page messenger".

In the control panel go to the section "Channelsarrow-up-right" and click the "Add channel" button located in the top right corner of the screen.

Next, in the "Add channel" window select the channel type "Page messenger" from the dropdown.

Specify any required parameters below and click "Add channel" from the dropdown.

More about creating channels in the article "Channels | Channels"arrow-up-right.

  1. Create an AI for incoming messages.

To create an AI go to the "AIarrow-up-right" and click the "Create AI" from the dropdown.

More in the article "Creating and configuring AI | AI".arrow-up-right

  1. Create an integration of type "All messages" to receive webhooks about new messages.

To create an integration of type "All messages" go to the "Integrationsarrow-up-right" and click the "Create integration" from the dropdown.

In the "Add integration" window select the integration type "Another" from the dropdown.

In the "Name" field specify a name. In the "webhook url" field specify the URL to receive webhooks. Then in the dropdown "Select webhook type" choose "All messages". Click "Create integration" from the dropdown.

More in the article "Integrations | Integration".arrow-up-right

  1. Create a task of type "Web".

To create a task of type "Web" go to the "Tasksarrow-up-right" and click the "Create task" from the dropdown.

In the "Create task" window select "Web" from the dropdown.

" in the "Type" dropdown. Next choose the service mode, the previously created channel, manager, AI, integration and click the "Create task" from the dropdown.

After creation copy the task id, it will be needed for API requests.

More in the article "Tasks | Tasks".arrow-up-right

  1. Integrate the method of sending a message from the user to the AI:

send message external

post

🇬🇧 Send external message

🇷🇺 Отправить внешнее сообщение

🇺🇿 Tashqi xabar yuborish

Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Body
task_idstringRequiredExample: 1721129985149x478019552540622850
chat_idstringRequired

unique chat_id in your system

Example: 123456789
messagestringRequiredExample: Test message via api
Responses
post
/api/1.1/wf/send_message_external
200

example

Pass to chat_id the unique identifier of the user, for example, Telegram user_id. The dialogue context will be merged by this id, and you will be able to identify webhooks.

  1. Receive the webhook after the AI generates a message and send the message into the dialog with the user.

List of parameters and description

Parameter
Parameter description

channel_id

ichannel id. Used to identify the specific channel through which communication is carried out. It can be useful for routing and processing messages on your side.

close

Dialog closed/not closed. Used to indicate the closing of the dialog or completion of communication. It signals the end of the interaction session with the user or the closing of a particular task.

company_id

company id. Used to identify the organization to which the incoming message or command belongs. Allows precise handling of data in the context of a specific company or branch within the system.

contacts

Contact. Used to transmit contact information such as phone, username, etc. Allows automatic updating and synchronization of contact data between systems.

external_chat_id

chat id. Used to identify a specific chat or dialogue in an external system or messenger. Allows linking messages and interactions to the correct external dialogue.

get_contact

Contact received/not received. Indicates that in the dialogue the user has provided a phone number, email, etc.

interest

Interest present/absent. Used to indicate the customer's interest or activation of interest in a particular product or service.

is_bot

Dialogue is with a bot yes/no. If yes, our system has determined that this dialogue is conducted with a bot.

manager_id

manager id. Used to identify the specific manager associated with the task or interaction.

message_id

message id. Used to uniquely identify a specific message. Allows tracking, processing, and referencing particular messages in the system.

message_text

Message text. Used to transmit the text of the message. It allows receiving and processing the content of the message sent by the user or the system in the required format.

message_type

Message type bot/operator/user.

operator

Dialog forwarded to an operator yes/no.

panel_url

Link to the dialog in the personal account with the ability to reply to the user.

share_url

Link to the dialog only for viewing, without the ability to reply.

success

Dialog is successful yes/no.

task_id

task id. Used for unique identification of a task in the system.

thread_id

thread id. Used to identify the dialogue with the user.

title

Title. Full name of the user.

wh_type

Webhook type. Denotes the type of webhook, events or actions. It helps distinguish which specific event occurred or what information is being transmitted via the webhook for appropriate processing.

Webhook example:

circle-info

A new parameter panel_url has appeared. It contains a link to the dialog in your personal account. Unlike share_url, where you can only view the dialog, with panel_url you can reply to the user directly. Note that authorization and company access rights will be required for access.

  1. Try replying to the user through the personal account.

Last updated