Automatic AI reply when mentioned in a Liveblocks comment
Automatic AI reply when mentioned in a Liveblocks comment
This example uses Liveblocks Comments, collaborative commenting components for React. When an AI assistant is mentioned in a thread (e.g. "@AI Assistant"), it will automatically leave a response.
Using webhooks, this workflow is triggered when a comment is created in a thread. If the agent's ID ("__AI_AGENT") was mentioned, an AI agent is given the entire thread context, and asked to create a response. This response is then added, and users will see it appear in their apps in real time.
Set up This workflow requires a Comments app installed and webhooks set up in the Liveblocks dashboard. You can try it with a demo application:
Download the Next.js comments example, and run it with a secret key. Find database.ts inside the example and uncomment the AI assistant user. Insert the secret key from the project into n8n nodes: "Get a comment", "Get a thread", "Create a comment". Go to the Liveblocks dashboard, open your project and go to "Webhooks". Create a new webhook in your project using a placeholder URL, and selecting "commentCreated" events. Copy your webhook secret from this page and paste it into the "Liveblocks Trigger" node. Expose the webhook URL from the trigger, for example with localtunnel or ngrok. Copy the production URL from the "Liveblocks Trigger" and replace localhost:5678 with the new URL. Your workflow is now set up! Tag @AI Assistant in the application to trigger it.
Localtunnel The easiest way to expose your webhook URL: npx localtunnel --port 5678 --subdomain your-name-here This creates a URL like: https://honest-months-fix.loca.lt The URL you need for the dashboard looks like this: https://honest-months-fix.loca.lt/webhook/9cc66974-aaaf-4720-b557-1267105ca78b/webhook `
Related Templates
Automate Daily Keyword Research with Google Sheets, Suggest API & Custom Search
Who's it for This workflow is perfect for SEO specialists, marketers, bloggers, and content creators who want to automa...
USDT And TRC20 Wallet Tracker API Workflow for n8n
Overview This n8n workflow is specifically designed to monitor USDT TRC20 transactions within a specified wallet. It u...
Add product ideas to Google Sheets via a Slack
Use Case This workflow is a slight variation of a workflow we're using at n8n. In most companies, employees have a lot o...
🔒 Please log in to import templates to n8n and favorite templates
Workflow Visualization
Loading...
Preparing workflow renderer
Comments (0)
Login to post comments