SlackMessageComponent
This component is designed to help you automate interactions with Slack within the Nappai automation system. It acts as a bridge between your workflows and the Slack API, allowing you to manage communication tasks without writing complex code.
You can use this component to send notifications, schedule messages for later, update existing conversations, search through history, and even add reactions (emojis) to messages. It simplifies the process of integrating Slack into your daily data management and automation routines.
How it Works
When you use this component, you are connecting your Nappai workflow to your Slack workspace via a secure API connection.
- Authentication: The component uses a secure “Bot” account that you authorize in Slack. This bot acts on your behalf to send and manage messages.
- Execution: Depending on the Operation you select (e.g., Send Message, Schedule Message), the component performs the specific action. For example, if you choose “Send Message,” it takes the text you provided and the channel ID, then posts it to the specified Slack channel.
- Feedback: After the action is performed, the component returns a status (success or error) and a unique ID for the message. This ID is important if you need to reference that specific message later, such as to delete it or add a reaction.
The component handles the technical details of communicating with Slack’s servers, ensuring your automation runs smoothly and securely.
Connection & Credentials
This component requires a valid Slack integration to function. You must configure a credential before you can use this node in your workflows.
- Go to the Credentials section in your Nappai panel.
- Create a new credential of the type Slack bot API.
- To get the necessary token, go to the Slack API Dashboard, create an app, and configure the OAuth scopes (such as
chat:writefor sending messages). - In your Nappai workflow, select the saved credential in the Credential input field of this node.
Operations
This component offers several operations that you can select based on what you need to do. You can only use one operation at a time:
- List Files Message: Retrieves a list of files or messages associated with the specified channel or user.
- Delete Message: Removes a specific message from a Slack channel using its unique ID.
- Get Permalink Message: Generates a shareable URL (permalink) for a specific message, allowing others to link directly to it.
- Get Messages: Searches for messages in a channel based on specific criteria (like keywords or dates).
- Send Message: Posts a new text message or rich content card to a specified Slack channel.
- Schedule Message: Prepares a message to be sent at a specific future date and time.
- Update Message: Edits the content of an existing message in a Slack channel.
- Add Reaction Message: Adds an emoji reaction (like a thumbs up) to a specific message.
- Get Reaction Message: Retrieves the users or details associated with a specific reaction on a message.
- Remove Reaction Message: Removes an existing emoji reaction from a specific message.
To use the component, first select the operation you need in the “Operation” field.
Inputs
Mapping Mode
This component has a special mode called “Mapping Mode”. When you enable this mode using the toggle switch, an additional input called “Mapping Data” is activated, and each input field offers you three different ways to provide data:
- Fixed: You type the value directly into the field.
- Mapped: You connect the output of another component to use its result as the value.
- Javascript: You write Javascript code to dynamically calculate the value.
This flexibility allows you to create more dynamic and connected workflows.
Input Fields
The following fields are available to configure this component. Each field may be visible in different operations:
-
Operation: Select the specific action you want the component to perform.
- Visible in: List Files Message, Delete Message, Get Permalink Message, Get Messages, Send Message, Schedule Message, Update Message, Add Reaction Message, Get Reaction Message, Remove Reaction Message
-
Channel ID: The unique identifier for the Slack channel (e.g., C123456). Using the ID is more reliable than using the name.
- Visible in: List Files Message, Delete Message, Get Permalink Message, Get Messages, Send Message, Schedule Message, Update Message, Add Reaction Message, Get Reaction Message, Remove Reaction Message
-
Channel Name: A dropdown to select a channel from the list available in your workspace.
- Visible in: List Files Message, Delete Message, Get Permalink Message, Get Messages, Send Message, Schedule Message, Update Message, Add Reaction Message, Get Reaction Message, Remove Reaction Message
-
Channel Selection Method: Choose whether you want to specify the channel by its ID or by its Name.
- Visible in: List Files Message, Delete Message, Get Permalink Message, Get Messages, Send Message, Schedule Message, Update Message, Add Reaction Message, Get Reaction Message, Remove Reaction Message
-
Hours: The hour (0-23) when the message should be sent. Required for scheduling.
- Visible in: Schedule Message
-
limit: The maximum number of results to return. Useful when searching or listing messages.
- Visible in: List Files Message, Get Messages
-
Mapping Mode: Toggle to enable batch processing or dynamic data mapping.
- Visible in: List Files Message, Delete Message, Get Permalink Message, Get Messages, Send Message, Schedule Message, Update Message, Add Reaction Message, Get Reaction Message, Remove Reaction Message
-
Message: The text content of the message you want to send.
- Visible in: Send Message, Schedule Message
-
Minutes: The minutes (0-59) when the message should be sent. Required for scheduling.
- Visible in: Schedule Message
-
Name Reaction: The standard emoji name to add or remove (e.g., “thumbsup”, “heart”).
- Visible in: Add Reaction Message, Remove Reaction Message
-
New Message: The updated text content for an existing message. Used when editing a message.
- Visible in: Schedule Message, Update Message
-
query: The text or keywords to search for within messages.
- Visible in: Get Messages
-
Return All: A toggle to return all matching results or just up to the specified limit.
- Visible in: List Files Message, Get Messages
-
Message id: The unique ID of the specific message you want to act upon (delete, update, react to, etc.).
- Visible in: Delete Message, Get Permalink Message, Update Message, Add Reaction Message, Get Reaction Message, Remove Reaction Message
-
User Name or ID: Filter results by a specific user’s name or ID.
- Visible in: List Files Message
-
Tool Name: The name of the tool as it will appear to the AI agent when selecting tools.
- Visible in: List Files Message, Delete Message, Get Permalink Message, Get Messages, Send Message, Schedule Message, Update Message, Add Reaction Message, Get Reaction Message, Remove Reaction Message
-
Tool Description: A detailed description helping the AI agent understand when and how to use this tool.
- Visible in: List Files Message, Delete Message, Get Permalink Message, Get Messages, Send Message, Schedule Message, Update Message, Add Reaction Message, Get Reaction Message, Remove Reaction Message
-
Tools arguments metadata: Defines metadata for the tool’s arguments.
- Visible in: List Files Message, Delete Message, Get Permalink Message, Get Messages, Send Message, Schedule Message, Update Message, Add Reaction Message, Get Reaction Message, Remove Reaction Message
-
New Channel Name: The name of the new channel to create. No spaces, lowercase only.
- Visible in: List Files Message, Delete Message, Get Permalink Message, Get Messages, Send Message, Schedule Message, Update Message, Add Reaction Message, Get Reaction Message, Remove Reaction Message
-
Private Channel: A toggle to define if the new channel should be private or public.
- Visible in: List Files Message, Delete Message, Get Permalink Message, Get Messages, Send Message, Schedule Message, Update Message, Add Reaction Message, Get Reaction Message, Remove Reaction Message
-
Number of Results: The maximum number of channels to return (relevant for channel listing operations).
- Visible in: List Files Message, Delete Message, Get Permalink Message, Get Messages, Send Message, Schedule Message, Update Message, Add Reaction Message, Get Reaction Message, Remove Reaction Message
-
User Name: The name or ID of a user to invite or filter by.
- Visible in: List Files Message, Delete Message, Get Permalink Message, Get Messages, Send Message, Schedule Message, Update Message, Add Reaction Message, Get Reaction Message, Remove Reaction Message
Outputs
This component produces several outputs that allow you to track the success of your actions and use the results in further steps.
- Data: The primary output containing the result of the operation (e.g., the confirmation of the message sent or the list of messages found).
- Tool: The tool configuration data, useful if you are connecting this component to an AI agent.
Output Data Example (JSON)
When the operation is successful (e.g., sending a message), you might receive output similar to this: json { “status”: “success”, “message_id”: “1678901234.567890”, “channel_id”: “C1234567890”, “response_data”: { “ok”: true, “ts”: “1678901234.567890”, “channel”: “C1234567890”, “text”: “Hello, this is an automated message from Nappai.” } }
You can map these outputs (like message_id) to other components if you need to delete or update the message later.
Connectivity
This component is typically used as a node within a larger automation workflow in Nappai.
- Forward Connections: The outputs (like
message_idorstatus) are often connected to other components that need to know if the message was sent successfully. For example, you might connect thestatusto a conditional branch to send an alert if the message failed. - Backward Connections: Inputs like
Channel IDorMessagemight be mapped from previous components that generate these values dynamically (e.g., a script that finds a channel ID or a form that collects a message). - AI Agents: This component connects well with LanggraphReactAgent or similar AI tools, where the AI decides to send a message based on the logic of the workflow.
Usage Example
Scenario: Sending a Daily Report to Slack
- Get Data: Use a previous component to fetch daily sales data from your database.
- Prepare Message: Use a “Code” or “Format” component to turn that data into a readable text string.
- Send Message: Add the SlackMessageComponent.
- Set Operation to
Send Message. - Select your Credential.
- In Channel ID, enter your team’s channel ID (e.g.,
C01ABC123DE). - In Message, map the output from your data preparation step.
- Click “Run” to send the report automatically.
- Set Operation to
Scenario: Scheduling a Reminder
- Add the SlackMessageComponent.
- Set Operation to
Schedule Message. - Set Hours to
9and Minutes to0(for 9:00 AM). - In Message, type “Don’t forget to submit your timesheet!”
- Set Channel ID to your HR channel.
- The component will queue this message to be sent automatically at the specified time.
- Set Operation to
Important Notes
🔒 Protect Your Slack Token Never expose your Slack Bot User OAuth token in shared files or logs. Store it securely in environment variables or a secrets manager.
⚠️ Component in Development SlackMessageComponent is marked as a development component, meaning some features may be incomplete or subject to change. Users should test thoroughly before using in production workflows.
📋 Slack App Credentials Needed
To use the component, you must have a Slack app with the necessary OAuth scopes (e.g., chat:write, chat:write.public, reactions:read, reactions:write, chat:write.customize).
💡 Use Channel IDs for Messaging When sending or updating messages, provide the channel ID rather than the channel name to avoid ambiguities and ensure the message goes to the intended channel.
⚙️ Set Environment Variables
Configure the SLACK_BOT_TOKEN and optional SLACK_APP_TOKEN in your environment before running the component. Refer to the documentation for exact variable names.
ℹ️ Scheduled Messages Cannot Be Edited Once a message is scheduled, Slack does not allow it to be updated or deleted via the API. The component will respect this limitation, so plan your message content in advance.
Tips and Best Practices
- Always use the Channel ID (starting with ‘C’) instead of the channel name (starting with ’#’) for more reliable automation.
- If you need to send a complex message with buttons or images, ensure your Slack App has the
chat:writescope. - When searching for messages (
Get Messages), use specific keywords to avoid retrieving too much data. - Test your workflows with small messages before setting up large-scale automations.
Security Considerations
- Ensure your Slack Bot Token is kept secret and not committed to public code repositories.
- Use the principle of least privilege when configuring Slack App scopes; only grant permissions your workflow actually needs.
- Be aware that scheduled messages cannot be easily modified once sent, so double-check the content before scheduling.