Skip to content
Docs menu

A bot's own phone number

Give a bot one of your org's SMS or WhatsApp numbers. A text to it starts a run, and the bot's answer goes back as a text from the same number, to you only or to anyone you allow.

View .md

A bot can have a phone number of its own. Text it from your phone ("what is on my calendar today?", "add Ana from Orbit to People"), and the bot answers by text from that number a few seconds later. Each text starts a run of the bot, like any of its routines, and its transcript is in the bot's run history.

The number is one of your org's Comms senders: an SMS or WhatsApp number your org already has from its provider, or a new one you rent through your own Sinch account without leaving Petawork (Get a new number).

Give a bot a number

Open the bot's page and go to Phone number. Pick one of the org's free numbers and press Use this number.

  • Only the bot's owner sees its number, like everything else about a bot.
  • Giving a bot a number, or taking it away, needs the right to manage Comms, which org owners and admins have. Since a bot is private to its owner, a member without that right cannot give their own bot a number.
  • A free number is an E.164 phone number that carries SMS or WhatsApp, is not already another bot's, does not feed Support or People (Settings, Comms, Senders), and is not the Petawork Line's. A bot's number cannot be routed to a product, or answer the Line, until it is removed from the bot.
  • If the org has no free number, add one under Settings, Comms, Senders.

A number comes with a routine named Messages to its number, listed with the bot's other routines. You can change its instruction (what the bot does with a text) and turn it off. It goes when the number goes; it cannot be made, run by hand or deleted on its own.

Get a new number

