> ## 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.

# メッセージを送信中

> テキスト、メディア、連絡先、場所、リンク、投票およびプレゼンスを /send エンドポイントで送信します。

すべての例では、Basic Auth`admin:changeme`、`my-device`と呼ばれるスロット、`localhost:3000`のGOWAを想定しています。

```bash theme={null}
export GOWA=http://localhost:3000
export AUTH=admin:changeme
export DEVICE=my-device
```

## Recipients

`phone` acception:

* 国コード、`+`、スペース、ダッシュなし：`628123456789`（先頭の`+`は削除されます）。
* ユーザーJID: `628123456789@s.whatsapp.net`
* グループJID: `120363025246125486@g.us`。
* `status@broadcast` を使ってステータスの更新を投稿します。

`WHATSAPP_ACCOUNT_VALIDATION=true`（デフォルト）の場合、GOWA は送信前に、その番号が WhatsApp に登録されているか確認します。`GET /user/check?phone=628123456789` で個別に確認することもできます。

## テキスト

```bash theme={null}
curl -u $AUTH -X POST $GOWA/send/message \
  -H "Content-Type: application/json" -H "X-Device-Id: $DEVICE" \
  -d '{"phone": "628123456789", "message": "Hello!"}'
```

任意のフィールド:

| フィールド | 説明 |
| - | - |
| `reply_message_id` | 以前のメッセージを引用する。 |
| `mentions` | 例えば、 `["628111111111"]`; `"@everyone"` はグループメンバー全員に言及しています。メンションには`@`は必要ありません。 |
| `is_forwarded` | 「転送」ラベルを表示します。 |
| `duration` | メッセージタイマーは数秒で消えます: `0`, `86400` (24h), `604800` (7 d) または `7776000` (90 d). |
| `allow_reshare` | ステータス投稿のみ (`phone` = `status@broadcast`) |

成功したWhatsAppメッセージIDを返送します。

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

## メディア

メディアエンドポイントは `multipart/form-data` を取ります。ファイルをアップロードするか、GOWA がダウンロードする URL (`*_url` )を渡します。

```bash Image theme={null}
curl -u $AUTH -X POST $GOWA/send/image -H "X-Device-Id: $DEVICE" \
  -F phone=628123456789 \
  -F caption="Product photo" \
  -F image=@photo.jpg \
  -F compress=true
```

```bash Image from URL theme={null}
curl -u $AUTH -X POST $GOWA/send/image -H "X-Device-Id: $DEVICE" \
  -F phone=628123456789 \
  -F image_url=https://example.com/photo.jpg
```

```bash Document theme={null}
curl -u $AUTH -X POST $GOWA/send/file -H "X-Device-Id: $DEVICE" \
  -F phone=628123456789 \
  -F caption="Invoice" \
  -F file=@invoice.pdf
```

```bash Video theme={null}
curl -u $AUTH -X POST $GOWA/send/video -H "X-Device-Id: $DEVICE" \
  -F phone=628123456789 \
  -F caption="Demo" \
  -F video=@demo.mp4
```

```bash Voice note theme={null}
curl -u $AUTH -X POST $GOWA/send/audio -H "X-Device-Id: $DEVICE" \
  -F phone=628123456789 \
  -F audio=@note.ogg \
  -F ptt=true
```

```bash Sticker theme={null}
curl -u $AUTH -X POST $GOWA/send/sticker -H "X-Device-Id: $DEVICE" \
  -F phone=628123456789 \
  -F sticker=@cat.png
```

| Endpoint | ファイルフィールド / URL フィールド | 追加フィールド |
| - | - | - |
| `/send/image` | `image` / `image_url` | `caption` 、 `view_once` 、 `compress` 、 `hd`、 `mentions` |
| `/send/video` | `video` / `video_url` | `caption` 、 `view_once` 、 `compress` 、 `hd`、 `gif_playback` 、 `mentions` |
| `/send/file` | `file` / `file_url` | `caption` 、 `mentions` |
| `/send/audio` | `audio` / `audio_url` | `ptt` (音声メモとして送信) |
| `/send/sticker` | `sticker` / `sticker_url` | JPG、PNG、WebPまたはGIF; WebPに変換 |

