Approve in Slack, Discord or Teams
Send approval requests to the place where your team already works, and route them by impact.
What it shows
- You connect a channel in the portal: Slack, Discord, Microsoft Teams, ServiceNow or Jira Service Management.
- Each channel has a filter: a minimum risk level, and optionally a list of agents. A second channel with "High and above" can go to the people on call.
- An agent sends a request that needs a person. LumoAuth posts it to every channel whose filter it passes.
- A reviewer answers with a button in the message. The same rules apply as in the portal.
- The agent continues exactly as with the portal inbox. Its code does not change.
Before you start
- A workspace of the chat tool, and the right to add an app to it.
- Reviewers with the permission
jit.approve. In Slack, LumoAuth finds the reviewer by the email address of the Slack profile, so that address must belong to a user of your organization. - An agent that sends a request of high risk. The setup script registers the agent "Archive agent", and makes a second user, Maya Chen, its owner: the owner of an agent cannot decide its requests in any channel.
- Check that your plan includes approval channels and just-in-time permissions in the plans matrix.
| Variable | Value |
|---|---|
LUMOAUTH_URL | The address of LumoAuth: https://app.lumoauth.dev, or https://eu.app.lumoauth.dev for the EU region. |
LUMOAUTH_ORG_ID | Your organization, for example acme-corp. |
LUMOAUTH_API_KEY | For the setup script only: an API key with the scopes admin:agents:read, admin:agents:write and admin:users:write. The agent itself needs no API key. |
AGENT_CLIENT_ID | The client ID of the agent, which is its agent ID (agt_…). The setup script prints it. |
AGENT_CLIENT_SECRET | The client secret of the agent. The setup script prints it. |
The setup script creates what the recipe needs, through the Admin API. You can run it again at any time.
node approvals/slack-and-other-channels/setup.mjs
setup.mjs
// Creates what the recipe needs: an agent that may read and delete invoices,
// and a user who owns it. Run it again at any time.
//
// node approvals/slack-and-other-channels/setup.mjs
//
// The API key needs the scopes admin:agents:read, admin:agents:write and
// admin:users:write.
import { randomBytes } from 'node:crypto';
import { call, ensure, printEnv } from '../../_lib/admin.mjs';
const agent = await ensure('/admin/agents', (a) => a.name === 'Archive agent', {
name: 'Archive agent',
description: 'Removes invoices that are older than ten years.',
identityType: 'client_secret',
capabilities: ['invoices:read', 'invoices:delete'],
});
// LumoAuth shows a secret once, in the answer that creates it. On a second
// run the script therefore asks for a new secret, and the old one stops.
const secret =
agent.clientSecret ??
(await call('POST', `/admin/agents/${agent.agentId}/rotate-credentials`)).data.clientSecret;
// The owner of an agent cannot decide its requests, in a channel or in the
// portal, and the agent belongs to the person who created it: you. Give it
// to another person, so that you can decide.
const owner = await ensure('/admin/users', (u) => u.email === 'maya.chen@example.com', {
email: 'maya.chen@example.com',
name: 'Maya Chen',
// The recipe never signs in as this user, so nobody needs the password.
password: `${randomBytes(18).toString('base64url')}#Aa1`,
emailVerified: true,
});
await call('PATCH', `/admin/agents/${agent.agentId}`, { ownerId: owner.id });
console.log(`Agent "${agent.name}" is ready. Its owner is ${owner.email}.`);
printEnv({ AGENT_CLIENT_ID: agent.agentId, AGENT_CLIENT_SECRET: secret });
Connect a Slack channel
- In Slack, create an app "From scratch" at
api.slack.com/apps. Under OAuth & Permissions, add the bot scopeschat:write,users:readandusers:read.email. Install the app, and copy the Bot User OAuth Token. - In the portal of LumoAuth, open Settings, then Integrations, then Approval channels. Under Add a channel, click Slack. The portal may ask for your password first.
- The page shows the address for Slack under Set up Slack. In your Slack app, turn on Interactivity & Shortcuts, and paste the address as the Request URL.
- From Basic Information of the Slack app, copy the Signing Secret.
- Invite the bot to the Slack channel, and copy the channel ID from the details of the channel.
- In the form of the portal, fill Name, Channel ID, Bot user OAuth token and Signing secret. Under Minimum risk level, choose "High and above".
- Click Add channel. Then open the channel in the portal and click Test connection. The test posts a message and stores the ID of your Slack workspace. LumoAuth accepts button presses only from that workspace.
Discord, Microsoft Teams, ServiceNow and Jira Service Management have their own forms on the same page. Approval channels in the product documentation has the steps for each one.
Code
The agent sends an ordinary just-in-time request. Nothing in it names a channel.
Run each command from the recipes folder of the examples repository. Set the folder up once for your language. The steps for the channel follow the form of the portal and the product documentation. They were not carried out with a real workspace.
- curl
#!/bin/sh
# An agent sends a request of high risk and waits for the decision. The agent
# does not know where the reviewers answer: in the portal or in a channel.
# Needs curl and jq.
#
# sh approvals/slack-and-other-channels/http/request.sh
set -eu
API="$LUMOAUTH_URL/orgs/$LUMOAUTH_ORG_ID/api/v1"
# The agent signs in with its ID and its secret.
AGENT_TOKEN=$(curl --silent --show-error --fail "$API/oauth/token" \
--user "$AGENT_CLIENT_ID:$AGENT_CLIENT_SECRET" \
--data "grant_type=client_credentials" | jq -r .access_token)
post() {
curl --silent --show-error "$API$1" \
--header "Authorization: Bearer $AGENT_TOKEN" \
--header "Content-Type: application/json" \
--data "$2"
}
TASK_ID=$(post /jit/task '{"name": "Remove invoices of 2015", "type": "retention"}' | jq -r .task_id)
# A delete is high risk, so it always waits for a person. LumoAuth posts it to
# every channel whose filter it passes.
REQUEST=$(post /jit/request "{
\"task_id\": \"$TASK_ID\",
\"authorization_details\": {\"type\": \"invoices\", \"actions\": [\"delete\"], \"identifier\": \"year-2015\"},
\"justification\": \"The retention period of the invoices of 2015 has ended.\"
}")
REQUEST_ID=$(printf '%s\n' "$REQUEST" | jq -r .request_id)
STATUS=$(printf '%s\n' "$REQUEST" | jq -r .status)
echo "request: $STATUS, risk $(printf '%s\n' "$REQUEST" | jq -r .risk_level), decide before $(printf '%s\n' "$REQUEST" | jq -r .expires_at)"
# Ask for the status every 5 seconds until somebody decides or the request ends.
while [ "$STATUS" = "pending" ]; do
sleep 5
STATUS=$(curl --silent --show-error "$API/jit/request/$REQUEST_ID/status" \
--header "Authorization: Bearer $AGENT_TOKEN" | jq -r .status)
done
echo "request: $STATUS"
if [ "$STATUS" = "approved" ]; then
TOKEN=$(post "/jit/request/$REQUEST_ID/token" '{}')
echo "token: $(printf '%s\n' "$TOKEN" | jq -r '.access_token[0:12]')… valid for $(printf '%s\n' "$TOKEN" | jq -r .expires_in) seconds"
fi
post "/jit/task/$TASK_ID/complete" '{}' > /dev/null
echo "task: completed"
sh approvals/slack-and-other-channels/http/request.sh
Compiles. Not run against an organization. The script ran against an organization, and the request was approved in the portal. No Slack, Discord or Teams workspace was connected, so no message in a channel was seen.
Check the result
request: pending, risk high, decide before 2026-11-27T16:35:47+00:00
request: approved
token: eyJ0eXAiOiJK… valid for 600 seconds
task: completed
- The Slack channel shows a message with the request and the buttons Approve and Deny. After the click, the message shows the outcome and the buttons are gone, for everyone in the channel.
- The request is also in the approvals inbox of the portal. The first decision counts, wherever it is made.
- Open Audit logs under Security. A decision in a channel is the event
approval_channel.decision. A refused attempt isapproval_channel.decision_rejected. - A request with a
writeaction is medium risk. A channel with "High and above" does not receive it.
Limits
- A request in Slack, Discord or Teams waits for 5 minutes, as in the portal. A ServiceNow or Jira channel has its own time to decide: 60 minutes unless you change it, and 24 hours at most.
- A channel can decide only the requests that were posted to it.
- The reviewer in the channel needs
jit.approve, and cannot be the owner of the agent or the person for whom the agent acts. - ServiceNow and Jira channels need a list of allowed reviewers, because the ticket system names the reviewer.
- A Teams channel with only an incoming webhook shows the request with a link to the inbox, and no buttons.