Skip to content
Threadwire Docs

Type to search every guide and API endpoint.

Features

The AI agent

Let an AI agent answer your WhatsApp customers from what you tell it about your business, with your own Anthropic, OpenAI or Google Gemini key.

An instance can answer people who write to it by itself, with AI, from what you tell it about your business. It uses your own Anthropic, OpenAI or Google Gemini API key: the AI's cost is on your account with that provider, and Threadwire adds nothing to it. Set a monthly spending limit with your provider.

Watch the 1-minute video: how it answers and hands over, in a demo with made-up chats.

Every answer is an ordinary reply from the instance, like any message it sends: "typing…" first, the reply's pace, and its protection when that is on. It never writes first to anyone.

What it answers, and when

  • A text someone just wrote to the instance, one to one. Never a group, a channel, a status, a file (even with a caption: the AI cannot see it), someone who wrote "STOP", the instance's own chat, another of your instances, or a message more than 15 minutes old.
  • Your keyword auto-replies answer first. When one answers a message, or the same keyword was answered moments ago, the AI says nothing: one answer per message. An away or welcome auto-reply that answers wins the same way.
  • With a menu of choices on, the menu is shown first and a choice is the menu's. The AI answers what is not a choice. After a choice hands the chat to your team, the AI stays quiet there until your team answers or marks it done, for 24 hours at most.
  • When: always, only outside_hours (your working_hours, in the instance's own time zone), or no_reply: only when nobody on your team answered within wait_minutes.
  • It hands a chat to your team when it cannot answer for sure, or for a complaint, a refund, a payment or a request for a person. It tells them a teammate will reply soon. Then nothing automatic answers there, the AI or an auto-reply, until your team answers, a message goes to them through the API, or the chat is marked done, for 24 hours at most. Your team gets an email, at most one every 30 minutes per instance; the others wait under "Needs a reply". In the chat, its message reads "AI agent: handed over to your team".
  • Your team takes over: once a teammate answers a chat (from the panel or the phone), the AI stays quiet there for 24 hours. Messages you send through the API do not hand over, since they are often order updates; to stop it in a chat, use the panel. In the panel, "Stop AI in this chat" stops it there for good, until "Let AI answer in this chat".
  • Limits: at most daily_limit AI replies a day on the instance (yours to set, up to 2,000), and at most 8 an hour and 30 a day to one person, so it never chats on and on with another bot.
  • A few messages sent in a row get one answer, about 10 seconds after the last.

What it knows

It answers only from your about text (up to 8,000 characters: what you sell and your prices, hours, address, delivery, returns, payment), your saved answers, the instance's keyword auto-replies, the files you give it (below), and the chat's last 10 messages. It is told never to invent prices, stock, times, discounts or promises: when the answer is not there, or for a complaint, a refund, a payment or a request for a person, it says a teammate will reply soon. It replies in the language they wrote in (auto), or always in Arabic or English (language), in a friendly or formal tone.

Files it answers from. On Automations → AI agent, "Files" takes your price list, menu or policies: PDF, Word (.docx) or text files, up to 10 and 200,000 characters in all. Only their words are kept, not the files. Each answer is given all of them while they are short, or else the parts nearest the question, so longer files cost more per answer on your AI account. A scanned PDF holds pictures of words and cannot be read: copy its text into a text file. An Arabic PDF that cannot be read in order is refused: save it as Word or text. Files are added in the panel only, not through the API yet.

The chat stays under "Needs a reply" in your panel, so your team sees every question the AI answered. Its messages carry origin ai.

The API

GET /v1/instances/{id}/ai-agent
PATCH /v1/instances/{id}/ai-agent
{"enabled": true, "provider": "anthropic", "model": "claude-sonnet-5-5", "api_key": "sk-ant-…",
 "about": "We sell…", "tone": "friendly", "language": "auto", "answers": "outside_hours",
 "working_hours": {"days": [0, 1, 2, 3, 4], "from": "09:00", "to": "17:00"}, "daily_limit": 200}

Send only what changes. In working_hours, days are numbered from Sunday: 0 is Sunday, 6 is Saturday. api_key is write-only: answers show api_key_set and api_key_last4, never the key. models in the answer lists the models you may choose for each provider (anthropic, openai, gemini). Turning it on needs a key; changing provider needs that provider's key. PATCH needs a full-access key.

A Gemini key comes from aistudio.google.com.

When it stops

If your provider refuses the key, your AI account has no credit, or the model is not open to your key, the agent pauses: it answers nobody, paused says why, Automations → AI agent in your panel says why, and your admins get an email. Fix it, then save the settings again (PATCH with any field) or press "Test the key" in the panel. Any other failure (the provider slow or busy, or no answer it could send) skips that one message, notes it in last_error, and is never retried.

With Gemini, a used-up quota does not pause the agent: Google answers it as it answers a passing limit. Each message is then skipped, and last_error and the panel say Google is limiting your key.

Your data

When the AI agent is on, the chat's recent messages and your business text go to the provider you chose, under your own account with them, to write each answer. We keep your key encrypted and your business text until you change them or remove the instance. See the Privacy Policy.

On Google's free tier, Google may use what is sent to improve its products. For your customers' chats, use a Gemini key with billing turned on.