$createAlert creates an **alert** on the current server and starts it right away. When a new item appears at the source, the bot posts it in the channel and/or starts the "Automation alert" workflow, depending on `action`. The author of the command must have **Manage Server**.

## Parameters

| Parameter | Description |
|---|---|
| `source` | Required. `rss`, `youtube`, `twitch` or `bluesky`. |
| `value` | Required. The feed URL (`rss`), the channel (`youtube`), the login (`twitch`) or the handle (`bluesky`). |
| `channelID` | Required. The channel where the bot posts. A `<#id>` mention is accepted. |
| `action` | Optional. `workflow` (default), `message` or `both`. |
| `name` | Optional. A name of 60 characters at most. Default: the source and its value. |
| `returnID` | Optional. `yes` returns the new alert ID, otherwise nothing is returned. |

## Behavior

- Limits depend on the bot owner's plan: active alerts per server (3, 5, 8 or 12) and total alerts per bot. Free plans have no alerts.
- The bot owner must have turned alerts on for the bot (Alerts by server, in the app or the Studio). Twitch also needs the owner's Twitch application.
- The same operations exist in the public API (`POST /v1/bots/{botId}/alerts`).
- Errors (the message starts with the code): `alert_forbidden` (the author lacks Manage Server), `alert_guild_required` (used outside a server), `alert_not_enabled` (the bot owner has not turned alerts on), `alert_paid_required` (the owner has no paid plan), `alert_unavailable` (the bot does not run on a runner connected to the Manager). Also `alert_limit_reached`, `alert_total_limit` and `alert_source_unreachable`.

## Examples

```bdfd
$onlyPerms[manageServer;You need Manage Server.]
$createAlert[twitch;$message[1];$mentionedChannels[1];both;Live $message[1]]
Alert created.
```

## JavaScript bots

`const id = await bc.alert.create({ source, value, channelId, action?, name? })` returns the alert ID. A failing call rejects with an `AlertError` whose `code` and message are the same.
