Messages are how people communicate with people, message metadata is how apps communicate with apps.
Message metadata opens up the path to automate tasks with meaningful data for your workflows.
This guide will showcase a couple of use cases that utilize message metadata for automation:
These two examples are merely scratching the surface of how message metadata can supercharge your apps!
You can kick-off a 2 step, 5 step or even a 20 step workflow with your app being the first domino to fall.
Read on to learn more ways to add modular automation metadata to your app's workflows.
An onboarding app is kicked off when a new person is added to a team channel or user group within Slack. This app utilizes the power of message metadata and sends along a new_teammate
event:
POST /api/chat.postMessage
Host: slack.com
Authorization: Bearer xoxb-6050345600-60510457-…
Content-type: application/json; charset=utf-8
{
"channel": "C23456",
"text": "New teammate @Billy just joined",
"metadata": {
"event_type": "new_teammate",
"event_payload": {
"id": "TK-2132",
"summary": "New teammate has been added to the channel",
"description": "@Billy is a new teammate and needs to be added to the neccesary channels",
"priority": "HIGH",
"resource_ type": "TASK"
}
}
}
This event payload can inform an app to trigger the following events:
description
field contents being sent to a managerSending and receiving message metadata is as simple as subscribing your app to message_metadata_*
events. This allows your app to listen for an event within the metadata
parameter such as event_type
and the additional keys that give more details on an event. Message metadata can be returned anywhere messages can be retrieved.
Another example of using message metadata from an external source could be a feedback app listening with a webhook. Let's say you have a website where users can post feedback. You have your app set to listen for feedback posts. When a post does occur, your app posts a message in #feedback-channel with metadata attached:
POST /api/chat.postMessage
Host: slack.com
Authorization: Bearer xoxb-6050345600-60510457-…
Content-type: application/json; charset=utf-8
{
"channel": "C23456",
"text": "New feedback received",
"metadata": {
"event_type": "feedback_received",
"event_payload": {
"id": "TK-2132",
"summary": "User submitted feedback",
"description": "Someone submitted feedback on this page",
"feedback_message":"This page is awesome, thanks for writing it!",
"page_url": "http://api.slack.com/metadata",
"priority": "LOW",
"page_owner": "@haile",
"resource_ type": "TASK"
}
}
}
You can then have a Slack app that:
page_owner
found in the event_payload
The number of actions being triggered is up to you and your app's utilization of message metadata. This type of automation allows your app to work in tangent with your team, opening up new doors for work to get done.Check out the design guidelines for suggested message metadata event schemas.
Ready to listen for message metadata? Subscribe your app to the following events as well request the the message_metadata:read
scope.
Event | Description |
---|---|
message_metadata_deleted |
Message metadata was deleted |
message_metadata_posted |
Message metadata was posted |
message_metadata_updated |
Message metadata was updated |
These events allow you to be updated on the goings on of the message metadata being consumed by your app. Or be a trend setter and publish your own unique metadata for others to consume. Either way your Slack app is now able to communicate with other apps within the Slack ecosystem.