Omnichannel platforms

icon picker
Webim (External Bot API 2.0)

is one of the popular omnichannel platforms for communicating with customers in text channels. You can use it as a channel to publish your business as a bot operator. This article discusses connecting bots via an asynchronous API - Webim External Bot API 2.0
Webim can be used as a subscription service on the cloud, or be hosted on the client’s private servers as a boxed solution. The Webim account address is used to set up a connection and as a bot operator — see .
When using Webim as a cloud subscription service, the Webim account address looks like <some-name>.webim.ru, where <some-name> is the name of the subdomain that you set in the Webim account settings.
When hosting Webim on the client's private servers, the account address is set by the client and depends on the hosting domain.

Connection

1. Bot configuration on Webim side

First of all, you need to configure it on the Webim side.
Log in to Webim as an administrator.
Go to Settings → Bots.
Start creating a new bot and fill out the following fields:
Operator for the bot — select the operator to which the bot will be attached; it is recommended to create separate operators for bots.
Bot type — select Smart bot.
Sorting order — the order determines where in the list of bots this bot will be located. The lower the number, the higher the priority.
Status — select the bot status.
Version — select version 1.
Link to external API — enter the webhook address, it can be obtained when setting up the
@Project Channel
— see paragraph .
Снимок экрана 2021-05-11 в 15.34.33.png
Set the link to the webhook received when in the Link to external API field, save the data and receive an authorization token. Use the token to complete the agent channel configuration.
image.png
This completes the
@Bot
configuration in Webim.

2. Agent channel configuration in the Platform

You need to create and configure an
@Project Channel
with the “Webim (External Bot API 2.0)” connector.
Click on the agent settings button. ​
image.png
Click the Add channel button. ​
image.png
The
@End Channel
selection panel will open. ​
image.png
Select
@Webim (External Bot API 2.0)
.
The
@Project Channel
creation panel will open. ​
image.png
Optionally, enter a title for this
@Project Channel
in the Name field with the placeholder New channel. ​
image.png
Enter the address for your account in the Webim (External Bot API 2.0) webhook URL field as https://<some-name>.webim.ru/api/bot/v2 where <some-name> is the subdomain you set in the Webim account settings. ​
image.png
Set the token obtained in the Webim bot settings in the Webim (External Bot API 2.0) token field. ​
image.png
Copy the webhook link from the Chatbot webhook URL field and paste it into the External API Link field in the bot settings in Webim. ​
image.png
To save the
@Project Channel
without activating it, click the CREATE button. ​
image.png
To save and activate the
@Project Channel
, click the CREATE & ACTIVATE button. ​
image.png
The
@Project Channel
will be saved and activated if:
The
@Agent
is trained;
The token in the Webim (External Bot API 2.0) token field is unique (there are no active channels of the same type with the same token);
The channel address is accessible;
The channel webhook is registered succesfully.
The
@Project Channel
will be saved but not activated if one or more conditions are not met.
To cancel
@Project Channel
creation, click the CANCEL button. ​
image.png

Editing and Deleting Agent Channel

To edit an
@Project Channel
, click on its icon on the
@Agent
card. ​
image.png
To edit any field, click the field and enter a new value.
To apply changes to an activated
@Project Channel
, click the APPLY button. ​
image.png
Changes will be applied if:
The
@Agent
is trained;
The token in the Webim (External Bot API 2.0) token field is unique (there are no active channels of the same type with the same token);
The channel address is accessible;
The channel webhook is registered succesfully.
Changes will not be applied if one or more conditions are not met.
To deactivate the
@Project Channel
, click the DEACTIVATE button. ​
image.png
To apply changes to a non-activated
@Project Channel
, click the SAVE button. ​
image.png
To apply changes and activate the
@Project Channel
, click the SAVE & ACTIVATE button. ​
image.png
Changes will be applied and the
@Project Channel
will be activated if:
The
@Agent
is trained;
The token in the Webim (External Bot API 2.0) token field is unique (there are no active channels of the same type with the same token);
The channel address is accessible;
The channel webhook can be registered.
Changes will be applied but the
@Project Channel
will not be activated if one or more conditions are not met.
To cancel making changes, click the CANCEL button. ​
image.png
To delete the
@Project Channel
, click the DELETE button. ​
image.png

