Generate text via a validated webhook with Anthropic Claude and Slack
Ready for 3.0What this workflow does
This workflow has 14 nodes and runs when an HTTP POST request hits its webhook URL. It uses only n8n's built-in nodes. It also calls api.anthropic.com over HTTP.
How it runs
Trigger: When an HTTP POST request hits its webhook URL.
- Validate input & apply defaults (Code): runs custom JavaScript code
- Input valid? (If): checks a condition and branches into true / false
- Build Claude request body (Code): runs custom JavaScript code
- Respond: validation error (Respond to Webhook): sends the response back to the webhook caller
- Call Claude (Anthropic) API (HTTP Request): calls api.anthropic.com (POST)
- Call succeeded? (If): checks a condition and branches into true / false
- Format success response (Code): runs custom JavaScript code
- Format upstream error response (Code): runs custom JavaScript code
- Respond: generated text (Respond to Webhook): sends the response back to the webhook caller
- Set: Slack webhook URL (Edit Fields (Set)): sets 1 field: slackWebhookUrl
…plus 3 more steps. See the full node list below.
HTTP calls to: api.anthropic.com
Before you upgrade to n8n 3.0
Nothing in this workflow is removed in n8n 3.0, so it should import and run after the upgrade.
Nodes used (6)
- Webhook
n8n-nodes-base.webhook - Code
n8n-nodes-base.code - If
n8n-nodes-base.if - Respond to Webhook
n8n-nodes-base.respondToWebhook - HTTP Request
n8n-nodes-base.httpRequest - Edit Fields (Set)
n8n-nodes-base.set
From the author
Quick overview This workflow exposes a POST webhook that validates prompt inputs, calls the Anthropic Claude Messages API with retries, returns a consistent JSON response, and posts a preview of the generated text to Slack using an Incoming Webhook. How it…