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

# 管理 WhatsApp 电话号码

> 注册电话号码并管理主页、商业和通话设置。

## 简介

WhatsApp 商业电话号码是客户在
对话中看到的发送者身份。使用这些 API 可以发现已注册的号码、配置其
商业简介、请求更改显示名称、控制商业可见性，
以及管理特定于电话的设置。

## 开始之前

* 将父 WABA 连接到 YCloud。
* 将电话号码添加到 WABA。
* 以 E.164 格式存储 WABA ID 和电话号码。
* 在设置 `profilePictureUrl` 之前，将个人资料图片上传到 Meta。

## 工作原理

1. 列出号码或检索单个号码以检查其状态。
2. 在使用号码发送消息之前注册该号码。
3. 更新面向客户的商业简介。
4. 根据需要更新显示名称、商业可见性或呼叫设置。
5. 再次检索资源以确认当前配置。

显示名称的更改和某些平台设置可能需要 Meta 的异步
处理。

## 请求

### 注册电话号码

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl --request POST \
  https://api.ycloud.com/v2/whatsapp/phoneNumbers/WABA_ID/+16315551111/register \
  --header "X-API-Key: $YCLOUD_API_KEY"
```

### 更新商业简介

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl --request PATCH \
  https://api.ycloud.com/v2/whatsapp/phoneNumbers/WABA_ID/+16315551111/profile \
  --header "X-API-Key: $YCLOUD_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{
    "about": "Customer support and order updates",
    "address": "100 Market Street",
    "description": "Example Store",
    "email": "support@example.com",
    "vertical": "RETAIL",
    "websites": ["https://example.com"]
  }'
```

### 更新商业可见性

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl --request PATCH \
  https://api.ycloud.com/v2/whatsapp/phoneNumbers/WABA_ID/+16315551111/whatsappCommerceSettings \
  --header "X-API-Key: $YCLOUD_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{
    "isCartEnabled": true,
    "isCatalogVisible": true
  }'
```

## 响应

个人资料和设置操作会返回更新后的资源。

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "about": "Customer support and order updates",
  "email": "support@example.com",
  "vertical": "RETAIL",
  "websites": ["https://example.com"]
}
```

注册操作会返回电话号码资源。请存储其 ID 并检查其
发送前的注册和质量状态。

## 配置区域

| 区域 | 用途 |
| - | - |
| 资料 | 简介文本、地址、描述、电子邮件、垂直行业、网站和头像。 |
| 显示名称 | 提交给 Meta 处理的面向客户的发送者名称。 |
| 商业 | 目录可见性和购物车控制。 |
| 设置 | 特定于电话的功能，例如 WhatsApp 呼叫。 |

## 限制与故障排除

* 个人主页字段有格式和长度限制；请参阅 API 参考以获取
  完整的约束条件。
* 网站 URL 必须包含 `http://` 或 `https://`。
* 显示名称的更新可能不会立即生效。
* 注册、质量和 WABA 状态会独立影响发送。
* 在每个路径中使用 WABA ID 和准确的 E.164 号码。

<CardGroup cols={2}>
  <Card title="列出电话号码" icon="list" href="/api-reference/whatsapp-phone-numbers/list-phone-numbers">
    发现已注册的号码及其所属的 WABA。
  </Card>

  <Card title="更新个人主页" icon="address-card" href="/api-reference/whatsapp-phone-numbers/update-a-phone-number-profile">
    检查每个个人主页字段和约束条件。
  </Card>
</CardGroup>


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