LlamaIndex
This guide explains how to use Integry with LlamaIndex 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 enables seamless integration of structured tools and functions from over 300 apps
LlamaIndex integrate tools and automate workflows using large language models.
2. Initialize Integry & Agent
Import the necessary Libraries
user_id
is how you define users in your app or agent. By default, your email used during your Integry signup can act as a user_id as well. Function Calls and Integrations are linked to this id.
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.
To begin using Integry, you first set the App Key and App Secret as environment variables. Here is a quick way
Initializing the Integry object
Now initializing the instance of the OpenAI class to interact with OpenAI's GPT-4o model. You can get the API Key from the OpenAI Platform
3. Register the 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 your Integry account, so there’s no need to add it manually.
To enable the assistant to call the function, we register it with the LlamaIndex agents. Now that everything is set up, we will send a message in Slack using the Integry slack-post-message 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 message to the Slack channel.
This will send the message to the slack channel. Here is reference image.
The message has been sent successfully in slack #random channel. You can verify the successful message delivery by checking the highlighted content in the response below.
Last updated