{"bot":"DocToWeb AI Bot","totalTools":40,"totalCategories":15,"categories":[{"title":"Records & Contracts (Doc2Web)","blurb":"CRUD on your forms, contracts, and submitted records inside Doc2Web.","ready":true,"requiredSecrets":[],"tools":[{"name":"list_forms","description":"List all forms with their formKey, name, field count and record count. Use this to discover what forms exist before any other call.","isWrite":false},{"name":"list_contracts","description":"List all contracts with their contractKey, name, field count and record count.","isWrite":false},{"name":"get_schema","description":"Return the field schema (name, label, type, options) for one form or contract. Always call this before create_record / update_record so you know which keys to use.","isWrite":false},{"name":"list_records","description":"List records for one form or contract, newest first. Use limit to keep responses small (default 25, max 200).","isWrite":false},{"name":"get_record","description":"(tool not found — possibly removed)","isWrite":false,"missing":true},{"name":"create_record","description":"Create (or upsert) a record. Pass `data` as a flat object keyed by field name. The server AI-normalizes it against the schema, so loose keys like 'Customer Name' will be coerced to 'customer_name'. If `clientUuid` is provided and already exists, the record is updated.","isWrite":true},{"name":"update_record","description":"Patch a single record's fields. Reads the existing row, merges your `patch` into it, and writes the merged data back. Identifier is the (kind,key,clientUuid) triple.","isWrite":true},{"name":"delete_record","description":"Delete one record by (kind, key, clientUuid). Returns the count of deleted rows.","isWrite":true},{"name":"delete_all_records","description":"DESTRUCTIVE — delete every record for one form or contract. The schema itself is preserved. Confirm with the user before calling this.","isWrite":true},{"name":"ensure_signature_section","description":"Add a default signer block (printed name + date + location + handwritten signature canvas) to a contract. By default this is a no-op when the contract already has at least one signable field — pass force=true to add an additional signer. Returns { added, suffix, addedFieldNames }.","isWrite":true}],"examples":["Show me all contracts I have set up","How many records are in the 'client_intake' form?","Create a new contract record in 'service_agreement' with client name = Acme Corp, value = 5000","Update record abc123 in 'invoices' to status = paid"]},{"title":"Maps & Locations","blurb":"Render embedded maps inline in chat. Powered by Google Maps.","ready":true,"requiredSecrets":[{"key":"GOOGLE_MAPS_API_KEY","configured":true}],"tools":[{"name":"create_map_embed","description":"Create an embeddable Google Map for a place, address, or search query. Returns { embedUrl, iframeHtml, width, height } — the chat UI will render the map inline. Use mode='place' for a single named location (default), 'search' for nearby-results style ('coffee near Eiffel Tower'), or 'view' for a raw lat/lng viewport. Pass `zoom` (1-21) to control how zoomed-in the map is.","isWrite":false}],"examples":["Show me a map of 1600 Pennsylvania Ave","Where is the Twilio office in San Francisco?","Give me directions from Times Square to JFK Airport"]},{"title":"Google Calendar","blurb":"List, read, and create events on your Google Calendar — including Google Meet links.","ready":true,"requiredSecrets":[{"key":"(Google Calendar OAuth integration)","configured":true}],"tools":[{"name":"list_calendars","description":"List the user's Google Calendars (calendarList). Returns { count, calendars: [{id, summary, primary, accessRole, timeZone}] }. Call this first to discover calendar IDs before listing or creating events on a non-primary calendar.","isWrite":false},{"name":"list_calendar_events","description":"List events from a Google Calendar within an optional time window. Defaults to the primary calendar, next 7 days, ordered by start time. timeMin/timeMax must be RFC3339 (e.g. '2026-05-17T00:00:00Z'). Returns { count, events: [{id, summary, start, end, htmlLink, location, description}] }.","isWrite":false},{"name":"create_calendar_event","description":"Create a Google Calendar event. start/end must be RFC3339 (e.g. '2026-05-20T14:00:00-07:00'). For all-day events pass start/end as 'YYYY-MM-DD'. If the user identifies an exact saved Page ID for this event, pass savedPageKeyId so its calendar overlay can find it; never infer a page from calendar alone. Returns the created event's { id, htmlLink, summary, start, end }.","isWrite":true}],"examples":["What's on my calendar this week?","Book a 30-min meeting with sarah@example.com on Friday at 2pm with a Google Meet link","Show me my next 5 events"]},{"title":"Twilio SMS & Voice","blurb":"Send SMS and place voice calls (Twilio reads text out via TwiML <Say>).","ready":true,"requiredSecrets":[{"key":"TWILIO_ACCOUNT_SID","configured":true},{"key":"TWILIO_AUTH_TOKEN","configured":true},{"key":"TWILIO_PHONE_NUMBER","configured":true}],"tools":[{"name":"send_sms","description":"Send an SMS message via Twilio. `to` must be E.164 (e.g. '+14155552671'). The 'from' number is the Twilio number configured in TWILIO_PHONE_NUMBER. Returns { sid, status, to, from, body }.","isWrite":true},{"name":"list_sms_messages","description":"List recent Twilio SMS messages (inbound and outbound). Optionally filter by `to` or `from` (E.164). Returns { count, messages: [{sid, direction, from, to, body, status, dateSent}] }.","isWrite":false},{"name":"make_phone_call","description":"Place an outbound phone call via Twilio. Provide EITHER `message` (text to be spoken via Twilio <Say>) OR `twimlUrl` (URL returning TwiML). `to` must be E.164. Returns { sid, status, to, from }.","isWrite":true},{"name":"list_phone_calls","description":"List recent Twilio phone calls. Optionally filter by `to`/`from` (E.164). Returns { count, calls: [{sid, direction, from, to, status, duration, startTime}] }.","isWrite":false}],"examples":["Text +14155551234 saying 'Your contract is ready to sign at <link>'","Show me the last 10 SMS I sent","Call +14155551234 and say 'Hi this is a reminder for your 2pm appointment'"]},{"title":"Twilio RCS & Rich Content Templates","blurb":"Cross-channel rich messaging (RCS / WhatsApp / SMS fallback) using Twilio Content API templates.","ready":true,"requiredSecrets":[{"key":"TWILIO_ACCOUNT_SID","configured":true},{"key":"TWILIO_AUTH_TOKEN","configured":true},{"key":"(A Twilio Messaging Service with RCS Agent attached)","configured":true}],"tools":[{"name":"list_messaging_services","description":"List Twilio Messaging Services on the account. A Messaging Service is the container that bundles senders (SMS long codes, short codes, toll-free, RCS Agents, WhatsApp senders) and enables cross-channel routing including RCS-with-SMS-fallback. Returns { count, services: [{sid, friendlyName, useCase, inboundRequestUrl, statusCallback, useInboundWebhookOnNumber}] }. The `sid` (starting 'MG') is what you pass to send_rich_message as messagingServiceSid.","isWrite":false},{"name":"list_content_templates","description":"List Twilio Content API templates (rich message templates that work across RCS, WhatsApp, and SMS with graceful fallback). Returns { count, templates: [{sid, friendlyName, language, variables, types}] }. Use the returned `sid` (starts 'HX...') as contentSid in send_rich_message.","isWrite":false},{"name":"create_content_template","description":"Create a Twilio Content API template (rich message that works across WhatsApp, RCS, SMS with automatic fallback). Returns { sid, friendlyName, types, approvalNote }. The returned `sid` (HX...) is used as contentSid in send_rich_message and send_whatsapp_via_twilio. IMPORTANT: For WhatsApp use, the template must be SUBMITTED FOR APPROVAL separately in Twilio Console → Messaging → Content Editor → click your template → 'Submit for WhatsApp approval' (1-24h review). For RCS/SMS, the template works immediately without approval. Use `{{1}}`, `{{2}}` etc as variable placeholders in any text/title/url field. Common `types` patterns:\n• PLAIN TEXT — `{\"twilio/text\": {\"body\": \"Hi {{1}}, your order {{2}} ships tomorrow\"}}`\n• QUICK REPLY (tappable reply buttons, max 3) — `{\"twilio/quick-reply\": {\"body\": \"Are you available?\", \"actions\": [{\"id\": \"yes\", \"title\": \"Yes\"}, {\"id\": \"no\", \"title\": \"No\"}]}}`\n• CALL TO ACTION (URL/phone buttons, max 2) — `{\"twilio/call-to-action\": {\"body\": \"Tap to view\", \"actions\": [{\"type\": \"URL\", \"title\": \"View Contract\", \"url\": \"https://example.com/{{1}}\"}, {\"type\": \"PHONE_NUMBER\", \"title\": \"Call us\", \"phone\": \"+14155552671\"}]}}`\n• CARD (image + title + subtitle + buttons) — `{\"twilio/card\": {\"title\": \"{{1}}\", \"subtitle\": \"Your contract is ready\", \"media\": [\"https://example.com/preview.jpg\"], \"actions\": [{\"type\": \"URL\", \"title\": \"Sign\", \"url\": \"https://...\"}]}}`\nYou can combine multiple `types` in one template (e.g. include both twilio/text and twilio/quick-reply) — Twilio picks the richest format the destination channel supports.","isWrite":true},{"name":"send_rich_message","description":"Send a message via a Twilio Messaging Service, which enables RCS-first delivery with automatic SMS/MMS fallback. Required: `to` (E.164) plus `messagingServiceSid` (from list_messaging_services). For rich content (cards, quick reply buttons, media carousels) pass `contentSid` (from list_content_templates) and optionally `contentVariables` for template substitution. For plain text, pass `body`. NOTE: RCS delivery requires (a) a Messaging Service with an approved RCS Agent attached, AND (b) the recipient's device/carrier supports RCS — Twilio handles routing transparently. Returns { sid, status, to, body, messagingServiceSid }.","isWrite":true}],"examples":["Create a quick-reply template called appointment_reminder asking 'Can you make it on {{1}}?' with buttons Yes / Reschedule / Cancel","List all my Messaging Services","Send rich message with template HX... to +14155551234 via my Messaging Service"]},{"title":"WhatsApp (via Twilio)","blurb":"Send WhatsApp messages through your Twilio account — unified billing with SMS/RCS.","ready":true,"requiredSecrets":[{"key":"TWILIO_ACCOUNT_SID","configured":true},{"key":"TWILIO_AUTH_TOKEN","configured":true},{"key":"TWILIO_WHATSAPP_FROM","configured":true}],"tools":[{"name":"send_whatsapp_via_twilio","description":"Send a WhatsApp message via Twilio (alternative to the Meta direct send_whatsapp_message — same channel, different provider). Uses the WhatsApp-enabled sender configured in TWILIO_WHATSAPP_FROM (e.g. Twilio sandbox '+14155238886' or your approved WA Business sender). Recipient `to` must be E.164 WITH '+' (e.g. '+14155552671') — the tool adds the 'whatsapp:' prefix. WhatsApp 24h customer-care window applies: freeform `body` only works if recipient messaged you in the last 24h. Outside that window, pass `contentSid` referencing a pre-approved WA template. Returns { sid, status, to, from, body }.","isWrite":true}],"examples":["Send WhatsApp to +14155551234 saying 'Your appointment is confirmed for Friday'","Send the appointment_reminder template (contentSid HX...) to +14155551234 with name=Sarah, time=Friday 3pm"]},{"title":"WhatsApp (via Meta direct)","blurb":"Send WhatsApp messages directly through Meta's Cloud API — no Twilio middleman.","ready":false,"requiredSecrets":[{"key":"META_ACCESS_TOKEN","configured":false},{"key":"WHATSAPP_PHONE_NUMBER_ID","configured":false}],"tools":[{"name":"send_whatsapp_message","description":"Send a freeform WhatsApp text message via Meta's WhatsApp Cloud API. NOTE: WhatsApp only allows freeform text inside the 24-hour customer service window (i.e. the recipient messaged you within the last 24h). Outside that window, use send_whatsapp_template. `to` must be E.164 without the leading `+` per Meta's API (e.g. '14155552671'). Returns { messageId, to }.","isWrite":true},{"name":"send_whatsapp_template","description":"Send a pre-approved WhatsApp template message (the only way to message a user outside the 24h window). Templates must be approved in Meta Business Manager beforehand. `components` is an optional array of template parameter blocks per Meta's API. Returns { messageId, to }.","isWrite":true}],"examples":["Send WhatsApp to 14155551234 (no +) saying 'Welcome aboard!'","Send the order_confirmation template to 14155551234 with order id ORD-001"]},{"title":"Instagram","blurb":"Publish posts and manage comments on your IG Business account.","ready":false,"requiredSecrets":[{"key":"META_ACCESS_TOKEN","configured":false},{"key":"INSTAGRAM_USER_ID","configured":false}],"tools":[{"name":"post_instagram_image","description":"Publish an image post to a connected Instagram Business account. `imageUrl` must be a publicly-accessible HTTPS URL (Instagram fetches it server-side). Two-step container+publish flow handled internally. Returns { mediaId, permalink }.","isWrite":true},{"name":"list_instagram_comments","description":"List comments on an Instagram media post. Returns { count, comments: [{id, text, username, timestamp, likeCount}] }.","isWrite":false},{"name":"reply_instagram_comment","description":"Reply to an Instagram comment. Returns { id } of the new reply comment.","isWrite":true}],"examples":["Post this image https://example.com/photo.jpg to Instagram with caption 'New launch today!'","Show me recent comments on my last Instagram post","Reply to comment abc123 saying 'Thanks for the love!'"]},{"title":"Facebook Pages","blurb":"Publish posts to your Facebook Page and read engagement insights.","ready":false,"requiredSecrets":[{"key":"META_ACCESS_TOKEN","configured":false},{"key":"FACEBOOK_PAGE_ID","configured":false}],"tools":[{"name":"post_facebook_page","description":"Publish a post to a Facebook Page. Can be plain text, or text with a `link` to attach a link preview. Returns { postId }. NOTE: link previews on new posts have been deprecated by Meta as of 2024 — link will still be clickable but no rich preview card.","isWrite":true},{"name":"list_facebook_page_posts","description":"List recent posts from the configured Facebook Page. Returns { count, posts: [{id, message, createdTime, permalinkUrl}] }.","isWrite":false},{"name":"get_facebook_page_insights","description":"Get Facebook Page insights for common metrics over the last N days. Default metrics: page_impressions, page_post_engagements, page_fans. Returns raw insights.data array.","isWrite":false}],"examples":["Post 'Black Friday sale starts now!' to my Facebook Page","Show me last week's Page insights (reach, impressions, engagement)","List my recent Facebook posts"]},{"title":"Facebook Messenger","blurb":"Reply to people who messaged your Facebook Page first (cold-messaging is not allowed by Meta).","ready":false,"requiredSecrets":[{"key":"META_ACCESS_TOKEN","configured":false},{"key":"FACEBOOK_PAGE_ID","configured":false}],"tools":[{"name":"send_messenger_message","description":"Send a Messenger message from your Facebook Page to a user. `recipientPsid` is the user's Page-Scoped ID (PSID) obtained from a prior incoming message webhook — you cannot message a user who hasn't initiated contact in the last 24h without a message tag. NOTE: META_ACCESS_TOKEN must be a Page Access Token (or a System User token with pages_messaging on this page) — a plain User token will fail with permissions errors. Returns { messageId, recipientId }.","isWrite":true}],"examples":["Reply to Messenger user PSID 1234567890 with 'Thanks for reaching out, here's our pricing'"]},{"title":"Threads","blurb":"Post and read your Threads timeline (500 char limit per post).","ready":false,"requiredSecrets":[{"key":"THREADS_ACCESS_TOKEN","configured":false},{"key":"THREADS_USER_ID","configured":false}],"tools":[{"name":"post_thread","description":"Publish a text post to Threads. Two-step container+publish flow handled internally. Returns { mediaId, permalink }.","isWrite":true},{"name":"list_threads_posts","description":"List recent Threads posts from the configured user. Returns { count, posts: [{id, text, permalink, timestamp}] }.","isWrite":false}],"examples":["Post 'Just shipped a new feature 🚀' to Threads","Show me my recent Threads posts"]},{"title":"Meta Ads (read-only)","blurb":"List campaigns and pull insights — no campaign creation.","ready":false,"requiredSecrets":[{"key":"META_ACCESS_TOKEN","configured":false},{"key":"META_AD_ACCOUNT_ID","configured":false}],"tools":[{"name":"list_ad_campaigns","description":"List ad campaigns in the configured Meta ad account. Returns { count, campaigns: [{id, name, status, objective, dailyBudget, lifetimeBudget}] }.","isWrite":false},{"name":"get_ad_campaign_insights","description":"Get performance insights for an ad campaign over the last N days. Returns { insights } with impressions, clicks, spend, CTR, CPM, etc.","isWrite":false}],"examples":["List all my active ad campaigns","Show me insights for campaign 1234567890 over the last 30 days"]},{"title":"Meta Conversions API","blurb":"Send server-side Pixel events (PII must be SHA-256 hashed before passing).","ready":false,"requiredSecrets":[{"key":"META_ACCESS_TOKEN","configured":false},{"key":"META_PIXEL_ID","configured":false}],"tools":[{"name":"send_conversion_event","description":"Send a server-side conversion event to Meta Pixel (Conversions API). `eventName` is one of Meta's standard events (Purchase, Lead, CompleteRegistration, etc.) or a custom name. `userData` fields must be SHA-256 hashed for PII (email, phone, fn, ln) — pass raw strings only for non-PII fields like client_ip_address, client_user_agent, fbp, fbc. Returns { eventsReceived, fbtraceId }.","isWrite":true}],"examples":["Send a Purchase conversion event with value $99 for hashed email <hash>"]},{"title":"Fireflies.ai (meeting transcripts)","blurb":"Pull AI summaries, action items, and transcripts from your recorded meetings.","ready":true,"requiredSecrets":[{"key":"FIREFLIES_API_KEY","configured":true}],"tools":[{"name":"get_fireflies_user","description":"Get the current Fireflies account holder's profile (name, email, integrations). Useful to verify the FIREFLIES_API_KEY is wired up correctly and to discover which user the bot is acting as.","isWrite":false},{"name":"list_fireflies_meetings","description":"List recent Fireflies meeting transcripts (most recent first). Returns id, title, dateString, duration (minutes), host_email, organizer_email, participants count, and transcript_url. Use the returned id with get_fireflies_meeting to fetch full transcript / summary / action items. Filters: limit (default 10, max 50), fromDate / toDate (ISO 8601 like '2025-05-01T00:00:00Z'), mine (true = only meetings I hosted/owned).","isWrite":false},{"name":"get_fireflies_meeting","description":"Fetch a single Fireflies meeting in detail — always includes title, date, duration, participants, summary (overview, action items, keywords, topics, chapters), transcript_url, audio_url, video_url. If includeSentences=true, also includes the full transcript as an array of { speaker, text, startTime } (can be large for long meetings — only request when actually needed). If you only have a meeting title and not the id, call list_fireflies_meetings first with the title filter.","isWrite":false},{"name":"search_fireflies_meetings","description":"Search Fireflies meetings by title substring (case-insensitive). Convenience wrapper around list_fireflies_meetings with a `title` filter. Returns same shape: id, title, date, duration, etc. For semantic/content search inside transcripts, fetch candidate meetings via this then call get_fireflies_meeting with includeSentences for the most likely ones.","isWrite":false}],"examples":["What happened in my last meeting?","Summarize yesterday's call with the action items","Search Fireflies for meetings titled 'Q1 planning'","Pull the full transcript of meeting abc123 and find anything about pricing"]},{"title":"Cross-tool flows (no extra config — just ask)","blurb":"Multi-tool compositions the bot does in one turn.","ready":true,"requiredSecrets":[],"tools":[],"examples":["Turn my last Fireflies meeting's action items into tasks in my 'follow_ups' contract","Draft a contract from yesterday's discovery call (Fireflies → Doc2Web)","Schedule a follow-up event for next Tuesday with everyone from that meeting and include the transcript URL","Text Sarah a 2-sentence summary of our call (Fireflies → Twilio SMS)"]}],"howToCall":{"endpoint":"POST /api/ai/agent","auth":"X-AI-Bot-Token header (mint via GET /api/ai/agent/session from same origin) or Bearer AI_AGENT_API_KEY","body":{"messages":[{"role":"user","content":"<your prompt>"}],"provider":"anthropic | openai | gemini (optional)"}}}