Approve AI Agent Actions From Slack

Connect Impri to Slack and your AI agent's proposed actions land in a channel where you can approve or reject them with a single tap — no dashboard required.


How it works

When an agent pushes a proposed action to Impri, Impri routes the approval notification to wherever you've configured it — including a Slack channel. The agent then polls for the decision. If you approve in Slack, the agent proceeds; if you reject, it stops. The agent code is identical regardless of which channel you use for approvals. What changes is the notification routing, which you configure once in the Impri dashboard.

The message that arrives in Slack shows the action's title and kind with Approve / Reject buttons. The draft itself stays on the card in the Impri inbox. A click from someone on the channel's approver list records the decision immediately, and the polling agent picks it up on its next check.


Setting up Slack notifications

Connect your Slack workspace once via the Impri notifications settings: on the cloud with Add to Slack, self-hosted with your own Slack app. The full walk-through is in the Slack approval guide. Once connected, every action your agent pushes triggers a Slack message automatically.

Then add the Slack user IDs of the people who may approve to the channel. The list starts empty after Add to Slack, and a click from anyone not on it is refused. Every notification channel in a project receives every card: there is no per-agent or per-key routing.


The agent side

The agent code follows the same push → poll → execute pattern regardless of approval channel. Here's a complete Python example for an agent that drafts a LinkedIn update and waits for your tap in Slack before posting it.

python
import time
import httpx

IMPRI_API_KEY = "im_your_key_here"
IMPRI_BASE = "https://api.impri.dev"

def propose_and_wait(draft: str) -> tuple[str, dict] | None:
    """Push a social post draft for approval. Returns (action_id, approved preview) or None."""

    # 1. Push the proposed action
    resp = httpx.post(
        f"{IMPRI_BASE}/v1/actions",
        headers={"Authorization": f"Bearer {IMPRI_API_KEY}"},
        json={
            "kind": "social.post",
            "title": "LinkedIn post: Q3 product update",
            "preview": {
                "format": "markdown",
                "body": draft,
            },
            "expires_in": 3600,      # 1 hour — stale social posts aren't worth sending
            "editable": ["preview.body"],  # let the reviewer fix wording before approving
        },
        timeout=10,
    )
    resp.raise_for_status()
    action = resp.json()
    action_id = action["id"]

    print(f"Action pending — check Slack. ID: {action_id}")

    # 2. Poll until a human decides in Slack (or until expiry)
    while True:
        result = httpx.get(
            f"{IMPRI_BASE}/v1/actions/{action_id}",
            headers={"Authorization": f"Bearer {IMPRI_API_KEY}"},
            timeout=10,
        ).json()

        status = result["status"]
        if status != "pending":
            break
        time.sleep(10)

    if status != "approved":
        print(f"Not proceeding — decision: {status}")
        return None

    # 3. Return the final content (includes edits the reviewer made in the inbox)
    return action_id, result["decision"]["final_preview"]


def post_to_linkedin(content: str) -> None:
    # your actual LinkedIn posting code here
    print(f"Posting: {content}")


def run_agent(draft: str) -> None:
    approved = propose_and_wait(draft)
    if approved is None:
        return  # rejected or expired — nothing to post

    action_id, final_preview = approved
    post_to_linkedin(final_preview["body"])

    # 4. Report result back to Impri (closes the audit record)
    httpx.post(
        f"{IMPRI_BASE}/v1/actions/{action_id}/result",
        headers={"Authorization": f"Bearer {IMPRI_API_KEY}"},
        json={"status": "executed"},
        timeout=10,
    )

A few things worth noting:


What the Slack card shows

When the notification arrives in Slack, the message includes:

Field Source
Action title title from your push call
Kind kind from your push call
Approve / Reject buttons when the channel is in approval mode (otherwise a "Review in Impri" link)

The preview body, the expiry and editing stay on the card in the inbox. After a click, Impri replaces the message with the outcome, for example "✅ Approved by @alice". What happens on a double click, a click from someone not on the list, or a click on an expired card is measured in Slack approve buttons vs an approval inbox.

You can approve from the Slack mobile app, desktop app, or web — whichever is in reach when the notification arrives.


When Slack approval fits

Slack is a natural fit when you or your team already have Slack open and want approvals to arrive in the same place as other work notifications. It is especially useful for:

If you need approvals routed to a mobile push with no app required, see notifications for ntfy and web push options. If your team uses Telegram instead, the setup is covered in the Telegram approval docs.


Next steps

Start free on the cloud and connect Slack with Add to Slack, or self-host Impri and follow the Slack approval guide. Then run the agent above with your key and approve its first post from the channel.

For a full explanation of the push → approve → execute pattern and how to make the gate genuinely binding, see How to Add Human Approval to an AI Agent.