Skip to content

pompeii-labs/slack-agent-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

[Template] Slack DM Agent

Welcome to Magma! 🌋

Thank you for downloading this agent template. This README will show you 5 minutes is all you need to get:

  • An AI agent hosted on Magma
  • A Slack app connected to your agent
  • Interactive chat with your agent right in your Slack workspace

Getting Started

The first thing you need to do is upload the v0 of your agent to Magma, just so we can get an agent ID.

For this, we'll need the Magma CLI.

Installation

npm install -g @pompeii-labs/cli

Login

magma login

Saving the Agent

Making sure you're in the root of your project, run:

magma save

Slack App Setup

Manifest

In the root of this project, you'll notice a nifty file called manifest.json. This is the schema for your Slack app, with permissions, scopes, and other settings already defined for you. There are just two things you need to change:

  • AGENT_NAME in the display_information section - whatever you want the name of your agent in to be in Slack
  • AGENT_ID placeholder in the settings.event_subscriptions.request_url section - this url is the hook into your hosted Magma agent that slack will send data to!

Creating the App

Once the manifest is updated, it's time to make the app.

Go to https://api.slack.com/apps and click "Create an app". When given the option, select "From a manifest", rather than "From scratch".

Select the workspace you want to create the app in, and then click "Next".

When prompted, replace the contents of the manifest they give you with the contents of manifest.json in this project.

When you get to the "Review" step, click "Create".

Installing the App

Now that the app is created, you need to "install" it into your workspace. This is basically you giving the app permission to access your workspace.

Head to the "OAuth & Permissions" tab, and click "Install to Workspace". Give the app permission to access your workspace, and then click "Install".

Once you have done this, you will notice the Bot User OAuth Token. Copy that and paste it into the .env file as SLACK_BOT_TOKEN.

Deploying the Agent

Everything should be set up on Slack's side. The only thing left to do is deploy your agent to Magma.

Sounds complicated, right? I promise you it's not. Take a look:

magma deploy

This will deploy your agent to Magma, and you should be able to see it in the Magma dashboard. If so, this means it's also listening for events on Slack.

Test Your Agent

Head to your Slack workspace an do a search for your agent! Pro tip: cmd+t on Mac, ctrl+t on Windows opens the search bar.

You should see your agent in the list of results. Click on it, and you should be able to chat with it!

If you have any questions, feel free to reach out to us at [email protected].

Happy coding! 🤖

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published