Discord Integration with SmythOS
Want to connect your automations directly to your community? Connect Discord to SmythOS and empower your agents to send messages, notifications, and rich embeds to any server channel.
List of Discord Components
Quickly compare Discord components by what they do and their key I/O. Click any component name to jump directly to its detailed guide.
Component | Action | What it Does | Inputs | Key Outputs | Use Case |
---|---|---|---|---|---|
Send Message | Write | Sends a standard text message to a specified channel. | required channel_id , content | messageId | Sending simple notifications or alerts. |
Send Message with Embed | Write | Sends a message with a rich, formatted embed. | required channel_id optional content , Body | messageId | Posting detailed reports or announcements. |
Prerequisites
Before you begin, please ensure you have the following:
- An active SmythOS account. (Sign up here).
- A Discord account.
- A Discord Server where you have Administrator permissions to invite bots.
- Your Discord Bot's Bot Token.
Getting Started With Discord
The connection between SmythOS and Discord is configured using a secure Bot Token, which you get by creating a Discord Application.
Step 1: Create a Discord Application
- Navigate to the Discord Developer Portal and log in.
- Click the New Application button in the top-right corner.
- Give your application a name (e.g., "SmythOS Notifier") and agree to the terms. Click Create.
Step 2: Create a Bot User
- Inside your new application, click on the Bot tab in the left-hand menu.
- Click the Add Bot button, and confirm by clicking Yes, do it!.
- You can customize your bot's username and icon here.
- Crucially, under the "Privileged Gateway Intents" section, enable the
MESSAGE CONTENT INTENT
toggle. This is often required for bots to read message content, though for sending messages it might not be strictly necessary, it's good practice for future-proofing.
Step 3: Get Your Bot Token
-
On the same Bot page, find the "Token" section.
-
Click the Reset Token button (or "View Token" if visible). You will be shown your bot's token.
-
Copy this token immediately. It is a secret credential and will not be shown again.
Secure Your Bot Token!
Step 4: Invite Your Bot to a Server
- Navigate to the OAuth2 > URL Generator tab in the Developer Portal.
- In the "Scopes" section, check the box for
bot
. - A "Bot Permissions" section will appear below. Check the permissions your bot will need. For sending messages, you'll need at least
Send Messages
andEmbed Links
. - Copy the Generated URL at the bottom of the page.
- Paste this URL into your browser, select the server you want to add the bot to, and click Authorize.
Step 5: Configure the Discord Integration in SmythOS
- In your SmythOS dashboard, navigate to the Vault and create a new secret (e.g.,
discord_bot_token
) with the Bot Token you copied. - In your agent graph, drag and drop any Discord component.
- Click the component to open its Settings panel.
- In the
Bot Token
field, select the secret you just saved. - Your connection is now ready.
Which Discord Component Should I Use?
If you need to… | Target | Use this Component | Why this one? |
---|---|---|---|
Send a quick, simple text notification | A channel ID and a line of text | Send Message | The most straightforward way to send plain text. |
Post a structured, visually appealing announcement | A channel ID and a formatted body | Send Message with Embed | Embeds allow for titles, colors, fields, and images, making your message stand out. |
Component Details
This section provides detailed information for each Discord component.
Send Message
Sends a standard text message to a specified Discord channel.
Inputs
Field | Type | Required | Notes |
---|---|---|---|
channel_id | string | Yes | The ID of the Discord channel where the message will be sent. |
content | string | Yes | The text content of the message. Supports Discord's Markdown. Max 2000 characters. |
Outputs
Field | Type | Description |
---|---|---|
messageId | string | The unique ID of the message that was sent. |
Response | object | The full, raw JSON response from the Discord API, containing the complete message object. |
Headers | object | The HTTP headers from the API response. |
{
"component": "discord.sendMessage",
"channel_id": "123456789012345678",
"content": "A new pull request has been opened and is ready for review."
}
Best Practices & Advanced Tips
- Secure Your Bot Token: Your Bot Token is a highly sensitive credential. Always store it in the SmythOS
Vault
. If a token is ever exposed, reset it immediately in the Discord Developer Portal. - Manage Permissions: When inviting your bot, grant it only the permissions it needs. If it only sends messages, it doesn't need administrator privileges. This is a crucial security practice.
- Use Embeds for Clarity: For any data-rich notification, use the
Send Message with Embed
component (not detailed here, but available). Embeds are much easier to read than long strings of plain text. - Get Channel IDs: To send a message, you need the ID of the channel. In Discord, enable Developer Mode (User Settings > Advanced > Developer Mode), then right-click on any channel and select "Copy Channel ID".
Troubleshooting Common Issues
-
Error:
401 Unauthorized
- Cause: The Bot Token is incorrect or invalid.
- Solution: Verify that the token in your SmythOS Vault is correct. If you suspect it has been compromised, reset it in the Discord Developer Portal and update the Vault secret.
-
Error:
403 Forbidden
/ Missing Access- Cause: The bot does not have the required permissions in the target channel.
- Solution: Check the bot's roles in your Discord server settings. Ensure it has the
Send Messages
permission (andEmbed Links
if using embeds) in the channel you're trying to post to.
-
Error:
404 Not Found
- Cause: The
channel_id
provided is incorrect or does not exist. - Solution: Right-click the channel in Discord (with Developer Mode enabled) and copy the ID again to ensure it's correct.
- Cause: The
What's Next?
You are now ready to build powerful notification and community automation workflows with the SmythOS Discord Integration!
Consider these ideas:
-
Build an Agent That...
- Monitors an RSS feed for a specific blog and posts a summary and link for each new article into a
#reading-list
channel. - Fetches the latest release from a GitHub repository and posts a detailed changelog announcement using a rich embed.
- Connects to a payment gateway. When a new premium subscription is purchased, the agent posts a "Thank You" message that mentions the new subscriber in a special
#supporters
channel.
- Monitors an RSS feed for a specific blog and posts a summary and link for each new article into a
-
Explore Other Integrations:
- Use the results from any search or data API (like Tavily or Ahrefs) to generate reports that are delivered directly to a Discord channel.
- Create a simple "status page" bot. An agent pings your web services, and if one is down, it posts an alert to Discord. When the service comes back online, it edits the original message to show it has been resolved.