Skip to main content

Slack Integration with SmythOS

Want to bring your automations into your team's conversations? Connect Slack to SmythOS and empower your agents to send real-time messages and alerts directly to your channels.

TL;DR

Securely link your Slack workspace to SmythOS by creating a Slack App and getting a Bot User OAuth Token. Then, use the "Send Message" component to automate all your team notifications.

List of Slack Components

Quickly compare Slack components by what they do and their key I/O.

ComponentActionWhat it DoesInputsKey OutputsUse Case
Send MessageWriteSends a message to a specified public or private channel.required channel_id, textstatus, msgObjPosting automated alerts or daily reports.
INFO
Why Integrate Slack with Your Agent?

Slack is the digital headquarters for countless teams. Integrating it with SmythOS allows you to build powerful agents that communicate and deliver information where your team is already working.

  • Automated Alerting: Create agents that monitor your infrastructure, applications, or support queues. When a critical event occurs, the agent can instantly post a detailed alert to the appropriate #alerts or #devops channel.
  • Centralized Notifications: Instead of relying on email, have your agents send all their notifications—from new sales leads to project status updates—into dedicated Slack channels. This keeps information organized and accessible.
  • Reporting and Summaries: Schedule an agent to run daily or weekly, gather data from various sources like Google Analytics or your CRM, and post a concise summary report in a leadership channel.
  • Streamline Workflows: Use Slack as the final step in a workflow. An agent can process data, generate a result, and deliver that result directly to a user or channel, closing the loop on an automated task.

Prerequisites

Before you begin, please ensure you have the following:

  • An active SmythOS account. (Sign up here).
  • A Slack workspace where you have permission to install apps.
  • A Slack Bot User OAuth Token.

Getting Started With Slack

The connection between SmythOS and Slack is configured using a secure Bot Token, which you get by creating a Slack App.

Step 1: Create a Slack App and Get Your Token

  1. Navigate to the Slack API dashboard and click Create New App.
  2. Choose From scratch.
  3. Give your app a name (e.g., "SmythOS Notifier") and select the workspace you want to install it in. Click Create App.
  4. You will be taken to the app's basic information page. In the left menu, click on OAuth & Permissions.
  5. Scroll down to the Scopes section. Under "Bot Token Scopes," click Add an OAuth Scope.
  6. Add the chat:write scope. This allows your app to post messages in channels it's a member of. You may need other scopes like channels:read or users:read for more advanced components.
  7. Scroll back to the top of the "OAuth & Permissions" page and click Install to Workspace.
  8. Follow the prompts to authorize the app.
  9. After authorization, the page will reload, and you will see a Bot User OAuth Token (it starts with xoxb-). Copy this token immediately.

Step 2: Store Your Bot Token in SmythOS Vault

Your Bot Token is a sensitive credential. Use the SmythOS Vault to store it securely.

  1. In your SmythOS dashboard, navigate to the Vault.
  2. Create a new secret and paste your Slack Bot User OAuth Token as the value. Give it a memorable name, like slack_bot_token.
  3. For more details, see the Vault Documentation.

Step 3: Configure a Slack Component

  1. In your SmythOS agent graph, drag and drop the Send Message component.
  2. Click the component to open its Settings panel.
  3. In the Bot User OAuth Token field, select the secret you saved in the Vault (e.g., slack_bot_token).
  4. Your connection is now configured.

Step 4: Add the Bot to a Channel

For your bot to post messages in a channel, it must be a member of that channel.

  1. In Slack, go to the channel where you want to post messages.
  2. Type /invite @[Your Bot's Name] and press Enter.
  3. Your bot is now ready to post in that channel.

Which Slack Component Should I Use?

If you need to…TargetUse this ComponentWhy this one?
Send a notification to your teamA channel_id and textSend MessageThis is the core component for all communication tasks in Slack.

Component Details

This section provides detailed information for the Slack component.

Send Message

Posts a message to a specified public or private channel in your Slack workspace.

INFO
This component requires a Bot User OAuth Token for authentication, as detailed in the Getting Started section.

Inputs

FieldTypeRequiredNotes
channel_idstringYesThe ID of the channel, private group, or user to send the message to.
textstringYesThe text content of the message. Supports Slack's mrkdwn.

Outputs

FieldTypeDescription
statusstringA descriptor of the operation's success or failure (e.g., "ok").
msgObjobjectThe message object containing details of the sent message, including its timestamp (ts).
ResponseobjectThe full, raw JSON response from the Slack API.
HeadersobjectThe HTTP headers from the API response.
Use Case

A deployment agent monitors a GitHub workflow. When the deployment to production is successful, it uses this component to send a message to the #engineering channel: ✅ Production deployment of v2.5.1 was successful.

{
"component": "slack.sendMessage",
"channel_id": "C012AB3CD4E",
"text": "Heads up team, a new high-priority support ticket has just been created."
}
Finding the Channel ID

To get a channel's ID, open Slack, right-click on the channel name in the sidebar, and select "Copy Link". The ID is the string of characters that starts with C (for public channels) or G (for private channels).

Best Practices & Advanced Tips

  • Secure Your Bot Token: Your Bot User OAuth Token can post messages and perform actions as your bot. Always store it in the SmythOS Vault.
  • Use mrkdwn for Formatting: The text input supports Slack's mrkdwn syntax. Use it to make your messages more readable with bold, italic, code, and > blockquotes.
  • Master Block Kit for Rich Messages: For more advanced formatting than mrkdwn, you can construct a blocks array in a custom API call. Block Kit allows you to build messages with buttons, images, and complex layouts.
  • Use Dedicated Channels: For automated notifications, it's a best practice to create dedicated channels (e.g., #alerts, #deployments, #new-leads) to keep conversations organized and prevent clutter in general channels.

Troubleshooting Common Issues

  • Error: not_in_channel

    • Cause: The bot you are using to post the message has not been invited to the specified channel_id.
    • Solution: In the target Slack channel, type /invite @[Your Bot's Name] to add it to the channel.
  • Error: invalid_auth

    • Cause: The Bot User OAuth Token is incorrect, invalid, or has been revoked.
    • Solution: Verify that the token in your SmythOS Vault is correct. If needed, generate a new one in your Slack App settings and update the Vault secret.
  • Error: channel_not_found

    • Cause: The channel_id provided is incorrect or does not exist.
    • Solution: Double-check the channel ID by right-clicking the channel in Slack and selecting "Copy Link".
  • Error: missing_scope

    • Cause: The Bot Token does not have the required permissions (scopes) to perform the action.
    • Solution: Go to your Slack App's settings in the Slack API dashboard, navigate to OAuth & Permissions, and add the necessary Bot Token Scopes (e.g., chat:write). You will need to reinstall the app to your workspace after changing scopes.

What's Next?

You are now ready to build powerful notification and communication workflows with the SmythOS Slack Integration!

Consider these ideas:

  • Build an Agent That...

    • Creates a daily "digest" of all new tasks created in Asana or Trello and posts it in a project channel.
    • Monitors your company's Twitter mentions. When a negative tweet is detected (using a sentiment analysis model), it sends an urgent alert to the #pr-crisis channel with a link to the tweet.
    • Connects to your e-commerce store. When a new order over $500 is placed, it posts a celebratory message with a GIF in the #sales-wins channel.
  • Explore Other Integrations:

    • Combine Slack with a database integration like Firestore. When a new critical error is logged, trigger an agent to post the details to Slack.
    • Use an LLM component to summarize a long document, then post the summary to a Slack channel for the team to review.
    • When a new lead is created in HubSpot, notify the assigned sales representative via a direct message in Slack.