Slack
Send messages and collect responses via Slack channels or DMs
Configuration
To connect slack, you can:
- Head to the HumanLayer dashboard
- Navigate to “Integrations”
- Click “Add to Slack”
- Follow the Slack Approval Workflow
- Congrats - your HumanLayer agents will now contact you in Slack for approvals
Customizing Channels
By default,
The Slack contact channel allows agents to send messages and collect responses through Slack channels or direct messages.
Configure a Slack channel using the SlackContactChannel
model:
Allowed Responders
You can restrict which Slack users are allowed to respond to a message using allowed_responder_ids
:
The allowed_responder_ids
must be Slack user IDs (starting with U
). Messages from other users will be ignored.
See 01-math-example-allowed-repliers.py for a complete example.
Thread Messages
You can specify a thread to post messages in using the thread_ts
parameter:
The thread_ts
parameter accepts a Slack message timestamp (e.g. “1234567890.123456”) which identifies the parent message of the thread. When specified, all messages will be posted as replies in that thread instead of as new messages in the channel.
This is useful for organizing related approvals or keeping discussions contained within specific threads.
Channel/User ID
The channel_or_user_id
must be a Slack ID:
- Channel IDs start with
C
(e.g.C123456
) - User IDs start with
U
(e.g.U123456
) - Do not use channel names (
#general
) or usernames (@user
)
You can get a channel ID in slack by right-clicking the channel, going to “Channel Details”, and copying the ID at the bottom of the modal.
You can also override the contact channel at the per-request level:
Or in one or more human-as tool instances
Context
The optional context_about_channel_or_user
field helps the LLM understand who it’s talking to:
Usage
Use the Slack channel with either core feature: