Connect your Slack workspace to a Cluster in the Playground UI by navigating to the Cluster’s “Integrations” tab and selecting “Slack”.
This will ask you to authorise your Slack workspace with Inferable.
Your Slack workspace can only be connected to one Cluster at a time.
Connecting another Cluster to the same workspace will replace the existing
integration.
Your Workflows can programatically notify Slack when human approval is required.The Interrupt.approval() function can accept a notification object to configure the Slack notification.
Copy
import { Inferable, Interrupt, approvalRequest } from "inferable";const inferable = new Inferable({ apiSecret: process.env.INFERABLE_API_SECRET,});const deleteUserWorkflow = inferable.workflows.create({ name: "deleteUser", inputSchema: z.object({ executionId: z.string(), userId: z.string(), }),});deleteUserWorkflow.version(1).define(async (ctx, input) => { if (!ctx.approved) { return Interrupt.approval({ message: `I need your approval to delete the user ${input.userId}. Is this ok?`, destination: { type: "slack", // The email address of the Slack user to notify email: "[email protected]", // Or Slack user ID userId: "U0123456789", // Or Slack channel ID channelId: "C0123456789", }, }); } //...});