Follow these steps to add your first workflow step:
npx shadcn@latest init -u https://workflow-registry.vercel.appThis saves the registry URL so you don't have to use the full URL each time.
npx shadcn@latest add send-slack-messageOr use the full URL if you haven't configured the registry:
npx shadcn@latest add https://workflow-registry.vercel.app/r/send-slack-messagenpx shadcn@latest add send-slack-message send-email generate-ai-contentThe CLI will download all steps and install their dependencies automatically.
import { sendSlackMessage } from '../steps/send-slack-message';
export async function notifyTeam(message: string) {
'use workflow';
// This step will automatically retry on failures
const result = await sendSlackMessage({
channel: '#general',
text: message,
});
return result;
}Add the required environment variables to your .env file:
SLACK_BOT_TOKEN=xoxb-your-token-hereWorkflow steps are functions marked with the 'use step' directive. This directive tells the Workflow DevKit to handle retries, error handling, and state persistence automatically.
FatalError for errors that shouldn't retry (invalid configuration, 4xx errors). The workflow will stop instead of retrying.