Blog/Engineering
EngineeringNov 13, 20266 min read

How to require human approval in Slack or Teams before an AI agent acts

Build an approval gate that posts risky AI agent actions to Slack or Microsoft Teams, waits for Approve or Reject, and fails closed. Includes a working Slack bridge for AI-written email with SendGuard.

By SendGuard Team
human in the loopapprovalsai agentsslackmicrosoft teamsapproval gates

Short answer

Yes, you can require a human to approve in Slack or Microsoft Teams before an AI agent acts. Take the action away from the agent and put a gate in front of it. The gate decides whether the action can run now or needs a person. When it needs a person, a small bridge posts an Approve / Reject message to a Slack channel or Teams chat and records the click. The action runs only after an explicit approval, and a timeout counts as a rejection.

Slack or Teams is only the notification surface. Three things make it a real gate:

  1. The agent cannot call the action directly. It can only request it.
  2. The decision is stored outside the chat tool. A message in a channel is not an audit log.
  3. Unanswered requests fail closed. No reply means no action.

The rest of this post shows the pattern for any agent action, then a working Slack bridge for AI-written email using the SendGuard approvals API.

The approval gate pattern

Each step below is plain code you control. None of it depends on the model following instructions.

  1. Request. The agent produces a proposed action (send this email, close this alert, refund this order) and hands it to the gate. It never gets the tool that performs it.
  2. Decide. A policy returns allow, requires_approval, or block. Routine actions pass. Only risky ones go to a human, so reviewers aren't flooded.
  3. Notify. For requires_approval, the bridge posts a message with the context a reviewer needs and two buttons.
  4. Resolve. The button click is verified as coming from Slack or Teams and recorded as approved or rejected, together with who clicked.
  5. Execute or drop. A worker runs approved actions exactly once and drops rejected or expired ones.

Putting "ask a human before acting" in the system prompt does not create this gate. The model can rationalize past an instruction, and a prompt injection can remove it. The capability has to live in code the agent can't reach.

Slack or Teams: what to use

Slack. Post a message with Block Kit buttons using chat.postMessage, and turn on interactivity in your Slack app so button clicks are sent to your request URL. Verify every click with the app's signing secret before you trust it. Slack expects a response within three seconds, so record the decision first and do slow work afterwards.

Microsoft Teams. The lowest-effort option is a Power Automate flow that uses the Teams action "Post adaptive card and wait for a response" and then calls your resolve endpoint with the result. For a fully coded integration, a Teams bot can send an Adaptive Card and handle the button submit itself. Either way, the card is only a view; the decision still belongs in your system of record.

In both tools, use a private channel or a named approver group. An approval channel everyone can see invites someone to click without context.

Example: approving AI-written email from Slack

SendGuard implements the decide and record steps for outbound email. Every send goes through POST /v1/preflight/email. Low-risk mail returns allow. A send that trips a policy, for example a pricing claim to a healthcare contact, returns requires_approval, with reason codes and a queue name:

{
  "id": "8a13d8bc-9bf0-4d11-a5b9-2cf92eb9dbee",
  "decision": "requires_approval",
  "risk_score": 86,
  "reasons": [
    {"code": "SENSITIVE_INDUSTRY", "severity": "high", "message": "Recipient industry \"healthcare\" requires human review before autonomous outreach"},
    {"code": "PRICING_CLAIM_DETECTED", "severity": "high", "message": "Pricing or discount claims require human approval before sending"}
  ],
  "approval": {"queue": "sales_manager", "reason": "Pricing or discount claims require human approval before sending"}
}

SendGuard also creates a pending approval request linked to that preflight id. The bridge has three parts.

1. Post pending approvals to Slack. Poll GET /v1/approvals?status=pending and post each new request once:

import requests

SENDGUARD = "https://api.sendguard.ai"
SG_HEADERS = {"Authorization": "Bearer sk_live_xxx"}
SLACK_HEADERS = {"Authorization": "Bearer xoxb-your-bot-token"}

def post_pending_approvals(channel, already_posted):
    pending = requests.get(f"{SENDGUARD}/v1/approvals", params={"status": "pending"},
                           headers=SG_HEADERS, timeout=10).json()
    for item in pending:
        if item["id"] in already_posted:
            continue
        requests.post("https://slack.com/api/chat.postMessage", headers=SLACK_HEADERS, timeout=10, json={
            "channel": channel,
            "text": f"AI email to {item['email_to']} needs approval (risk {item['risk_score']})",
            "blocks": [
                {"type": "section", "text": {"type": "mrkdwn", "text":
                    f"*{item['agent_id']}* wants to email *{item['email_to']}*\n"
                    f"Risk {item['risk_score']}, queue `{item.get('approval_queue') or 'default'}`"}},
                {"type": "actions", "elements": [
                    {"type": "button", "style": "primary", "text": {"type": "plain_text", "text": "Approve"},
                     "action_id": "approve", "value": item["id"]},
                    {"type": "button", "style": "danger", "text": {"type": "plain_text", "text": "Reject"},
                     "action_id": "reject", "value": item["id"]},
                ]},
            ],
        })
        already_posted.add(item["id"])

