An example app that searches your Slack messages to answer technical questions.
About
—> Copy the channel ID.METAL_API_KEY
METAL_CLIENT_ID
METAL_INDEX_ID
SLACK_CHANNEL_ID
SLACK_TOKEN
Runtime
with the remote compute options for the app, and a Beam Image
with the Python packages we’ll need to run our code:
Channel ID
you’ve passed in:
index_many()
, which is what we’ll use. This method has a limit of 100 records per insertion, so we’re going to limit this to 100 records for now.
The text
field of each message is what Metal will use to create a similarity index between messages. We’ll also store the user
, message type
, and ts
(timestamp) of the message as metadata.
beam.App()
you’ve specified above, and connect it to your local shell. You’ll know you’re connected to the remote environment when you see a red (beam)
next to your cursor:
populate_index
, we’ll see our indexed Slack messages appear in Metal’s dashboard:
metal.search()
method to query our index for messages related to our query:
chat_getPermalink()
which will generate a permanent URL to the Slack message returned from our query.
And finally, in order to run this as a REST API, we’ll wrap our function in an @app.rest_api()
decorator:
beam run
command:
beam deploy
command: