Slack Triggers
Trigger workflows from Slack events, commands, and interactions
Slack Triggers
Slack triggers start workflows in response to Slack events, slash commands, and interactive components like button clicks and modal submissions.
Overview
Three types of Slack triggers are supported:
| Trigger Type | Use Case | Example |
|---|---|---|
| Event Trigger | Respond to messages, mentions, reactions | Bot @mentioned, keyword detected |
| Slash Command | User runs /command | /invoice create, /approve |
| Interactive | Button clicks, modal submissions | Approve button, form submission |
Prerequisites
Environment Configuration
Slack App Setup
- Create a Slack App at api.slack.com/apps
- Enable Event Subscriptions and point to your endpoint
- Add required bot scopes
- Install app to workspace
Endpoint URLs
Configure these URLs in your Slack app settings:
| Feature | URL |
|---|---|
| Event Subscriptions | https://your-domain.com/api/v1/slack/events |
| Slash Commands | https://your-domain.com/api/v1/slack/commands |
| Interactivity | https://your-domain.com/api/v1/slack/interactive |
Event Triggers
Respond to Slack Events API events like messages, mentions, and reactions.
Configuration Schema
Configuration Fields
| Field | Type | Required | Description |
|---|---|---|---|
type | string | Yes | Must be slack_event |
eventType | string | Yes | Slack event type or * for all |
channelTypes | array | No | Filter by channel type (channel, group, im, mpim) |
keywords | array | No | Trigger only if message contains keyword (case-insensitive) |
regex | string | No | Trigger only if message matches regex |
userIds | array | No | Trigger only for specific user IDs |
filter | object | No | Advanced filter using dot notation and operators |
Supported Event Types
| Event Type | Description | Key Fields |
|---|---|---|
message | Channel or DM message | text, user, channel, ts |
app_mention | Bot @mentioned in message | text, user, channel, ts |
reaction_added | Emoji reaction added | reaction, user, item.channel, item.ts |
reaction_removed | Emoji reaction removed | reaction, user, item.channel, item.ts |
channel_created | New channel created | channel.id, channel.name, channel.creator |
channel_deleted | Channel deleted | channel |
member_joined_channel | User joined channel | user, channel, inviter |
member_left_channel | User left channel | user, channel |
file_shared | File uploaded | file_id, user_id, channel_id |
app_home_opened | User opened Home tab | user, tab |
Event Payload Structure
Example: Keyword-Based Message Trigger
Example: Bot Mention Trigger
Example: Reaction Trigger
Slash Command Triggers
Respond to custom slash commands like /invoice, /approve, etc.
Configuration Schema
Configuration Fields
| Field | Type | Required | Description |
|---|---|---|---|
type | string | Yes | Must be slack_slash_command |
command | string | Yes | The slash command (including /) |
Command Payload Structure
Key Payload Fields
| Field | Description |
|---|---|
command | The slash command (e.g., /invoice) |
text | Text after the command |
user_id | User who ran the command |
user_name | Username |
channel_id | Channel where command was run |
trigger_id | Used to open modals (expires in 3 seconds) |
response_url | URL to send delayed responses |
Example: Invoice Creation Command
Example: Help Command
Interactive Triggers
Respond to button clicks, menu selections, modal submissions, and shortcuts.
Configuration Schema
Configuration Fields
| Field | Type | Required | Description |
|---|---|---|---|
type | string | Yes | Must be slack_interactive |
interactionType | string | Yes | Interaction type or * for all |
actionId | string | No | Filter by action_id (for block_actions) |
callbackId | string | No | Filter by callback_id (for modals/shortcuts) |
filter | object | No | Advanced filter |
Interaction Types
| Type | Description | When Triggered |
|---|---|---|
block_actions | Button click, menu selection | User clicks button or selects option |
view_submission | Modal form submitted | User submits modal |
view_closed | Modal closed | User closes modal without submitting |
shortcut | Global shortcut | User runs global shortcut |
message_action | Message shortcut | User runs message shortcut |
Interactive Payload Structure
Block Actions (Button Click):
View Submission (Modal):
Example: Button Click Handler
Example: Modal Submission Handler
Built-in Approval Handling
The platform includes built-in support for human-in-the-loop approvals via Slack. When a workflow step uses the approval type with Slack notifications, approval buttons are automatically handled.
Automatic Approval Button Handling
Buttons with action IDs matching approval_approve_<token> or approval_reject_<token> are automatically processed:
- The approval decision is recorded
- The waiting workflow is resumed
- The Slack message is updated with the decision
No custom trigger configuration is needed for approval workflows.
Important Behavior
3-Second Acknowledgment Rule
Slack requires responses within 3 seconds. All triggers:
- Acknowledge immediately with a brief response
- Process the event asynchronously
- Use
response_urlfor delayed responses
URL Verification
When setting up Event Subscriptions, Slack sends a verification challenge. This is handled automatically:
Retry Deduplication
Slack retries failed requests with headers:
X-Slack-Retry-Num: Retry attempt numberX-Slack-Retry-Reason: Reason for retry
Retries are automatically deduplicated using Redis with a 1-hour TTL.
Signature Verification
All requests are verified using HMAC-SHA256:
- Compute:
v0:timestamp:raw_body - Sign with
SLACK_SIGNING_SECRET - Compare with
X-Slack-Signatureheader - Reject if timestamp is >5 minutes old (replay attack prevention)
Filter Operators
Use these operators in the filter configuration:
| Operator | Description | Example |
|---|---|---|
$eq | Equal to | { "event.type": { "$eq": "message" } } |
$ne | Not equal to | { "event.channel_type": { "$ne": "im" } } |
$in | In array | { "event.reaction": { "$in": ["thumbsup", "heart"] } } |
$exists | Field exists | { "event.thread_ts": { "$exists": true } } |
Access nested fields with dot notation: event.item.channel
Troubleshooting
Common Issues
| Issue | Cause | Solution |
|---|---|---|
| Signature verification failed | Wrong secret or clock skew | Verify SLACK_SIGNING_SECRET, check server time |
| Events not received | Wrong URL or app not installed | Check Event Subscriptions URL, reinstall app |
| Modal won't open | Expired trigger_id | Open modal within 3 seconds of receiving event |
| Duplicate events | Retries not deduplicated | Check Redis connection |
| Missing scopes | Insufficient permissions | Add required scopes in app settings |
Required Scopes by Feature
| Feature | Required Scopes |
|---|---|
| Receive messages | channels:history, groups:history, im:history, mpim:history |
| Receive mentions | app_mentions:read |
| Slash commands | (configured per command) |
| Interactive | (automatic with Interactivity URL) |
| Post messages | chat:write |
| Open modals | (automatic with bot token) |
Debug Logging
Events are logged at these points:
- Signature verification result
- Event deduplication check
- Matching workflow discovery
- Workflow trigger success/failure
Check logs for Slack event processing failed or Failed to trigger workflow from Slack event.
Related Documentation
- Slack Block - Send messages and interact with Slack
- Webhook Triggers - Other webhook-based triggers
- Approval Steps - Human-in-the-loop approvals