Replying to chat messages
Learn how to reply to messages created by an earlier workflow step or in an existing thread.
Chat channel steps can start a new conversation or reply to an existing provider thread. When a parent message was created by the current workflow run, you can send a reply to a previous chat step. To reply to a message that already exists outside the workflow run, you'll provide its message ID instead.
Reply to a previous chat step
#This is the recommended way to create a reply. Knock uses the earlier workflow step's provider message reference and destination, so you do not need to pass provider IDs or configure the destination again.
In the workflow builder:
- Add a chat channel step after the step that creates the parent message.
- Set Message behavior to Reply to a previous chat step.
- Select the Parent step.
A step is available as a parent when it:
- Is a previous chat channel step that is reachable on every execution path to the reply. Chat steps inside conditional branches will not be eligible as a parent to subsequent steps outside of that branch.
- Uses the same single Knock channel as the reply step. Channel groups are not supported.
- Resolves to one provider message and destination for the current recipient workflow run. A chat step that creates multiple messages, such as when a recipient has multiple channel connections, is not eligible as a parent.
The reply step inherits the exact provider message reference and recipient connection from its parent. If the parent message is queued or scheduled, Knock waits for its provider message reference before attempting the reply.
Reply to an existing thread
#Use this option when the parent message already exists outside of the current workflow run.
In the workflow builder:
- Set Message behavior to Reply to an existing thread.
- Enter the Parent message ID, usually as a dynamic Liquid reference from your workflow trigger
data. - For Slack, optionally enter the channel ID in Send to. See below for more detail on configuring the destination.
The value expected for Parent message ID depends on the provider:
- For Slack, use the parent message's timestamp (
ts). Knock sends it to Slack asthread_ts. - For Discord, use the parent Discord message ID.
Configure the destination
#For Slack, Send to accepts a Slack channel ID, usually from workflow trigger data such as {{ data.channel_id }}. Leave it blank to use the recipient's Slack channel connection. In either case, the destination must be the channel that contains the parent message.
For Discord, Knock uses the Discord channel data stored on the recipient. That connection must identify the channel that contains the parent message.
The configured Slack or Discord channel supplies authentication. Do not put a bot token in workflow data or in the destination field.
Slack trigger data example
#Send the Slack message timestamp and channel ID in the workflow trigger data:
Then configure the Slack step with:
At execution time, Knock renders the destination as a recipient connection equivalent to: