Use LithoBlocks with n8n AI nodes so the AI decides which template and what data to send; an HTTP Request node calls the LithoBlocks API. The AI does not need to output Block Kit JSON, so you use far fewer tokens and get consistent Slack messages. The resulting LLM savings help offset LithoBlocks cost, with net cost reduction at higher volumes.Documentation Index
Fetch the complete documentation index at: https://docs.lithoblocks.com/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
- LithoBlocks API key and at least one template
- Connecting Slack for your LithoBlocks workspace
- n8n with AI nodes (e.g. OpenAI, Anthropic)
- Optional: n8n integration for HTTP and Webhook basics
Why use LithoBlocks with n8n AI
- AI decides content, LithoBlocks builds the message — The AI node outputs
template_idandpayload(e.g. from user input or previous nodes); the HTTP Request node calls LithoBlocks. No need for the AI to output Block Kit JSON. - Lower LLM cost — The AI outputs a small structured object instead of long Slack block structures. LLM savings help offset LithoBlocks cost; at higher volumes, net cost reduction.
- Consistency — Same layout every time; fewer malformed blocks.
Pattern
- AI node — Use an AI node (e.g. OpenAI, Anthropic) with a system or user prompt that asks the AI to return structured data:
template_idandpayload(JSON). Use structured output or JSON mode if available so the output is parseable. - HTTP Request node — Add an HTTP Request node that POSTs to LithoBlocks:
- URL:
https://api.lithoblocks.com/v1/templates/sendorhttps://api.lithoblocks.com/v1/templates/compile(fixed path; template id is not in the URL). - Headers:
Authorization: Bearer YOUR_LITHOBLOCKS_API_KEY,Content-Type: application/json - Body: JSON object with
template_idanddatafrom the AI node (map the AI output intotemplate_idanddata; if your AI still returnspayload, map that value todata). For send, include a destination such aschannel_idas in the API reference.
- URL:
- Optional: Use a Webhook node to receive LithoBlocks webhooks (e.g. button clicks) and feed into another AI node or workflow. See the n8n integration for webhook setup.
Minimal example
- AI node (e.g. OpenAI): Prompt: “Return a JSON object with template_id (string) and data (object matching the template’s placeholders). You may use the key payload for the data object if easier; map it to data in the HTTP node.”
- Enable JSON/structured output if the node supports it so the response is valid JSON.
- HTTP Request node: Method POST. URL:
https://api.lithoblocks.com/v1/templates/send(or/v1/templates/compile). Body: build{"template_id": <from AI>, "data": <from AI payload/data>, ...}pluschannel_idor another send destination as needed. Headers: Authorization Bearer + your API key, Content-Type application/json. - Success/error: Use the HTTP Request node output (status, body) for success or error handling in the next nodes.
Next steps
AI agents overview
Why templates and agents fit together.
n8n integration
HTTP and Webhook setup in n8n.
API reference
Endpoints, auth, and parameters.
Placeholders
Template data shape and syntax.

