🔗Types of webhooks and integrations with services

A webhook is the sending of requests based on events. Requests notify external services about changes and events—information is sent to the specified URL. Webhooks are used for integration.

Selarti offers two types of integration with different webhooks.

Integration with services through the «AI» section

The first type of integration is configured in the section «AI» when creating and editing artificial intelligence in the block «Professional settings».

In the block «Professional settings» in the dropdown menu «AI functions» select «custom api».

The «custom api» function allows you to connect any external services and integrations. This function is called by the AI itself, which then processes requests and transmits data from the dialogue to an external server. At the same time, the AI can not only send but also receive the necessary information from the external server.

Webhooks are sent for various events with any specified parameters. Set rules for the AI on what to collect from the dialogue—address, phone number, other necessary data. For example, the AI collects contacts, name, order details, processes the data, and transmits it to a CRM or another external service. Then it receives a response, for example, confirmation and additional data from external services. After that, it collects, processes, and transmits this information as a response to the user.

With this type of integration, webhooks can be sent and received more than once. During a single dialogue, there can be a hundred events, each of which will send a notification to the required services. For one incoming message, Selarti can trigger up to 100 different integrations.

More details on the setup in the instructions «Custom API Setup».

Integration with services through the «Integration» section

The second type of integration is configured through the section «Integration». In the section, select event notifications by tags and by messages, upon which webhooks will be sent to the external server.

Types of webhooks:

  • Successful dialog. It is triggered when the AI determines the dialog as successful based on the prompt of the function. Allows you to sort dialogues by the quality of interaction.

  • Contacts received. Based on the prompt of the function, the AI determines that contact information (phone number, username, etc. — depends on the description in the prompt) has been transmitted in the dialog. Allows you to start a new dialogue on received contacts or update customer information in CRM.

  • There is interest. The AI determines based on the prompta function that the user has shown interest in the dialogue.

  • Handled by operator. It is sent at the moment when the AI determines the need for human intervention by prompting the function and the chat must be transferred from the bot to the operator.

  • Messages for the operator. After sending the chat to the operator, all subsequent messages end up in this webhook.

  • All messages. A webhook for getting information about all messages (from the client, bot, or operator) in the system.

  • Contact not found. It is triggered when the user cannot be found in the outgoing channel using the specified contact. It works in all outgoing tasks. Adds the ability to build flexible routing scenarios for contacts between jobs. For example: if a contact is not found in WhatsApp, you can automatically transfer it to Telegram using the add_target API method.

  • Contact established. It is sent when it is possible to find the user by the specified contact and successfully send the first message to them. Allows you to run the following actions after confirming the client's availability in the channel. It works for both outgoing and incoming communication.

Such webhooks contain ready-made and standard system parameters. You cannot add additional custom fields to the webhook.

One of the wh_type parameters is used to identify the type of webhook, event, or action that triggered the request. It allows the webhook receiver to distinguish between events and correctly process their logic.

The wh_type parameter contains different values depending on the webhook type selected in the «Integrations» section.

chevron-rightPossible values of the wh_type parameterhashtag
  • test — a test webhook sent from the personal dashboard when checking the integration;

  • success — the «success» tag has changed from «no» to «yes», triggered once per dialogue (thread);

  • get_contact — the «get_contact» tag has changed from «no» to «yes», triggered once per thread;

  • interest — the «interest» tag has changed from «no» to «yes», triggered once per thread;

  • operator — the «operator» tag has changed from «no» to «yes» (no trigger limits);

  • message_for_operator — a message from the user intended for an operator;

  • all_messages — all messages across all threads of the task (bot/user/operator);

  • contact_not_found — the system failed to find the user in the messenger and establish a dialogue;

  • contact_initiated — the system successfully found the user in the messenger and established a dialogue.

The webhooks «Successful dialogue», «Contacts received», «There is interest», «Handled by operator» work based on the function prompt, which specifies the trigger conditions. The webhooks use standard function descriptions.

When configuring webhooks through the Integration section, they arrive once per event. For example, if a conversation is successful, a webhook is sent, and if a contact is received, a webhook is sent. That is, one webhook is sent to each of the events.

More details on creating an integration in the article «Integration».

Last updated