When the bot has no number, an owner or admin can rent one for it through the org's Sinch account (or the fake provider, to try it out). On the bot's page, under Phone number, press Get a new number. A dialog (a full-width sheet on a phone) walks through three steps:

  1. Choose. The country (the list is whatever your Sinch account offers, your browser's country first), the type (Mobile, Local or Toll-free, as that country has them), what the number must do (Texts, Calls or both) and, if you like, digits it should contain. Search shows up to 10 numbers with their setup and monthly prices. Pick one and press Continue: Sinch holds it for you for a while (the dialog shows until when).
  2. Details, only when the country's rules ask for them. The form is the one Sinch publishes for that country and number type (company details, a contact person, what the number is for), plus any documents it asks for, such as a proof of address. Petawork checks each answer before sending it. The answers are stored encrypted and sent only to Sinch; documents go to Sinch and are not kept. With Remember these details for the next number ticked (the default), the next order for the same country and type starts filled in, so a second bot's number is a search and one click.
  3. Confirm. The number, the setup price, the monthly price (billed by Sinch to your own account), and Order number, which asks once more before it spends money.

Where no review is needed, the number arrives at once. Otherwise the bot's page shows In review with Sinch, with Check now. How long a review takes depends on Sinch and the country. If Sinch needs changes, the page shows its reviewer's note and Fix details, which reopens the form; a rejected order shows Sinch's reason, and a reservation that runs out says to pick another number. Closing the dialog keeps the order; opening it again resumes at the right step, or you can cancel an order Sinch has not started reviewing.

When the order completes, Petawork checks the number is active in your Sinch account, adds it as a Comms sender labelled with the bot's name (texts as SMS, calls as voice), and gives it to the bot, unless the bot got another number meanwhile. Petawork follows an order by itself: Sinch's notice to …/numbers and a check every five minutes read the order back from Sinch.

Settings, Comms, Numbers lists the numbers rented this way and the orders under way, with the bot, the state, the monthly price and the next charge date when Sinch gave it. Release gives a number back to Sinch for good: you cannot get it back, and its bot stops answering. Removing a number from a bot (above) keeps it in Comms; releasing is the separate step.

Set up Sinch once

Two one-time steps in the Sinch dashboard, then paste the ids in Settings, Comms, on the Sinch provider:

  • Texts: in SMS, Service APIs, link a service plan to your Conversation app, and paste its id as SMS service plan ID.
  • Calls: in Voice, Apps, create a voice application, and paste its key and secret as Voice application key and secret (see Comms providers).

Until one of them is set, the bot page says what is missing instead of offering the button; with only one set, the other choice in the dialog is turned off and says why.

Singapore

The countries shown are whatever your Sinch account offers; Petawork has no list of its own. If it offers Singapore (+65) numbers: texts to Singapore mobiles from a number that is not registered with SGNIC's SMS Sender ID Registry are labelled Likely-SCAM or blocked by the carriers. Registration is done by your company with SGNIC and needs a UEN. Calls are not affected.

Who it answers

Answers Who can start a run
Only me (default) Texts from your own phone, once you verified it. Texts from anyone else stay in Comms and start nothing.
Anyone Anyone who texts the number, up to the daily limit you set (50 by default, at most 1,000) and 20 a day per person. Days are UTC. Your own verified phone is never limited.

Verify your phone

The bot knows it is you by your verified phone. Verify it in the bot's Phone number section: type your mobile number in international form (+15551234567), press Text me a code, then type the code from the text and press Verify. The code is sent through your org's Comms provider, lasts 10 minutes and allows five tries; you can ask for a new one after a minute. Once verified, the section shows your number with Change.

It is the same verified phone Incidents pages you on. Until you verify one, a bot that answers only you answers nobody.

A phone number can be forged. So a run a text started never acts on its own: before any destructive tool it waits for you, whatever the bot's autonomy is. The text and the conversation before it are given to the bot as untrusted data, never as instructions.

What a run is given, and what goes back

The run gets the routine's instruction, the bot's memory if it keeps one, and the last 12 messages between that person and this number, oldest first, with the newest one marked. Long messages are cut.

When the run finishes, its answer goes back to the person on the same channel (SMS or WhatsApp) and from the same number, as plain text: headings, bold and links become plain words. An SMS answer is cut at 1,200 characters and a WhatsApp answer at 3,500, ending with "…". The run's steps show where it went.

When the person is you:

  • a run that needs your OK texts you once, with a link to the bot's page, where you approve or decline it under Needs you;
  • a run that fails texts you a short line with the same link.

Nobody else ever gets those texts. A run that is skipped (the bot is off, its daily spending cap is reached, it has three runs going) sends nothing.

STOP and START are handled by Comms itself, never by the bot. A reply someone else is waiting on, such as a page asking for "1", is not given to the bot either.

Outreach from its number

When a bot with a number reaches out by SMS or WhatsApp through Comms, the message goes out from its own number, so replies come back to it. Without a number, Comms picks the sender as before.

API and MCP tools

Method and path MCP tool What it does
GET /api/workspace/agents/bots/{id}/number agents_bot_number_get The number, who it answers, today's count, whether your phone is verified, and the org's free numbers when you manage Comms
PUT /api/workspace/agents/bots/{id}/number agents_bot_number_set {sender_id} gives the bot a number; {answer, daily_replies} changes who it answers
DELETE /api/workspace/agents/bots/{id}/number agents_bot_number_remove Takes the number away, with its routine
POST /api/workspace/agents/bots/{id}/number/phone none {phone, tz} texts a code to your own phone
PUT /api/workspace/agents/bots/{id}/number/phone none {code} verifies it
GET /api/workspace/comms/numbers comms_number_order_list Which provider sells numbers and what a new one can carry, and the org's orders (?bot_id=, ?open=1)
GET /api/workspace/comms/numbers/regions comms_number_region_list The countries and types the Sinch account offers
GET /api/workspace/comms/numbers/search comms_number_search ?region=&type=&sms=1&voice=1&contains=: up to 10 numbers with prices
POST /api/workspace/comms/numbers/orders none {phone, region, type, capabilities, bot_id?} holds the number
GET /api/workspace/comms/numbers/orders/{id} comms_number_order_get The order; the console's route also returns the form and your answers
PUT /api/workspace/comms/numbers/orders/{id}/details none {answers} checks, stores and sends the form
POST /api/workspace/comms/numbers/orders/{id}/attachments/{attachment} none A document (multipart file, up to 10 MB)
POST /api/workspace/comms/numbers/orders/{id}/submit none {remember?} orders the number
POST /api/workspace/comms/numbers/orders/{id}/refresh none Reads the order back from Sinch
DELETE /api/workspace/comms/numbers/orders/{id} none Cancels an order Sinch is not reviewing
POST /api/workspace/comms/numbers/orders/{id}/release none Gives the number back to Sinch for good

Holding, ordering, sending documents, cancelling and releasing have no MCP tool: they spend the org's money or carry a person's own identity or company documents, so a person does them. The comms_number_* tools read, and never return the details sent to Sinch; looking up countries and numbers needs the credential of a member who manages Comms.

The phone routes act only on the caller's own phone and have no MCP tool: a code proves a person holds the phone, and an agent has none. A second code within a minute answers 429, a wrong code 400 wrong_code, an expired one 400 code_expired.

An agent acting for you, a bot's own run among them, cannot give or take a number, let it answer anyone, or raise its daily limit. Someone else's bot answers 404 not_found; a sender that is not free answers 409 sender_unavailable, and routing a bot's number to Support or People, or giving it to the Line, answers 409 sender_is_bot_number. Changes are in the audit log as agents.bot_number_set, agents.bot_number_updated and agents.bot_number_removed, with the number masked; rented numbers as comms.number_reserved, comms.number_submitted, comms.number_completed and comms.number_released (masked, never the details).