Author: Arawan Gajajiva
Date Posted: Nov 18, 2024
Last Modified: Dec 11, 2024
MatiHelper - A Slack AI App
Meet MatHelper, a set of Data Productivity Cloud pipelines that monitors a Slack channel for messages, submits recorded messages to OpenAI as prompts and responds back to the original Slack messages with the AI generated response.
MatiHelper was built as a demonstration of the “art of the possible”, using Data Productivity Cloud features to build an end to end data pipeline. Import these pipelines to see examples of using Data Productivity Cloud to build an AI app with Slack as a user interface! These pipelines showcase Data Productivity Cloud in action, with actual examples of using Data Productivity Cloud features and designing common data design patterns in the low-code Designer UI!
Here’s a short video that shows MatiHelper in action!
After importing these pipelines, you will find everything organized under a SlackAI App folder in your project. Start with the Slack AI - Main pipeline as the primary orchestration that everything runs from.
Before you can run the MatiHelper Slack AI App, you will need to create a Data Productivity Cloud OAuth Profile, configure some variables and then Publish before executing the main pipeline.
Prerequisites
Slack
- MatiHelper uses Slack APIs to monitor a channel and uses a Slack Webhook to post a response back into the Slack Channel.
- Generate a Slack API Token and store it in a Secret Definition named
Slack-Token
- Create a Slack app, Enable incoming webhooks and Create an incoming webhook for your Slack Channel as described here. Note your Slack Webhook URL.
OpenAI
- The MatiHelper Slack AI App uses the OpenAI Prompt Component. Create a new Secret definition named
OpenAI-Key
to store a valid OpenAI token. - Alternatively, replace the OpenAI Prompt component in the pipeline with any of the Data Productivity Cloud AI Prompt Components!
OAuth
- Create an OAuth for Data Productivity Cloud
- Set the OAuth name:
DPC
- Use the Client ID and Client Secret for your Hub Account. If a Client ID and Client Secret have not yet been provisioned for your Hub Account, follow the steps listed under Step 1: Generate API credentials.
Variables
Project Variables
- Create a Project Variable named:
proj_microbatch
- This Project Variable will control the continuously running behavior of MatiHelper.
- Set a Default Value for the Environment that MatiHelper will use.
- Set to
0
if you do not wish for MatiHelper to continuously run (or to turn off MatiHelper) - Set to
1
for MatiHelper to continuously run (Microbatch mode)
Pipeline Variables
The following pipeline variables require a value be provided at execution time. If starting MatiHelper from the Designer UI, you must define default values for these pipeline variables. If starting MatiHelper via API, you can specify the pipeline variable values in the API call.
pipe_channel_id
- The is the Slack Channel ID for the channel that MatiHelper will monitor.pipe_dpc_api_version
- The version of the Data Productivity Cloud API used when MatiHelper is configured to continuously run. Typically, this will be “v1”.pipe_dpc_project_id
- The unique identifier for the Data Productivity Cloud Project. Project IDs can be retrieved using the List All Projects API Endpoint. Pro Tip: You can find your Project ID in the browser URL when using Data Data Productivity Cloud Designer. In a Data Productivity Cloud Designer URL, the Project ID is the string between /project/ and /branch/.pipe_dpc_server
- This represents the region that your Hub Account is hosted in. Values can be either “us1” or “eu1”.pipe_environment
- The name of the Environment that the MatiHelper pipelines have been Published to.pipe_notify_webhook_url
- The Slack Webhook URL that will be used by MatiHelper to notify if it running in continuously running mode. MatiHelper will send a Slack message to this Slack Webhook URL at the top of the hour if it is running in continuously running mode.pipe_webhook_url
- This is the Slack Webhook URL that will be used by MatiHelper to send a threaded reply to messages captured in the Slack Channel. This Slack Webhook URl should have permissions on the same Slack Channel defined by the pipe_channel_id variable.
Execution
To run the MatiHelper Slack AI App directly from Designer, first set the default values of the Project Variables and Pipeline Variables as detailed above. Once variable defaults are set, run the main pipeline, Slack AI - Main
.
You can also trigger the MatiHelper Slack AI App to run from a remote API call. Included in the .zip file is a Python script, dpc_execute_matihelper_pipeline.py
, that can be used to trigger the MatiHelper Slack AI App to execute. To launch MatiHelper in this way, first set values for variables in the Python script. All variables in the Python Script align with the Project and Pipeline Variables detailed above.
Downloads
Licensed under: Matillion Free Subscription License
- Download MatiHelper SlackAI App_Snowflake.zip
- Target: Snowflake