Answer with your own AI

Autoobot carries the messages both ways and keeps the channels safe; your model writes every word.

How it works

  1. Set the asset’s automatic replies to Your system (or PATCH /api/assets/{id}/automation with {"mode": "external"}): Autoobot sends nothing automatic there.
  2. A person writes: your webhook gets message.received or comment.received.
  3. Your server answers the webhook at once (2xx), then asks your model.
  4. You send the reply: POST /api/conversations/{id}/messages, with the event’s id as Idempotency-Key.
  5. Autoobot sends it at the channel’s pace; your team sees it in the inbox, marked «via API».

Example server

Node.js (Express)
import express from 'express';
import { verify } from './verify.js'; // see Webhooks › Check the signature

const app = express();
app.post('/autoobot', express.raw({ type: 'application/json' }), async (req, res) => {
  if (!verify(req.body.toString(), req.get('Autoobot-Signature') || '', process.env.AUTOOBOT_WEBHOOK_SECRET)) return res.sendStatus(401);
  res.sendStatus(200); // answer at once; the event is sent once
  const event = JSON.parse(req.body);
  if (event.type !== 'message.received' && event.type !== 'comment.received') return;

  const reply = await myModel({ text: event.data.message.text, person: event.data.conversation.contact.name, channel: event.data.asset.channel });
  const response = await fetch(`https://autoobot.com/api/conversations/${event.data.conversation.id}/messages`, {
    method: 'POST',
    headers: { Authorization: `Bearer ${process.env.AUTOOBOT_KEY}`, 'Content-Type': 'application/json', 'Idempotency-Key': event.id },
    body: JSON.stringify({ text: reply }),
  });
  if (response.status === 409) return; // a person on the team took over: let them answer
});
app.listen(3000);

What to do when…

AnswerMeaningDo
409 conversation_pausedA person on your team stepped in.Stay quiet; the conversation.handoff event tells when the bot resumes.
422 outside_reply_windowThe person last wrote too long ago.Wait for them to write again.
402 reply_limit_reachedThe asset’s package has no replies left.Make it Unlimited in Autoobot › Billing.
429 rate_limitedOver 5 requests a second.Wait for Retry-After and send again with the same Idempotency-Key.
Give your model the conversation, not only the last message: GET /api/conversations/{id}/messages?limit=20. Contacts’ fields and labels (GET /api/contacts/{id}) help it personalise.