amoCRM Salesbot: messages, files and groups through AISAR
How amoCRM Salesbot sends through AISAR channels a message to the lead's client, a file from a link and a message into an existing chat or group: block fields, channel ID and chat ID, limits and error codes.
What the AISAR blocks do
The AISAR widget adds three blocks to the amoCRM Salesbot designer (the "Widgets" section). When the bot reaches a block, AISAR sends the message through the chosen channel and returns the bot to the "Sent" or "Not sent" exit.
| Block | Recipient | What it sends |
|---|---|---|
| AISAR: send a message | the lead's main contact | text or an approved WhatsApp Business template |
| AISAR: send a file | the lead's main contact | a file from a public link with a caption |
| AISAR: send to a chat | an existing chat of the channel by its ID: a group or a person | text, a file, or a file with the text as its caption |
The "send a message" and "send a file" blocks work only in bots running on leads. The "send to a chat" block works in a bot on any entity, a lead, a customer or a contact, because the recipient is set by the chat ID.
Before you start
- amoCRM is connected to AISAR: in my.aisar.app Settings → CRM and integrations → amoCRM. The "Basics" tab has the "Salesbot: AISAR blocks" card with the hints from this article.
- Salesbot is switched on for your integration. It is off by default and there is no switch in the cabinet: the AISAR team switches it on when you ask support. The "Salesbot for this integration" row of the same card shows whether it is on. Until then every block ends with
salesbot_disabled. Salesbot is not switched on for AISAR Kids companies. - The AISAR widget is installed in amoCRM: Settings → Integrations → AISAR → Install. The "send a file" and "send to a chat" blocks are in the widget from version 2.1.0.
- The leads' responsible users are mapped to AISAR employees on the "Mapping" tab. It is needed when the contact has no conversation on the chosen channel yet: AISAR then opens a dialog on behalf of the lead's responsible user (see below).
Where to find the channel ID and the chat ID
- The AISAR channel ID is needed in all three blocks. It is the number in the channel page address: open the channel in Settings → Channels, the ID is at the end of the link, for example
…/settings/channels/15. Only a connected channel of your company fits. - The chat ID is needed in the "send to a chat" block. Open the dialog with the group or person in AISAR: the dialog panel has a "Chat ID" row with a "Copy chat ID" button. A WhatsApp group ID ends with
@g.us, a Telegram group ID is a number like -100…, and a person in Telegram has their numeric id. - You can type the chat ID into the block as is, or keep it in a lead field and insert it with an amoCRM marker such as
{{lead.cf.123}}. The chat must already exist in the channel given in the block: the bot does not create new chats.
The "AISAR: send a message" block
| Field | What to enter |
|---|---|
| AISAR channel ID | the channel to send from |
| AISAR template ID | WhatsApp Business only: the ID of an approved template |
| Message text | for other channels; amoCRM markers such as {{contact.name}} work |
| Template variables | JSON, for example {"name": "{{contact.name}}"} or ["{{lead.price}}"] |
- WhatsApp Business: with a template ID the template is sent; without it the text goes only while the customer's 24-hour window is open.
- Instagram (Meta) and Messenger: text, only while the customer's 24-hour window is open.
- WhatsApp, Telegram (account or bot): text without a window restriction.
- Telephony, SMS, Live Chat, Threads and TikTok do not fit (
channel_type_unsupported).
invalid_params.Who gets the message or file of a lead
The recipient of the "send a message" and "send a file" blocks is always the main contact of the lead the bot runs on. The message goes into that contact's existing conversation on the chosen channel. The bot never writes to a contact who opted out of messages.
If there is no conversation on that channel yet, AISAR opens a dialog on behalf of the lead's responsible user, the way an operator does it in the cabinet. For that the responsible user is mapped to an AISAR employee, is a member of the company, may create dialogs and has access to the channel. The contact needs an address in that messenger; for WhatsApp and WhatsApp Business a phone on the card is enough (at least 8 digits). A hidden contact gets no new dialog. Salesbot opens at most 200 new dialogs per company per day. The dialog history shows who opened it and why: "amoCRM Salesbot, сделка #N".
The "AISAR: send a file" block
| Field | What to enter |
|---|---|
| AISAR channel ID | the channel to send from |
| File link | a public https link or a lead field marker such as {{lead.cf.123}} |
| File name | optional; AISAR sets the extension from the file's real type |
| File caption | optional, up to 1024 characters |
File rules
- Only a public https link: a price list on your website, a direct cloud link, a link from a lead field. Links to internal and private addresses are refused, at most three redirects. Files from amoCRM's own storage are not supported yet: they need the account's authorization.
- The type is judged by the file's content, not its name, and checked against what the channel accepts. HTML, SVG, scripts, executables and archives are not sent to any channel.
- WhatsApp Business, Instagram (Meta) and Messenger: a file to a person goes only while their 24-hour window is open. This is checked before anything is downloaded.
- The bot waits until the file is downloaded and sent, usually up to a minute, and only then moves on.
| Channel | File size |
|---|---|
| WhatsApp Business | images up to 5 MB (JPEG, PNG), video and audio up to 16 MB, documents up to 64 MB |
| Instagram and Messenger | images up to 8 MB (JPEG, PNG, GIF), other files up to 25 MB |
| Telegram (account or bot) | up to 50 MB |
| up to 64 MB | |
| other channels | files are not sent (channel_type_unsupported) |
The "AISAR: send to a chat" block
| Field | What to enter |
|---|---|
| AISAR channel ID | the channel the chat belongs to |
| Chat ID | from the AISAR dialog panel, or a lead field marker |
| Message text | the text; with a file, its caption (up to 1024 characters) |
| File link | optional: a public https link, same rules as above |
| File name | optional |
- A group: a group has no 24-hour window and no opt-out, so these checks do not apply. The bot does not write to a hidden or blocked group.
- A one-to-one chat: the same window and opt-out rules as for a lead's contact.
- Text, a file or both are needed. WhatsApp Business templates are not sent to chats, and WhatsApp Business has no groups.
- Messages sent into a group are visible in AISAR (and in a Bitrix24 Open Line, if connected), but not in the amoCRM lead card: amoCRM chats are bound to a contact, and groups do not get there.
Who the bot writes as
no_actor, actor_no_permission or actor_no_channel_access.The "send a message" and "send a file" blocks can also write from any connected channel of the company, but only to the main contact of the lead the bot runs on. Give the right to edit Salesbot in amoCRM only to people you are ready to trust with the company's channels and chats.
Limits
- The "send to a chat" block sends at most 20 messages per minute into one chat (
chat_rate_limited). - At most 500 messages per day into one group (
group_daily_cap). One-to-one chats have no daily limit. - At most 6 file steps per minute per amoCRM account (
file_rate_limited). Files are downloaded one at a time per integration, and there is a daily download quota (2 GB per integration per day,file_quota_exceeded). A step that waited in the queue for more than 5 minutes ends withqueue_busy. - The "send a message" block sends at most 500 WhatsApp Business templates per company per day (
daily_cap_reached), and Salesbot opens at most 200 new dialogs per company per day (daily_dialog_cap_reached). - A repeat of the same bot step does not produce a second message (
duplicate_step).
If a step went to "Not sent"
Every send and every refusal is visible in my.aisar.app on the "Activity" tab of the amoCRM page, a refusal with its error code. The code reaches the bot too: the block's second step reads {{json.status}} (success or fail), and a fail carries error_code. The codes by meaning:
| Code | What happened and what to do |
|---|---|
salesbot_disabled | Salesbot is not switched on for the integration. Contact AISAR support. |
file_disabled, chat_disabled | files or the "to a chat" block are switched off on the AISAR side for now. Try again later. |
unsupported_entity | a message or file block is in a bot that does not run on a lead. For customers and contacts only "send to a chat" fits. |
integration_unavailable | the amoCRM integration is unavailable in AISAR. Check its status on the amoCRM page. |
channel_required, channel_not_found, channel_inactive | the channel ID is missing, not found in the company, or the channel is disconnected. Check the ID and the channel status. |
channel_type_unsupported | the block does not support this channel type (see the rules above). |
window_closed | the customer's 24-hour window is closed. On WhatsApp Business send a template with the "send a message" block. |
contact_opted_out, contact_blocked, contact_hidden | the contact opted out of messages, is blocked or hidden in AISAR. |
lead_not_found, amocrm_unavailable | AISAR could not read the lead in amoCRM: it does not exist or amoCRM did not answer. In the second case try again later. |
lead_has_no_contact, contact_not_linked | the lead has no main contact, or it is not linked to an AISAR contact yet. |
no_thread, no_contact_account, invalid_phone, phone_belongs_to_other_contact, dialog_not_created | there is no conversation and it could not be opened: the contact has no address in that messenger, the phone is shorter than 8 digits, the number already belongs to another card, or the dialog was not created. |
responsible_not_mapped, responsible_not_member, responsible_no_permission, responsible_no_channel_access | the lead's responsible user is not mapped to an AISAR employee, is not a company member, may not create dialogs or has no access to the channel. Check the "Mapping" tab and the employee's rights. |
template_required, template_not_found, template_not_approved, template_params_missing, invalid_params | WhatsApp Business needs the ID of an approved template and all its variables as valid JSON. |
text_required, text_too_long | there is no text, or it is too long. |
file_url_required, file_url_invalid | there is no link, it is not https, it points to an internal address, or the amoCRM marker was not filled in. |
file_download_failed | the file did not download: the site did not answer, too many redirects, or it timed out. |
file_too_large, file_type_unsupported | the file is over the channel's limit, or the channel does not accept this type. |
file_quota_exceeded, file_rate_limited, queue_busy | a file limit was hit (see "Limits"). Try again later. |
caption_too_long | the file caption is longer than 1024 characters. |
chat_required, chat_not_found | the chat ID is missing, the channel has no such chat, or the amoCRM marker was not filled in. |
text_or_file_required | the "send to a chat" block has neither text nor a file. |
no_actor, actor_no_permission, actor_no_channel_access | the user who connected amoCRM left the company, may not create dialogs or has no access to the channel. |
chat_rate_limited, group_daily_cap, daily_cap_reached, daily_dialog_cap_reached | a limit was hit (see "Limits"). |
duplicate_step | this step already ran, no second message was sent. |
internal_error | a failure on the AISAR side. If it repeats, contact support. |