Instant messaging channel (imchannel)
Description
Contains the basic channel description settings.
Used by the im role when creating accounts for instant messaging with messengers. Sets strategies for servicing message sending separately and for receiving accumulated messages and distributing them across data model collections (/model/im/RemoteParties, /model/im/Messages).
Channels 'telegram', 'whatsapp', 'vk' are created and updated automatically from fixture, and are linked by codes to automatic message and event sending and receiving strategies.
Limitations
-
The collection is available in any domain, including the master domain.
-
By default, the system automatically creates the 'telegram' channel.
Fields
{
"id": uuid,
"code": str,
"mode": str,
"recv_strategy": str,
"send_strategy": str,
"opts": {
"title": str,
"comment": str,
"after_read_timeout": int,
"max_account_mps": int,
"max_remoteparty_mps": int
},
"ext": {
"ct": date,
"lwt": date
}
}
| Specification | Description |
|---|---|
Field: |
Identifier. Can be specified at creation, otherwise generated by the system. |
Code. Used to associate with other entities. Represents the unique channel name, for example This code is referenced by IM accounts. Codes 'telegram', 'whatsapp', 'vk', 'max' define built-in strategies for processing incoming and sending outgoing messages and events. |
|
Message receiving mode. Variants: Webhook mode assumes external access to the server from the messenger’s public servers. |
|
Name of the message receiving strategy. |
|
Name of the message sending strategy. |
|
Field: |
|
Field: |
Channel name |
Field: |
Arbitrary comment |
Timeout in milliseconds applied before the next execution of the receive strategy after control returns from the previous call. |
|
Limit on the number of messages sent to the account within 1 second. |
|
Limit on the number of messages sent to a specific subscriber within 1 second. |
|
Limit on the text size allowed for one message sent to the messenger channel. When attempting to send a larger message, it is softly split into parts, preferably at double or single line breaks or spaces. |
|
List of emoji reactions allowed in the channel. |
|
Field: |
Allows extending the compound with arbitrary keys and values |
Field: |
Object creation time |
Field: |
Time of last modification of the object |
Field: |
Version of the automatically created fixture. Used for updating from fixture. |
Built-in and custom strategies
'telegram', 'whatsapp', 'vk', 'max' accounts are serviced by built-in strategies.
If necessary, custom strategies can be implemented on service scripts specified in the IM channel. Scripts are separate for receiving and sending messages. Channel codes must differ from the standard names of built-in strategies.
The receive script is used for long-polling requests; when messages are delivered by webhooks, processing should be implemented in the scripts of the corresponding integration channel.
The built-in 'telegram' strategy supports:
-
Creating records in the subscriber collection when messages arrive from them.
-
Creating records in the message collection when messages arrive.
-
Receiving text messages, images, audio, video, documents, stickers, locations, contacts, links, and interactive keyboard selections. Including messages consisting of a file and text.
-
Receiving events about text modification of previously sent messages.
-
Receiving replies to previous messages (with links to them).
-
Receiving 'sent', 'delivered', 'read' statuses.
-
Determining the forwarding marking of forwarded messages (flag and original author information).
-
Sending text messages, images, audio, video, documents, stickers, locations, contacts, and interactive keyboards. Including messages consisting of a file and text.
-
Sending emoji reactions to messages.
-
Receiving messages in long-polling mode (does not require the web server port to be accessible from outside).
-
Sending up to 30 messages per second, at 1 message per second per subscriber.
-
Sending messages in silent mode.
-
Sending formatted text.
-
Splitting long text into several messages according to messenger limits (4096 Unicode characters).
The built-in 'whatsapp' (whatsapp_business) strategy supports:
-
Processing the channel confirmation request (registered webhook URI).
-
Creating records in the subscriber collection when messages arrive from them.
-
Creating records in the message collection when messages arrive.
-
Modifying target URIs to the HTTP proxy server URI.
-
Receiving text messages, images, audio, video, documents, stickers, locations, contacts, and interactive keyboard selections. Including messages consisting of a file and text.
-
Receiving replies to previous messages (with links to them).
-
Receiving the read status.
-
Determining the forwarding marking of forwarded messages (flag).
-
Sending text messages, images, audio, video, documents, stickers, locations, contacts, and interactive keyboards. Including messages consisting of a file and text.
-
Sending emoji reactions to messages.
-
Sending the 'read' status.
-
Receiving messages in webhook mode (requires the web server port to be accessible from outside).
-
Splitting long text into several messages according to messenger limits (4096 Unicode characters).
The built-in 'vk' strategy supports working in a community chat:
-
Processing the channel confirmation request (registered webhook URI).
-
Creating records in the subscriber collection when messages arrive from them.
-
Creating records in the message collection when messages arrive.
-
Receiving text messages, photos, documents, stickers, locations. Including messages consisting of a file and text.
-
Splitting messages containing several files.
-
Receiving reactions to messages (converting identifiers to emoji characters).
-
Receiving replies to previous messages (with links to them).
-
Receiving the read status.
-
Sending text messages, images, documents, stickers, locations. Including messages consisting of a file and text.
-
Sending emoji reactions to messages (converting emoji characters to identifiers).
-
Sending the 'read' status.
-
Receiving messages in webhook mode (requires the web server port to be accessible from outside).
-
Splitting long text into several messages according to messenger limits (4096 Unicode characters).
The built-in 'max' strategy supports:
-
Creating records in the subscriber collection when messages arrive from them.
-
Creating records in the message collection when messages arrive.
-
Receiving text messages, images, audio, video, documents, stickers, locations, contacts. Including messages consisting of a file and text.
-
Receiving events about text modification of previously sent messages.
-
Receiving replies to previous messages (with links to them).
-
Determining the forwarding marking of forwarded messages (flag and original author information).
-
Sending text messages, images, audio, video, documents, stickers, locations, contacts, and interactive keyboards. Including messages consisting of a file and text.
-
Receiving messages both in long-polling mode (does not require the web server port to be accessible from outside) and in webhook mode (requires the web server port to be accessible from outside).
-
Sending messages in silent mode.
-
Sending formatted text.
-
Sending up to 30 messages per second, at 1 message per second per subscriber.
-
Splitting long text into several messages according to messenger limits (4000 Unicode characters).
See also
Logical roles
-
im manages message exchange with third-party messengers.