All posts

Rest API Workflow Approvals in Slack

Managing workflows can feel overwhelming when important approvals get stuck or buried in your team’s communication channels. For teams building applications with a focus on seamless collaboration, integrating approval workflows directly into Slack can streamline decision-making and enable faster action. Slack's ubiquity as a central communications hub makes it the perfect environment to notify, approve, and track requests. This post explores integrating Rest APIs to handle workflow approvals in

Free White Paper

Human-in-the-Loop Approvals + REST API Authentication: The Complete Guide

Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.

Free. No spam. Unsubscribe anytime.

Managing workflows can feel overwhelming when important approvals get stuck or buried in your team’s communication channels. For teams building applications with a focus on seamless collaboration, integrating approval workflows directly into Slack can streamline decision-making and enable faster action. Slack's ubiquity as a central communications hub makes it the perfect environment to notify, approve, and track requests.

This post explores integrating Rest APIs to handle workflow approvals in Slack, breaking down the process into manageable steps. You'll learn the essentials for setting up workflows, sending API requests, and turning Slack into the operational engine for fast, efficient approvals.


Why Use Rest APIs for Workflow Approvals in Slack?

When building approval-driven operations like budget requests, code reviews, or purchase authorizations, manual processes can lead to inefficiencies, delays, and missed deadlines. Rest APIs offer a programmatic way to automate these workflows, while Slack ensures teams can respond instantly.

Here are the key benefits:

  • Centralized Decisions: Keep approvals within Slack, where your team is already active.
  • Reduced Friction: Automate processes without switching between tools or platforms.
  • Real-Time Feedback: Notify approvers instantly and log responses for tracking.
  • Ease of Implementation: Utilize Slack’s API and webhook integrations alongside your existing Rest API workflows.

How Rest APIs and Slack Work Together for Approvals

Slack offers an extensive API that lets you send tailored messages, buttons, and even Slack apps to enable dynamic interactions. By combining your existing Rest API logic with Slack’s messaging capabilities, you can automate approval processes and keep everything in sync.

Here’s how the integration typically flows:

  1. Trigger a Request: Your system (via a Rest API) identifies a new task requiring approval.
  2. Post to Slack: Use Slack’s Chat.postMessage to send an approval request to a specific user or channel.
  3. Capture a Response: Leverage Slack’s interactive messages, such as buttons or drop-down menus, to allow the approver to instantly approve or deny.
  4. Update the System: Send the approver’s decision back to your app, update the status in the backend, and notify stakeholders.

By structuring this flow, teams can eliminate repetitive work, improve transparency, and cut down response times.

Continue reading? Get the full guide.

Human-in-the-Loop Approvals + REST API Authentication: Architecture Patterns & Best Practices

Free. No spam. Unsubscribe anytime.

Building Rest API Workflow Approvals in Slack

Below is a high-level guide to set up a Slack-integrated workflow approval using Rest APIs. This will help your team move from conception to implementation as quickly as possible.

1. Set Up Slack API Workspace Integration

  • Create a Slack app in your Slack API Dashboard.
  • Add necessary scopes such as chat:write, commands, and interactive:write.
  • Generate an OAuth token for authentication during API calls.

2. Define Your Workflow Logic

Before sending requests to Slack, create clear endpoints in your Rest API that trigger workflows. For instance, an endpoint like /api/request-approval might:

  • Accept POST requests with relevant data (e.g., request type, user ID of the approver).
  • Store the payload details in your system for reference or audit.

3. Send Approval Requests to Slack

Use Slack’s chat.postMessage API to send tailored messages. Here’s an example payload:

POST https://slack.com/api/chat.postMessage
Authorization: Bearer <your-slack-oauth-token>
Content-Type: application/json

{
 "channel": "approvals",
 "text": "New approval request: Budget increase for Project X",
 "attachments": [
 {
 "text": "Do you approve?",
 "fallback": "Approval request",
 "callback_id": "approval_12345",
 "actions": [
 {
 "name": "approve",
 "text": "Approve",
 "type": "button",
 "value": "approve"
 },
 {
 "name": "deny",
 "text": "Deny",
 "type": "button",
 "value": "deny"
 }
 ]
 }
 ]
}

This sends an interactive message to a Slack channel or user, where they can approve or reject the request with a single click.

4. Handle Responses with Webhooks

Set up a response URL in your Slack app’s configuration to capture user actions when they click on the "Approve"or "Deny"button.

For example:

  • Slack sends a POST request to your webhook containing details like callback_id, user_id, and actions (i.e., which button was clicked).
  • Parse this request in your backend and update the approval status.

Example response-handling logic:

@app.route('/slack/webhook', methods=['POST'])
def handle_slack_action():
 data = request.get_json()
 user_action = data['actions'][0]['value']
 # Process "approve"or "deny"
 if user_action == 'approve':
 update_request_status(data['callback_id'], 'approved')
 elif user_action == 'deny':
 update_request_status(data['callback_id'], 'denied')
 return jsonify({'text': 'Your response has been recorded.'})

5. Notify Stakeholders After Approval

Once a decision has been recorded, use Slack API again to send a notification to the relevant stakeholders (e.g., the requester or admin). This keeps everyone in the loop and clarifies the approval process.


Best Practices for Workflow Approvals in Slack

  • Test in a Private Channel First: Verify payload structures and capture edge cases like unresponsive users.
  • Use Descriptive Messages: Clearly communicate what’s being approved—add context to minimize confusion.
  • Time-Bound Approvals: Consider adding deadlines in your Rest API design to handle pending approvals effectively.
  • Track Approvals: Log all interactions in your system for future audits or project insights.

See It Live in Minutes

Streamlined workflow approvals in Slack are easier than you think, especially when powered by well-designed APIs. If you’re looking to get started today, Hoop.dev has everything you need. Build, test, and deploy custom workflows with no configuration headaches. Try it out and see how fast approvals can improve team productivity.

Get started

See hoop.dev in action

One gateway for every database, container, and AI agent. Deploy in minutes.

Get a demoMore posts