# Write in the chat as your app

`POST https://rest.wordplus.cloud/wordplus/realtime/streams/{name}/chat`

A message from your app in the chat of a live stream, for everyone watching: with the name and the https picture
you give it, shown as a host message, so nobody may ban it. Up to 500 characters.

In the packages: `realtime.stream( name ).say( text, { name, avatar } )`.

## Parameters

| Name | In | |
|---|---|---|
| `name` (required) | path | The stream name, percent-encoded: `show:mugs` is `show%3Amugs`. |

## Request

```json
{
  "text": "Free shipping until midnight",
  "name": "Mug Shop"
}
```

## Answer

The message, as everyone watching got it.

```json
{
  "ok": true,
  "message": {
    "id": "1791638460000-0",
    "from": {
      "user": null,
      "name": "Mug Shop",
      "avatar": null,
      "role": "app"
    },
    "text": "Free shipping until midnight",
    "at": 1791638460000
  }
}
```

## Refusals

- **400**: `empty`, `too_long`, `bad_name`, `bad_avatar` (not https).
- **401**: `missing_signature`, `stale_signature` (a clock off by more than 5 minutes), `unknown_site`, `bad_signature` (a wrong secret, or a body or path other than the one signed).
- **403**: `not_included`: your plan does not include it.

## Examples

`wordplus()` (in Go `app.Request()`) signs and sends the request: https://docs.wordplus.cloud/api/signing/ has it in each language.

**curl**

```bash
wordplus POST '/wordplus/realtime/streams/show%3Amugs/chat' '{"text":"Free shipping until midnight","name":"Mug Shop"}'
```

**Node**

```js
const { message } = await wordplus('POST', `/wordplus/realtime/streams/${encodeURIComponent('show:mugs')}/chat`, { text: 'Free shipping until midnight', name: 'Mug Shop' });
```

**Python**

```python
message = wordplus("POST", f"/wordplus/realtime/streams/{quote('show:mugs', safe='')}/chat", {"text": "Free shipping until midnight", "name": "Mug Shop"})["message"]
```

**PHP**

```php
$message = wordplus('POST', '/wordplus/realtime/streams/'.rawurlencode('show:mugs').'/chat', ['text' => 'Free shipping until midnight', 'name' => 'Mug Shop'])['message'];
```

**Go**

```go
answer, err := app.Request("POST", "/wordplus/realtime/streams/"+url.PathEscape("show:mugs")+"/chat", map[string]any{"text": "Free shipping until midnight", "name": "Mug Shop"})
```

