Quick messaging channel (imchannel)

Description

Contains basic channel description settings
Used by role im when creating accounts to exchange quick messages with messengers. Sets strategies for serving separately sending a particular message and separately receiving accumulated messages and layouts across data model collections (/model/im/RemoteParties, /model/im/Messages).

Limitations

  • The collection is not available in the master domain.

  • By default, the system automatically creates a channel 'telegram'.

Fields

Entity structure
{
  "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
  }
}
Table 1. Fields
Specification Description

Field: id
Mode: inout
Type: uuid
Default: generated

Identifier. Can be specified at creation, otherwise generated by the system.

Field: code
Mode: in
Type: str
Default: required

Code. Used to associate with other entities. Represents a unique channel name, such as telegram or viber.

Field: mode
Mode: in
Type: str
Default: request

Message Receipt Mode. Options:
* request – constant long-polling messenger polling.
* webhook – informing the system by means of webhook (the algorithm is externally customizable up to placing messages in collections /model/im/RemoteParties and /model/im/Messages).
* disabled – channel is not applied in the processing by the communication layer of the platform.

Field: recv_strategy
Mode: in
Type: date | str_empty
Default: str_empty

Name of message retrieval strategy.
In case a blank is specified, the automatically generated value %CODE%recv is applied as the strategy name, where CODE is the channel code.
The erlang-module plugin
%RECV_STRATEGY% with an exportable interface is looked for as a strategy, and if it is not available, a script with the specified code is looked for.
The strategy only applies in mode = request mode to implement a long-polling request for messages received in the account.
A linked JSON entity from the collection is passed to the input /im/Accounts.
When messages are received, the strategy places them in the /im/Messages collection, while simultaneously creating or updating related entities in the collection /im/RemoteParties.
Challenges addressed by the retrieval strategy include providing protection against repetition and against failures by relying on unique message identifiers in the messenger.
If the execution of the strategy fails, it is called again a few seconds later.

Field: send_strategy
Mode: in
Type: date | str_empty
Default: str_empty

Name of the messaging strategy.
If blank is specified, the automatically generated value %CODE%send is applied as the strategy name, where CODE is the channel code.
The erlang-module plugin
%SEND_STRATEGY% with an exportable interface is looked for as a strategy, and if it is not available, a script with the specified code is looked for.
The strategy is used to send each individual message, related JSON entities from collections are passed to the input as a parameter /im/Accounts, im/RemoteParties, im/Messages.
If the execution of the strategy fails, then the message to be sent in the collection gets the status error and a description of the reason.

Field: opts
Mode: in
Type: object
Composite field

Field: opts.title
Mode: in
Type: str
Default: empty

Channel name

Field: opts.comment
Mode: in
Type: str
Default: empty

Arbitrary comment

Field: opts.after_read_timeout
Mode: in
Type: int
Default: 100

Timeout in milliseconds applied before the next execution of the fetch strategy after control is returned from the previous call.

Field: opts.max_account_mps
Mode: in
Type: int
Default: 30

Limit the number of messages sent to the account within 1 second.

Field: opts.max_remoteparty_mps
Mode: in
Type: int
Default: 1

Limit the number of messages sent to a specific subscriber within 1 second.

Field: ext
Mode: inout
Type: object
Compound field

Allows you to extend the compound with arbitrary keys and values

Field: ext.ct
Mode: out
Type: date
Default: generated

Object creation time

Field: ext.lwt
Mode: out
Type: date
Default: generated

Time of last modification of the object

See also

Logical roles

  • im manages messaging with third-party messengers.