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

# 快速开始

> 运行 GOWA, 配对 WhatsApp 帐户，并在几分钟内发送您的第一条消息。

## 1. 启动服务器

> [tab] 停靠栏
>
> ```bash theme={null}
> docker run -d --name gowa \
>   -p 3000:3000 \
>   -v gowa_storages:/app/storages \
>   -v gowa_statics:/app/statics \
>   -e APP_BASIC_AUTH=admin:changeme \
>   aldinokemal2104/go-whatsapp-web-multidevice:latest
> ```
>
> 图像的默认命令是 `rest`，所以不需要参数。相同的图像发布为 `ghcr.io/aldinokemal/go-whatsapp-web-multidevice` 。

> [tab] 二进制文件
>
> 从 [最新稳定版本](https://github.com/aldinokemal/go-whatsapp-web-multidevice/releases/latest)下载您的平台的归档。 此示例使用了v9.9.0 Linux amd64归档。替代您下载的文件名。
>
> ```bash theme={null}
> unzip whatsapp_9.9.0_linux_amd64.zip
> chmod +x whatsapp
> ./whatsapp rest --basic-auth=admin:changeme
> ```
>
> 首先安装 FFmpeg 和 libwebp (`cwebp`) ; GOWA 将它们用于媒体转换。

> [tab] 从来源
>
> 需要 1.26+，FFmpeg 和 libwebp
>
> ```bash theme={null}
> git clone https://github.com/aldinokemal/go-whatsapp-web-multidevice.git
> cd go-whatsapp-web-multidevice/src
> go run . rest --basic-auth=admin:changeme
> ```

检查它是在:

```bash theme={null}
curl http://localhost:3000/health
# OK
```

> [!NOTE]
>
> 默认的非回环监听地址要求配置完整的 `APP_BASIC_AUTH` 凭据。如需在本地开发时不进行身份验证，请绑定 `APP_HOST=127.0.0.1`。如果反向代理负责身份验证，可以显式设置 `APP_ALLOW_UNAUTHENTICATED=true` 来覆盖此要求。参见[身份验证](https://gowa-docs.mintlify.site/zh/authentication.md)。

## 2. 创建设备

每个WhatsApp 帐户都住在设备栏位中。创建一个帐户并给它一个你将重新使用的ID：

```bash theme={null}
curl -u admin:changeme -X POST http://localhost:3000/devices \
  -H "Content-Type: application/json" \
  -d '{"device_id": "my-device"}'
```

省略`device_id` 以获取生成的 UUID。

## 3. 配对账户

> [tab] QR code
>
> ```bash theme={null}
> curl -u admin:changeme http://localhost:3000/devices/my-device/login
> ```
>
> 在浏览器中打开 `results.qr_link`，然后在 WhatsApp 中依次进入 **已关联的设备** → **关联设备** 并扫码。二维码在 `results.qr_duration` 秒后过期；过期后请重新获取。

> [tab] Pairing code
>
> ```bash theme={null}
> curl -u admin:changeme -X POST \
>   "http://localhost:3000/devices/my-device/login/code?phone=628123456789"
> ```
>
> 在手机上输入 `results.pair_code` ，**链接设备** -> **链接电话号码** 。

> [tab] 仪表板
>
> 打开`http://localhost:3000/`，当浏览器提示时输入您的基本认证凭据，并将设备与用户界面配对。

确认设备已登录(`results.is_logged_in`应该是`true`):

```bash theme={null}
curl -u admin:changeme http://localhost:3000/devices/my-device/status
```

## 4. 发送消息

```bash theme={null}
curl -u admin:changeme -X POST http://localhost:3000/send/message \
  -H "Content-Type: application/json" \
  -H "X-Device-Id: my-device" \
  -d '{"phone": "628123456789", "message": "Hello from GOWA"}'
```

```json theme={null}
{
  "code": "SUCCESS",
  "message": "Success",
  "results": {
    "message_id": "3EB0B430B6F8F1D0E053AC120E0A9E5C",
    "status": "Message sent to 628123456789 (server timestamp: ...)"
  }
}
```

`phone` 接受包含国家代码且不带 `+` 或空格的号码，也接受完整 JID，例如 `628123456789@s.whatsapp.net`，或用于群组的 `120363025246125486@g.us`。如果只注册了一个设备，`X-Device-Id` 为可选项。

## 5. 接收消息

通过 webhook URL 重启，GOWA 将为它打开每个事件：

```bash theme={null}
export WHATSAPP_WEBHOOK_SECRET="$(openssl rand -hex 32)"
./whatsapp rest --basic-auth=admin:changeme --webhook=https://example.com/wa-hook
```

保存生成的 webhook 秘密并在接收器上配置相同的值。 重启后重用它。请参阅 [Webhooks](https://gowa-docs.mintlify.site/zh/concepts/webhooks.md) 以获取有效载荷和签名检查。

## 今后的步骤

> [card] [安装](https://gowa-docs.mintlify.site/zh/installation.md)
>
> Docker Compose, reverse proxy, PostgreSQL

> [card] [配置引用](https://gowa-docs.mintlify.site/zh/configuration.md)
>
> 每个旗帜和环境各不相同。

> [card] [多设备](https://gowa-docs.mintlify.site/zh/concepts/multidevice.md)
>
> 在一个服务器上运行几个帐户。

> [card] [API 参考](https://gowa-docs.mintlify.site/zh/api-reference/introduction.md)
>
> 所有终点。


## Related topics

- [GOWA: WhatsApp REST API](https://gowa-docs.mintlify.site/zh/index.md)
- [发送聊天状态 (键入指示器)](https://gowa-docs.mintlify.site/zh/api-reference/send/发送聊天状态-键入指示器.md)
- [获取待定密码配对状态](https://gowa-docs.mintlify.site/zh/api-reference/app/获取待定密码配对状态.md)
- [多设备与设备选择](https://gowa-docs.mintlify.site/zh/concepts/multidevice.md)
- [安装](https://gowa-docs.mintlify.site/zh/installation.md)


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