Put the draft itself (subject and body) in the message from your own store, keyed by the preflight id. That way the reviewer reads what will actually be sent.

2. Handle the click. Verify Slack's signature, then resolve the approval in SendGuard:

import hashlib, hmac, json, time
from urllib.parse import parse_qs

def handle_slack_interaction(headers, raw_body, signing_secret):
    timestamp = headers["X-Slack-Request-Timestamp"]
    if abs(time.time() - int(timestamp)) > 300:
        return 401
    base = f"v0:{timestamp}:{raw_body.decode()}".encode()
    expected = "v0=" + hmac.new(signing_secret.encode(), base, hashlib.sha256).hexdigest()
    if not hmac.compare_digest(expected, headers["X-Slack-Signature"]):
        return 401

    payload = json.loads(parse_qs(raw_body.decode())["payload"][0])
    action = payload["actions"][0]
    status = "approved" if action["action_id"] == "approve" else "rejected"
    requests.post(f"{SENDGUARD}/v1/approvals/{action['value']}/resolve",
                  headers=SG_HEADERS, json={"status": status}, timeout=10)
    audit_log(approval_id=action["value"], status=status, slack_user=payload["user"]["id"])
    return 200

A request can only be resolved while it is still pending, so a second click on the same message changes nothing. SendGuard records the API key's account as the approver. Keep the Slack user ID in your own audit log, as audit_log does above, so you know which person clicked.

3. Send only what was approved. Your sender worker reads GET /v1/approvals?status=approved. It matches each item's preflight_event_id to the held draft and sends it once. Drafts that are still pending after your deadline (for example, four business hours) are dropped and logged as expired. Never let an unanswered approval default to sending.

What this does not cover

SendGuard gates outbound email: it checks the recipient, the sender's health and the message against your policy. It does not ship a Slack or Teams app; the bridge above is yours to run. It also doesn't gate other agent actions such as closing a security alert, changing a firewall rule or issuing a refund. For those, use the same five-step pattern with your own policy check in the decide step. The rules carry over: the agent only requests, the decision is stored outside the chat tool, and a timeout counts as a rejection.

If you are choosing between approving everything, pausing the agent framework on a tool call, and escalating only risky sends, see How to require human approval before an AI agent sends email.

Try it on one real flow

The SendGuard $1 pilot is a one-time $1 purchase for 100 production preflight checks. It is not a subscription. Run a redacted or synthetic copy of one AI email your agent would send and see whether it comes back requires_approval and for which reasons. Then point the Slack bridge at it. Request and response fields are in the API docs.

FAQ

Can an AI agent be stopped from acting until someone approves in Slack or Teams? Yes, if the agent never holds the action itself. The agent submits a request, a person approves in Slack or Teams, and separate code performs the action only after an approval is recorded.

Is a Slack message enough as an audit trail? No. Messages can be edited, deleted or lost to retention settings. Store the request, the decision, the time and the approving person in a system you control, and treat the chat message as a notification.

What happens if nobody responds? Treat it as rejected. Set a deadline per queue and drop or re-request expired items. An unanswered approval should never turn into an action.

Does every action need a human? No. Put a policy in front of the queue so routine actions run immediately and only risky ones wait. Otherwise reviewers start approving without reading, which removes the gate in practice.

Build with SendGuard

Put outbound policy in front of every AI-generated email.

Use one API to score risk, enforce approval, and protect sender reputation before delivery.

More from the blog

Related reading on safer AI outbound systems.

ProductNov 15, 20269 min read

How an AI agent can get its own API key and buy credits, with a human still in control

Let an AI agent sign itself up for an API, check its balance and request more credits without a person filling in forms, while a human approves every step that grants access or spends money. How SendGuard's agent self-serve works.

ai agentsagent signupapi keys
Read article →
EngineeringOct 12, 20265 min read

How to require human approval before an AI agent sends email

Three working patterns for putting a human approval gate in front of AI-written email, with a SendGuard preflight example that only escalates the risky sends.

human in the loopapprovalsai agents
Read article →