> ## Documentation Index
> Fetch the complete documentation index at: https://docs.jelou.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# WhatsApp numbers

> Buy a US number for WhatsApp from the CLI, read Meta's verification code by SMS and connect it to a project.

`jelou phone-numbers` manages the WhatsApp numbers your company buys through
Jelou: US numbers (`+1`) billed with your plan. With these commands you check
whether you can buy, buy a number, read the SMS with Meta's verification code
and release numbers you no longer use.

| Subcommand | Description |
| - | - |
| `capability` | Tells you whether your company can buy a number now and whether the purchase costs anything |
| `list` | Lists numbers, open lines and released numbers |
| `messages <id>` | Shows the SMS a number received (Meta's code arrives here) |
| `buy --phone <+1…>` | Buys a number (shows the cost and asks for confirmation) |
| `delete <id>` | Releases a number for good (asks for confirmation) |

<Warning>
  For WhatsApp, always use `jelou phone-numbers buy`. `jelou voice numbers buy --provider twilio` buys numbers for the voice service: it does not go through
  your plan and the number does not work for WhatsApp.
</Warning>

## From number to connected channel

<Steps>
  <Step title="Check whether you can buy">
    ```bash theme={null}
    jelou phone-numbers capability
    ```

    It buys nothing. It tells you whether the purchase is allowed and what it
    would cost (see [Purchase cost](#purchase-cost)).
  </Step>

  <Step title="Find an available number">
    ```bash theme={null}
    jelou voice numbers search --provider twilio --country US
    jelou voice numbers search --provider twilio --country US --area-code 415
    ```

    It only queries the provider's inventory; it buys nothing.
  </Step>

  <Step title="Buy the number">
    ```bash theme={null}
    jelou phone-numbers buy --phone +14155550100
    ```

    The CLI shows the cost and asks for confirmation. Once you confirm, the
    number is bought right away and you get its `id`.
  </Step>

  <Step title="Connect it to WhatsApp">
    ```bash theme={null}
    jelou channels activate whatsapp --phone-number 42 --project 01H2XCEJQTG2H5V5NKCYW3J7Z2 --name "Sales WhatsApp"
    ```

    The WhatsApp activation opens in Jelou with the number already selected.
    While you complete Meta's sign-in, the CLI prints the SMS with the
    verification code in the terminal and finishes when that number's channel
    is connected.
  </Step>
</Steps>

## Purchase cost

The purchase is charged according to your company's plan:

| Plan | What happens when you buy |
| - | - |
| Self Service | Each number uses a **phone line** that is added to your subscription. It is charged right away to the subscription's payment method and on every following invoice. |
| Self Service with an open line | If you already paid for a line that has no number yet, the purchase reuses it and there is no new charge. |
| Other plans | The number is included in the plan; there is no charge. |

Before you confirm, `buy` shows you which of the three cases applies and, if
there is a charge, the price of the line. If it cannot read the price, it does
not buy.

The purchase also depends on your plan's channels: if you have used them all,
`capability` and `buy` tell you so and nothing is bought.

## `jelou phone-numbers capability`

```bash theme={null}
jelou phone-numbers capability
jelou phone-numbers capability --json
```

It shows:

* whether you can buy now;
* the cost of the next purchase (included in the plan, line already paid for, or new line);
* open lines (paid for, with no number);
* connected channels against your plan's limit;
* numbers that have no channel yet.

## `jelou phone-numbers list`

```bash theme={null}
jelou phone-numbers list
jelou phone-numbers list --status active
```

Lists the company's numbers, newest first. `--status` filters by state:

| State | Meaning |
| - | - |
| `active` | A bought number. If it has no channel, it is ready for `channels activate`. |
| `open` | A paid line that has no number yet. The next purchase uses it. |
| `released` | A released number. It no longer belongs to you. |

## `jelou phone-numbers messages`

```bash theme={null}
jelou phone-numbers messages 42
```

Shows the SMS the number received since you bought it, newest first (up to
20\). When Meta verifies the number, the code arrives here. If you just asked
for the code and it does not show up, wait a few seconds and run the command
again.

## `jelou phone-numbers buy`

```bash theme={null}
jelou phone-numbers buy --phone +14155550100
```

| Flag | Description |
| - | - |
| `--phone <+1…>` | US number in E.164 format (`+1` and 10 digits). Required. |
| `--yes` | Skips the confirmation |

<Tip>
  If the purchase fails because the payment or the purchase is still pending
  confirmation, run the same command again after a few seconds. Repeating it
  never charges or buys twice.
</Tip>

Common errors:

| Case | What to do |
| - | - |
| The plan does not include WhatsApp numbers | Check your plan or your subscription. |
| No channels left on the plan | Release a number you do not use or upgrade your plan. |
| The payment was declined or there is no payment method | Add or update the payment method in billing settings. Nothing was charged. |
| The number was already taken | Pick another one with `jelou voice numbers search`. |
| The phone line has no price for your plan yet | Contact the Jelou team. |

## `jelou phone-numbers delete`

```bash theme={null}
jelou phone-numbers delete 42
```

Releases the number: it goes back to the provider and, on Self Service, its
line stops being charged from the next invoice (the current period is not
refunded). Only active numbers with no channel can be released; if the number
is connected, delete or disconnect that channel first.

<Warning>
  Releasing a number cannot be undone: you cannot get it back afterwards.
</Warning>

## Connect the number with `channels activate`

`--phone-number` makes `jelou channels activate whatsapp` work on a number
bought with `phone-numbers buy`:

* The WhatsApp activation opens in Jelou with that number already selected.
* While you wait, the CLI prints in the terminal every SMS the number receives,
  including Meta's code.
* The wait ends when **that** number is connected, not when any other WhatsApp
  channel of the company shows up.

| Flag | Description |
| - | - |
| `--phone-number <id>` | A number bought with `phone-numbers buy` |
| `--project <id>` | Project preselected in the activation |
| `--name <name>` | Channel name prefilled in the activation |
| `--watch` | Does not open the browser; only waits for the number to connect |
| `--timeout <seconds>` | Maximum wait time (default: 600) |

`--project` and `--name` only prefill the activation: you can change them there
before finishing.

```bash theme={null}
jelou channels activate whatsapp --phone-number 42
jelou channels activate whatsapp --phone-number 42 --watch --timeout 900 --json
```

When it finishes, the CLI returns the new channel's `channel_id`, `bot_id` and
project. The `bot_id` is the one used by
[`jelou template` and `jelou campaign`](/en/guides/cli/whatsapp).

<Note>
  If the number already has a channel, `activate --phone-number` fails before
  opening the browser and returns that channel's id. With `--watch`, instead, it
  finishes right away with that channel as the result.
</Note>

## Use from an agent

With `--agent` or `--no-input`, `buy` and `delete` require `--yes`. An agent
should read `capability`, show the cost to the user and pass `--yes` only after
the user agrees.

```bash theme={null}
jelou phone-numbers capability --json
jelou phone-numbers buy --phone +14155550100 --yes --json
jelou channels activate whatsapp --phone-number 42 --watch --json
```

In JSON mode, `buy` adds a `charge` field with the kind of charge (`included`,
`open_line` or `new_line`) and, when there is a charge, the price. When a
purchase is left pending, the error is `TRANSIENT_ERROR` with
`retryable: true`: the agent can repeat the same command with no risk of a
double charge.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.