Skip to content
Dashboard

Chat SDK now supports callback URLs on buttons and modals

Example of a Slack approval card that requests your permission to send a status reportExample of a Slack approval card that requests your permission to send a status report
Slack approval card for a status report request
lib/bot.ts
import { createWebhook } from "workflow";
import { Card, CardText, Actions, Button } from "chat";
export async function statusReport(
thread,
content: { title: string; message: string },
) {
"use workflow";
using hook = createWebhook<{ action: "approve" | "approve-and-send" | "deny" }>();
await thread.post(
<Card title="Status Report Communications">
<CardText>Title: {content.title}</CardText>
<CardText>Message: {content.message}</CardText>
<Actions>
<Button callbackUrl={hook.url} id="approve" style="primary">
Approve
</Button>
<Button callbackUrl={hook.url} id="approve-and-send" style="primary">
Approve & Send
</Button>
<Button callbackUrl={hook.url} id="deny" style="danger">
Cancel
</Button>
</Actions>
</Card>
);
const { action } = await hook;
if (action === "approve" || action === "approve-and-send") {
await sendReport(content);
}
}

Create an approval card to approve or deny a deployment

The Complete Guide to Chat SDK

Learn how Chat SDK works end-to-end: from core concepts to building your first bot to deploying it across Slack, Teams, and more.

Read the guide

Ready to deploy?