Files
simplex-chat/bots/api/EVENTS.md
Evgeny 43aa3e7e8a nodejs: simplex-chat npm package (#5556)
* nodejs: addon

* rename

* changes

* change lib name

* package

* lib path

* simplex-chat-nodejs: fix library paths

* simplex-chat-nodejs: change addon name

* simplex-chat-nodejs: install libs, adjust package and installation

* simplex-chat-nodejs: add npmignore

* gitignore: add additional nodejs path

* simplex-chat-nodejs: fix shim name

* gitignore: ignore nodejs package lock

* simplex-chat-nodejs: rename shim to underscore

* simplex-chat-nodejs: fix library loading on Mac

* simplex-chat-nodejs: expose low-level functions, move tests

* simplex-chat-nodejs: expose shim fucntions

* simplex-chat-nodejs: fixed libs version

* simplex-chat-nodejs: switch to official repository

* simpelx-chat-nodejs: adjust release tag

* async addon, tests

* refactor, fixes

* high level chat api

* simplify cpp add-on - move logic to JS, fix API

* api for events, api test

* update @simplex-chat/types

* Revert "update @simplex-chat/types"

This reverts commit da3f89866f.

* change @simplex-chat/types version

* receiver for any events, wait with timeout

* low-level bot example

* typedoc

* network connection events

* declarative bot api

* readme, docs

* update docs

* update readme

* add liveMessage support

* allow passing welcome message as string

* @simplex-chat/webrtc-client 6.5.0-beta.3

* bot test

* concurrent connection in tests

* nodejs/download-libs: cleanup on version mismatch

* nodejs/download-libs: bump libs version

* do not handle signals in Haskell

* update bot examples

* flatten docs and use local links to code

* update readme

* 6.5.0-beta.4

* include more files in npm package, 6.5.0-beta.4.2

* .gitignore

---------

Co-authored-by: Avently <7953703+avently@users.noreply.github.com>
Co-authored-by: shum <github.shum@liber.li>
2026-01-14 21:42:21 +00:00

17 KiB

API Events

This file is generated automatically.

Contact connection events

Message events

Group events

File events

Connection progress events

Network connection events

Error events


Contact connection events

Bots must use these events to process connecting users.

Most bots enable auto-accept and don't need to accept connections via commands.

You may create bot SimpleX address manually via CLI or desktop app or from bot code with these commands:

ContactConnected

This event is sent after a user connects via bot SimpleX address (not a business address).

Record type:


ContactUpdated

Contact profile of another user is updated.

Record type:


ContactDeletedByContact

Bot user's connection with another contact is deleted (conversation is kept).

Record type:

  • type: "contactDeletedByContact"
  • user: User
  • contact: Contact

ReceivedContactRequest

Contact request received.

This event is only sent when auto-accept is disabled.

The request needs to be accepted using APIAcceptContact command

Record type:


NewMemberContactReceivedInv

Received invitation to connect directly with a group member.

This event only needs to be processed to associate contact with group, the connection will proceed automatically.

Record type:


ContactSndReady

Connecting via 1-time invitation or after accepting contact request.

After this event bot can send messages to this contact.

Record type:


Message events

Bots must use these events to process received messages.

NewChatItems

Received message(s).

Record type:


ChatItemReaction

Received message reaction.

Record type:


ChatItemsDeleted

Message was deleted by another user.

Record type:

  • type: "chatItemsDeleted"
  • user: User
  • chatItemDeletions: [ChatItemDeletion]
  • byUser: bool
  • timed: bool

ChatItemUpdated

Message was updated by another user.

Record type:


GroupChatItemsDeleted

Group messages are deleted or moderated.

Record type:


ChatItemsStatusesUpdated

Message delivery status updates.

Record type:

  • type: "chatItemsStatusesUpdated"
  • user: User
  • chatItems: [AChatItem]

Group events

Bots may use these events to manage users' groups and business address groups.

Please note: programming groups is more complex than programming direct connections

ReceivedGroupInvitation

Received group invitation.

Record type:


UserJoinedGroup

Bot user joined group. Received when connection via group link completes.

Record type:


GroupUpdated

Group profile or preferences updated.

Record type:


JoinedGroupMember

Another member joined group.

Record type:


MemberRole

Member (or bot user's) group role changed.

Record type:


DeletedMember

Another member is removed from the group.

Record type:


LeftMember

Another member left the group.

Record type:


DeletedMemberUser

Bot user was removed from the group.

Record type:


GroupDeleted

Group was deleted by the owner (not bot user).

Record type:


ConnectedToGroupMember

Connected to another group member.

Record type:


MemberAcceptedByOther

Another group owner, admin or moderator accepted member to the group after review ("knocking").

Record type:


MemberBlockedForAll

Another member blocked for all members.

Record type:


GroupMemberUpdated

Another group member profile updated.

Record type:


File events

Bots that send or receive files may process these events to track delivery status and to process completion.

Bots that need to receive or moderate files (e.g., based on name, size or extension), can use relevant commands (e.g., ReceiveFile or APIDeleteMemberChatItem) when processing NewChatItems event.

Bots that need to send files should use APISendMessages command.

RcvFileDescrReady

File is ready to be received.

This event is useful for processing sender file servers and monitoring file reception progress.

ReceiveFile command can be used before this event.

Record type:


RcvFileComplete

File reception is competed.

Record type:


SndFileCompleteXFTP

File upload is competed.

Record type:


RcvFileStart

File reception started. This event will be sent after CEvtRcvFileDescrReady event.

Record type:


RcvFileSndCancelled

File was cancelled by the sender. This event may be sent instead of CEvtRcvFileDescrReady event.

Record type:


RcvFileAccepted

This event will be sent when file is automatically accepted because of CLI option.

Record type:


RcvFileError

Error receiving file.

Record type:


RcvFileWarning

Warning when receiving file. It can happen when CLI settings do not allow to connect to file server(s).

Record type:


SndFileError

Error sending file.

Record type:


SndFileWarning

Warning when sending file.

Record type:


Connection progress events

Bots may use these events to track progress of connections for monitoring or debugging.

AcceptingContactRequest

Automatically accepting contact request via bot's SimpleX address with auto-accept enabled.

Record type:

  • type: "acceptingContactRequest"
  • user: User
  • contact: Contact

AcceptingBusinessRequest

Automatically accepting contact request via bot's business address.

Record type:

  • type: "acceptingBusinessRequest"
  • user: User
  • groupInfo: GroupInfo

ContactConnecting

Contact confirmed connection.

Sent when contact started connecting via bot's 1-time invitation link or when bot connects to another SimpleX address.

Record type:

  • type: "contactConnecting"
  • user: User
  • contact: Contact

BusinessLinkConnecting

Contact confirmed connection.

Sent when bot connects to another business address.

Record type:


JoinedGroupMemberConnecting

Group member is announced to the group and will be connecting to bot.

Record type:


SentGroupInvitation

Sent when another user joins group via bot's link.

Record type:


GroupLinkConnecting

Sent when bot joins group via another user link.

Record type:


Network connection events

HostConnected

Messaging or file server connected

Record type:

  • type: "hostConnected"
  • protocol: string
  • transportHost: string

HostDisconnected

Messaging or file server disconnected

Record type:

  • type: "hostDisconnected"
  • protocol: string
  • transportHost: string

SubscriptionStatus

Messaging subscription status changed

Record type:

  • type: "subscriptionStatus"
  • server: string
  • subscriptionStatus: SubscriptionStatus
  • connections: [string]

Error events

Bots may log these events for debugging. There will be many error events - this does NOT indicate a malfunction - e.g., they may happen because of bad network connectivity, or because messages may be delivered to deleted chats for a short period of time (they will be ignored).

MessageError

Message error.

Record type:

  • type: "messageError"
  • user: User
  • severity: string
  • errorMessage: string

ChatError

Chat error (only used in WebSockets API).

Record type:


ChatErrors

Chat errors.

Record type: