Events
Nodes in the Events section are scenario entry points. They do not expect an incoming connection: execution is started by MyCodeBot, a messenger callback, a custom trigger, or an AI agent.
There are six event types: OnMemberFollow, OnError, OnTrigger, OnChatClosed, OnAgentTriggered, and OnMemberUnfollow.
1. Error
Error (OnError) starts a separate error-handling branch.
Use it when scenario errors need a dedicated flow, for example to show a fallback message or perform other error-specific handling.
Connections
- Inputs: none — this is an entry point.
- Output: one
NextActionto the first node of the error flow. - If the handler is empty, no separate error flow is started.
Important details
In the current host code, OnError starts NextAction directly without executing the EventNode itself. Therefore, #node.{id}.event_triggered is not created for this event.
2. Trigger
Trigger (OnTrigger) starts a scenario from a custom action or parameter.
Connections
- Inputs: none — this is an entry point.
- Output: one
NextAction. - Custom
OnTriggeruses a dedicated endpoint for creation/configuration.
Result
Normal event execution creates:
#node.{id}.event_triggered
#node.{id}.trigger_param
If trigger_param is not provided, its value is:
none
Important details
- Custom
OnTriggerwith a parameter works for Telegram (the start command) and Instagram: postback button and ice-breaker payloads, and Instagram ad referrals (Click to Message). - A value in the form
<trigger action> <parameter>starts theTriggerwith that action; everything after the first _ is stored in#node.{id}.trigger_param. For example,ad botox→ aTriggerwith actionad, andtrigger_param = botox. - If the schema contains a node whose action exactly matches the value, execution goes to that node. If there is no match, the ad referral is ignored and message text is processed as usual.
- An equivalent Viber lookup is not described in the verified code.
- If the target action is empty or missing, execution ends with an error.
3. Agent trigger
Agent trigger (OnAgentTriggered) is the entry point for a synchronous AI tool. It receives arguments from the AI agent, validates them against a JSON Schema, and starts a synchronous flow.
Settings
| Field | Meaning |
|---|---|
InputJsonSchema |
JSON Schema describing the AI tool arguments |
NextAction |
Transition to the first processing node |
Connections
- Inputs: none — this is the AI tool entry point.
- Output: one
NextAction. - An AI tool schema must contain exactly one
OnAgentTriggered. - Every execution branch must eventually end with
JSON output.
Output variables
Validated top-level arguments are available as:
#node.{id}.arguments.{property}
The complete canonical arguments JSON is available as:
#node.{id}.arguments_json
Example
Agent trigger
-> HTTP Request
-> Condition
| success -> JSON output
| failure -> JSON output
Important details
OnAgentTriggeredcannot be activated without a validNextAction.- A synchronous AI tool cannot use a flow that waits for new user interaction.
4. OnMemberFollow (User registration)
OnMemberFollow starts the initial flow when a user begins interacting with the bot.
The event is used for:
- Telegram
/start; - Viber
conversation_started.
It may also run for a member that already exists.
Connections
- Inputs: none — this is an entry point.
- Output: one
NextActionto the first node of the start flow.
Result
Normal execution creates:
#node.{id}.event_triggered
#node.{id}.trigger_param
Example
OnMemberFollow
-> Screen "Welcome"
Important details
If the target action is empty or missing, execution has nowhere to continue and ends with an error.
5. OnChatClosed (Chat closed)
OnChatClosed starts a new scenario after an operator chat is closed.
For example, it can be used to return the user to the bot flow after a conversation with an operator has ended.
Connections
- Inputs: none — this is an entry point.
- Output: one
NextAction. - If the handler is empty, no separate flow is started.
Variables
The following global chat variables are available when the event starts:
#chat.sessionId
#chat.provider
#chat.integrationId
#chat.closedAtUtc
#chat.closeEventId
Example
OnChatClosed
-> Screen "The operator chat has ended"
Important details
In the current host code, OnChatClosed starts NextAction directly without executing the EventNode itself. Therefore, #node.{id}.event_triggered is not created for this event.
The connected scenario starts after confirmed chat closure by an operator or an exit button without a transition. If the selected button has a transition, only its target runs; OnChatClosed is not triggered additionally.
6. OnMemberUnfollow (Unsubscribe from bot)
OnMemberUnfollow (eventType=6) starts the connected scenario when an existing user blocks or unsubscribes from the bot in a private Telegram chat or in Viber bot.
Connections
- Inputs: none — this is a scenario entry point.
- Output: one
NextActionto the first node of the unsubscribe scenario. - Only one event of this type can be added to a schema.
Example
OnMemberUnfollow
-> Remove user tag "subscribed"
Important details
- This event is not triggered for Instagram or Viber Business.
- If the event is missing or its output is not connected, no separate scenario starts.