Communication

Interaction with this
@End Channel
occurs using a synchronous method, using
Since the
@End Channel
is synchronous,
@Conversation
occurs according to the scheme Request from Webim - Response from the Agent, this imposes some restrictions and features on
@Conversation
:
To transfer to an operator using
@Change Chat Mode
, this
@Slot
must be after the
@Wait For Reaction
@Slot
: in response to a Response with a message from the
@Bot User
, a Response will be sent with a control command to transfer the
@Dialog
to the operator
The
@Agent
can only respond to messages, but cannot be the first to send messages to the
@Chat
of this
@End Channel
through the
@Timer
@Slot
or
@Incoming Request Slot
, since in this case there will be no Request from Webim to which a Response can be given.
Important: when
@Timer
or
@Incoming Request Slot
is triggered, the
@Agent
will start the corresponding
@Script Branch
and follow the
@Script
, stopping at the
@Input Waiting Slot
, while messages sent before this
@Slot
will not actually be delivered to the
@Agent
.

Switching to an operator if there is no response from the Agent

If any error occurs in an API request (the response differs from the expected one or the request was closed after a timeout of 5 seconds), the chat is automatically transferred to the general queue of operators.
Mapping of Channel variables from Webim 2
18
Channel variable
End channel
Variable in the body of an incoming request from a channel
Peculiarities
1
channel_conversation_id
Webim (External Bot API 1.0)
chat.id
2
channel_visitor_id
Webim (External Bot API 1.0)
visitor.id
3
channel_visitor_firstname
Webim (External Bot API 1.0)
visitor.firstname
4
channel_visitor_lastname
Webim (External Bot API 1.0)
visitor.lastname
5
channel_visitor_account
Webim (External Bot API 1.0)
visitor.username
6
channel_visitor_phone
Webim (External Bot API 1.0)
visitor.phone
7
channel_visitor_email
Webim (External Bot API 1.0)
visitor.email
8
channel_visitor_location
Webim (External Bot API 1.0)
visitor.location
9
channel_reply_to
Webim (External Bot API 1.0)
no
No results from filter
Communication in Webim 2
20
Functionality
Channel
Availability
Description
1
Transferring files as files from the Agent
Webim (External Bot API 1.0)
Yes
2
channel_chat_id
Webim (External Bot API 1.0)
Yes
format <webim chat_id>|webim
3
Messages will reach the Bot User if the Agent writes first in an existing chat
Webim (External Bot API 1.0)
No
Messages will not reach the
@Bot User
in this case. Only
@Agent
messages sent in response to his actions or to service messages, if enabled, will reach the
@Bot User
4
Transfer to operator
Webim (External Bot API 1.0)
Yes
Using the slot
@Change Chat Mode
Important: before
@Change Chat Mode
there must be
@Wait For Reaction
Transfer to the operator will also occur if webim does not receive a response from the
@Agent
within 5 seconds
5
Buttons
Webim (External Bot API 1.0)
Yes
6
Transferring files as links from the Agent
Webim (External Bot API 1.0)
Yes
7
Transferring files as files from the Agent
Webim (External Bot API 1.0)
No
The
@Attachment
slot will pass a text link
8
Receiving a file from the Bot User into a script
Webim (External Bot API 1.0)
No
9
Receiving geolocation from an Bot User in a Script
Webim (External Bot API 1.0)
Yes
A link like this will be sent to
@client_message
:
10
Delivery of messages over 1000 characters from Agent to Bot User
Webim (External Bot API 1.0)
Yes
11
Markdown usage
Webim (External Bot API 1.0)
No
12
Mailing with Notification
Webim (External Bot API 1.0)
No
No results from filter

Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.