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.
This workflow requires a Comments app installed and webhooks set up in the Liveblocks dashboard. You can try it with a demo application:
database.ts inside the example and uncomment the AI assistant user.localtunnel or ngrok. Copy the production URL from the "Liveblocks Trigger" and replace localhost:5678 with the new URL.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