すべてのメディアエンドポイントは `reply_message_id` 、 `is_forwarded` および `duration` も受け付けます。サイズ制限とフォーマットについては [Media handling](https://gowa-docs.mintlify.site/ja/examples/media-handling.md) を参照してください。

## 連絡先、場所、リンク、意識調査

```bash Contact theme={null}
curl -u $AUTH -X POST $GOWA/send/contact \
  -H "Content-Type: application/json" -H "X-Device-Id: $DEVICE" \
  -d '{"phone": "628123456789", "contact_name": "Jane Doe", "contact_phone": "628987654321"}'
```

```bash Location theme={null}
curl -u $AUTH -X POST $GOWA/send/location \
  -H "Content-Type: application/json" -H "X-Device-Id: $DEVICE" \
  -d '{"phone": "628123456789", "latitude": "-6.200000", "longitude": "106.816666"}'
```

```bash Link theme={null}
curl -u $AUTH -X POST $GOWA/send/link \
  -H "Content-Type: application/json" -H "X-Device-Id: $DEVICE" \
  -d '{"phone": "628123456789", "link": "https://github.com", "caption": "Check this out"}'
```

```bash Poll theme={null}
curl -u $AUTH -X POST $GOWA/send/poll \
  -H "Content-Type: application/json" -H "X-Device-Id: $DEVICE" \
  -d '{"phone": "628123456789", "question": "Lunch?", "options": ["Pizza", "Sushi", "Salad"], "max_answer": 1}'
```

## プレゼンスと入力

```bash theme={null}
# account-wide presence: available | unavailable
curl -u $AUTH -X POST $GOWA/send/presence \
  -H "Content-Type: application/json" -H "X-Device-Id: $DEVICE" \
  -d '{"type": "available"}'

# typing indicator in one chat: start | stop
curl -u $AUTH -X POST $GOWA/send/chat-presence \
  -H "Content-Type: application/json" -H "X-Device-Id: $DEVICE" \
  -d '{"phone": "628123456789", "action": "start"}'
```

ネイティブフローのボタン、位置情報リクエスト、画像カルーセルについては、[実験的なインタラクティブメッセージ](https://gowa-docs.mintlify.site/ja/examples/interactive-messages.md)を参照してください。

## 送信後

| タスク | Endpoint |
| - | - |
| 編集 | `phone` 、 `message` を含む `POST /message/{message_id}/update` |
| React | `phone`, `emoji`を使った `POST /message/{message_id}/reaction` |
| 全員に削除 | `POST /message/{message_id}/revoke` with `phone` |
| 削除してください | `POST /message/{message_id}/delete` with `phone` |
| 転送 | `phone` (宛先) を含む `POST /message/{message_id}/forward` 。ソースメッセージはGOWAのローカルチャットストレージにある必要があります。 |
| スター/スター解除 | `POST /message/{message_id}/star` , `/unstar` with `phone` |

### 画像またはドキュメントのキャプションを編集

v9.9.0以降のGOWA `main` では、 `media_type` に `image` または `document` を設定します。 元のメッセージと一致する必要があります。 `message` を置き換えるキャプションに設定し、 `link` を省略します。サンプルIDを送信したメッセージIDに置き換えます。

```bash theme={null}
curl -u "$AUTH" -X POST "$GOWA/message/3EB0B430B6F8F1D0E053AC120E0A9E5C/update" \
  -H "Content-Type: application/json" -H "X-Device-Id: $DEVICE" \
  -d '{"phone":"628123456789","message":"Updated caption","media_type":"image"}'
```

## 後で送信

代わりに、サポートされている送信リクエストに `scheduled_at` と `timezone` を追加します。`/send/interactive` は即時のみです。[Scheduled sends](https://gowa-docs.mintlify.site/ja/examples/scheduled-sends.md) を参照してください。

## 多くの受信者に送金中

GOWA には一斉送信用のエンドポイントはありません。コード内で受信者を順に処理し、間隔を空けて 一件ずつリクエストを送信し、`WA_REACHOUT_TIMELOCK` エラーが発生したら停止してください。大量に送信する前に[送信制限](https://gowa-docs.mintlify.site/ja/advanced/rate-limiting.md)を確認してください。


## Related topics

- [グループ管理](https://gowa-docs.mintlify.site/ja/examples/group-management.md)
- [メッセージを送信](https://gowa-docs.mintlify.site/ja/api-reference/send/メッセージを送信.md)
- [実験的なインタラクティブメッセージを送信する](https://gowa-docs.mintlify.site/ja/api-reference/send/実験的なインタラクティブメッセージを送信する.md)
- [音声メッセージを再生済みにする](https://gowa-docs.mintlify.site/ja/api-reference/message/音声メッセージを再生済みにする.md)
- [メッセージを削除](https://gowa-docs.mintlify.site/ja/api-reference/message/メッセージを削除.md)


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