Skip to content
Docs

Gateway

Gateway starts a flow when a message is sent to a Discord or Slack bot under Chat apps that dials out: Publicus holds its Discord gateway or Slack Socket Mode connection open for you, so no public URL is needed. The platform’s gateway daemon maintains the socket and starts a fresh run of every bound flow for each inbound message. You find the node on the node picker’s Triggers — start the flow shelf; How-to: Connect an agent to a chat channel explains where bots that dial out fit among the channel options.

The node has a single webhook handle, which connects into Start’s trigger handle. Like every inbound trigger it starts nothing until it is wired into Start, and a frame that reaches an unwired trigger is recorded as a skip on the bot’s log. It binds the flow to one bot, which you add under Chat apps in Services; the Slack agent and Discord agent guides walk through creating one.

The Gateway node's settings form, with the fields described below
The Gateway node's settings form, with the fields described below
FieldTypeDefaultDescription
Bot (webSocketConnectionId)string ✦ (required) — The Discord or Slack bot under Chat apps whose inbound messages start this flow. Publicus holds its gateway or Socket Mode connection open.

Fields marked ✦ accept expressions.

The channel message arrives as the run’s start data in a flat, normalized shape. There is no payload wrapper:

{
"channel": "slack",
"externalWorkspaceId": "T01234567",
"externalConversationId": "C09876543",
"externalUserId": "U0AB12CD3",
"text": "What are your opening hours?",
"conversationKey": "6c84fb90-12c4-5a1e-8c3d-0e5b2f7a9d41",
"replyContext": {}
}

Read the message with {{ $start->text }}. The conversationKey is a stable identity for the (channel, conversation, user) triple: key a Chat Thread memory node on it and the agent keeps one thread per conversation. replyContext carries platform-specific reply hints for the channel send nodes.

A received Discord frame opened from Received frames: its origin, channel, and payload with text, attachments, replyContext, externalUserId, conversationKey, externalWorkspaceId and externalConversationId
A received Discord frame opened from Received frames: its origin, channel, and payload with text, attachments, replyContext, externalUserId, conversationKey, externalWorkspaceId and externalConversationId

The Slack support agent template is the full loop: a Gateway trigger bound to a Slack bot on Socket Mode, an Agent prompted with {{ $start->text }}, and a Chat Thread memory keyed on {{ $start->conversationKey }}. It has no send node: the bot itself posts the agent’s answer in the conversation the message came from. The Discord support agent template is the same shape on a Discord bot.

An Answer the support channel flow, Live: v1: a Gateway trigger with an On badge wired into Start, a Support agent, and a Conversation Chat Thread node wired into the agent's memory handle
An Answer the support channel flow, Live: v1: a Gateway trigger with an On badge wired into Start, a Support agent, and a Conversation Chat Thread node wired into the agent's memory handle
  • Gateway has no overlap option: every inbound message starts its own run, even while earlier runs are still in flight, because a conversation cannot afford to drop messages.
  • One bot can fan out to several flows: every flow with an armed Gateway node bound to it runs on each message.
  • Triggered runs execute the flow’s published version; see Triggers & arming.