CrewAI
This guide explains how to use Integry with CrewAI to post a message on Slack.
1. Install Required Libraries
First, you need to install the necessary packages:
Integry requires Python version 3.12 or higher
Integry is used to integrate structured tools and functions.
CrewAI integrate tools and automate workflows using large language models.
2. Initialize Integry & Agent
Import the necessary Libraries
User-ID
is a unique string identifier for a user in your app or agent. Function Calls and Integrations are associated to a user ID. It will be the email address you used during the signup process on Integry.
For example:
Below code snippet initializes the Integry class to interact with the Integry API using the App-Key and App-Secret.
You can view and copy your App-Key
and App-Secret
from the Workspace Settings.
Now initializing the instance of the ChatOpenAI class to interact with OpenAI's GPT-4o model. You can get the API Key from the OpenAI Platform
3. Initialize Agent with an Integry Function as a Tool
Perfect! Before you can use the functions available in Integry, you need to add the app to Integry. Slack, however, is pre-added to Integry by default, so there’s no need to add it manually.
Now that we've set everything up, we will proceed to send a message in Slack using the slack-post-message function from Integry. You can copy the function ID from the dropdown.
For example
In this case the function ID is slack-post-message
After getting the function ID, we then registers it with the Crew AI agents to enable the assistant to call the function.
4. Connect Your Slack Account
To allow the agent to send a message on Slack on your user's behalf, the user must connect their Slack account. To connect a Slack account against the provided user ID, execute the following snippet.
This will print a URL which can be opened in a web browser to connect Slack.
5. Execute Agent
This will execute the agent and send a Hello from crewai to the team message in the Slack random channel.
Last updated