# Replace Discord webhooks

Swap the Discord webhook link in your scripts for the log's FiveDash link, without changing anything else in the script.

Source: https://fivedash.fivex.gg/docs/en/logs/migrate-from-webhooks

Most FiveM scripts send logs to a Discord webhook. To bring those logs to FiveDash you don't need to rewrite anything: the log's FiveDash link accepts the same message Discord accepts. Just swap one link for the other in the script's config. This page is for whoever handles the city's scripts.

## Before you start

* **Logs created:** create a log for each kind of log the script sends. See [Create logs](https://fivedash.fivex.gg/docs/en/logs/create-logs).
* **Access level:** **Configure** on the log (or **All logs** at **Configure**) to see and copy the link.
* **Access to the server's files:** to edit the script's config and restart it in the console.

## Before and after

The script used to send to Discord:

```lua
Config.Webhook = "https://discord.com/api/webhooks/1234…/aBcD…"
```

Now it sends to the FiveDash log:

```lua
Config.Webhook = "https://logs.fivex.sh/api/logs/<log-id>/<token>"
```

The link's format is always `https://logs.fivex.sh/api/logs/<log-id>/<token>`. Copy the whole link from the panel instead of typing it.

## Swap a script's webhook

### Copy the log's link

In the panel, open the log in the sidebar (**Logs →** the log's name), click **How to send** and copy the link. If the log is on the export, click **Use webhook** to see the link.

### Open the script's config

Open the script's config (`config.lua`, `shared.lua`…) and look for `discord.com/api/webhooks`.

### Swap the link

Replace that link with the right log's link. The rest of the script stays the same.

### Restart the script

In the server console, run `ensure script-name`.

### Check it

Do something in the game that the script records, or click **Send test** in **How to send**. The log shows up on the log's page right away.

> A script with several webhooks (one per action) can point each link to a different log, or all of them to the same log. The **Script** filter and search tell them apart later.

## What FiveDash accepts

The log's link answers like a Discord webhook. Scripts that build the message with `PerformHttpRequest` work unchanged.

### Formats

| Content-Type                        | How the body is read                                                                                                                         |
| ----------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
| `application/json`                  | The body is the webhook message (`content`, `username`, `embeds`). Up to 256 KiB.                                                            |
| `multipart/form-data`               | The `payload_json` field (plus the `content` and `username` fields, if present). Attached files are counted but not kept. Up to 4 MiB total. |
| `application/x-www-form-urlencoded` | The `payload_json`, `content` and `username` fields.                                                                                         |

### Fields read

| Discord field                          | What it becomes in FiveDash                                                                  | Limit                            |
| -------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------- |
| `content`                              | The log's text (first embed only).                                                           | 2,000 characters                 |
| `username`                             | The **Script** that sent it (used by the **Script** filter and **Scripts** in the overview). | 80 characters                    |
| `embeds`                               | Each embed becomes a separate log.                                                           | 10 embeds                        |
| `embeds[].title`                       | The log's title. Without a title, `author.name` or the first line of `content` is used.      | 256                              |
| `embeds[].description`                 | The log's text.                                                                              | 4,096                            |
| `embeds[].fields`                      | The log's values, in order (`name`, `value`, `inline`).                                      | 25 fields; name 256, value 1,024 |
| `embeds[].color`                       | The log's stripe color.                                                                      | —                                |
| `embeds[].author.name`                 | The embed's author.                                                                          | 256                              |
| `embeds[].footer.text`                 | The embed's footer.                                                                          | 2,048                            |
| `embeds[].url`                         | The embed's link.                                                                            | —                                |
| `embeds[].image.url` / `thumbnail.url` | The log's image and thumbnail.                                                               | —                                |
| `embeds[].timestamp`                   | **Time in the embed**, shown on the log.                                                     | —                                |

Other fields (like `avatar_url`, `tts` and components) are ignored.

### What FiveDash reads from each log

Besides keeping the message, FiveDash looks through the text, the fields and the footer for:

| What                      | How it recognizes it                                                                                |
| ------------------------- | --------------------------------------------------------------------------------------------------- |
| Character ID (passaporte) | Labels like `Passaporte`, `user_id`, `citizenid`, `ID`, `Vítima`, `Assassino` followed by a number. |
| Discord account           | Mentions `<@123…>` and `discord:123…`.                                                              |
| Identifiers               | `license:`, `license2:`, `steam:`, `fivem:`, `xbl:`, `live:`.                                       |
| Coordinates               | `vector3(x, y, z)`, `x: … y: … z: …` or three decimal numbers separated by commas.                  |
| Value pairs               | Lines like `**Item:** water`, `Item: water` or `[ITEM]: water`.                                     |

This data feeds search, the **Player** filter and **Most active players**.

### Responses

| Situation                                          | Response                                                                   |
| -------------------------------------------------- | -------------------------------------------------------------------------- |
| Log accepted                                       | `204 No Content`, like Discord.                                            |
| Log accepted with `?wait=true` on the link         | `200` with the created message (`id`, `content`, `embeds`…), like Discord. |
| `GET` on the link                                  | `200` with the webhook's data, like Discord.                               |
| Log doesn't exist or was deleted                   | `404` `{"code":10015,"message":"Unknown Webhook"}`                         |
| Wrong token (old link after **Generate new link**) | `401` `{"code":50027,"message":"Invalid Webhook Token"}`                   |
| Invalid JSON                                       | `400` `{"code":50109,…}`                                                   |
| Empty message (no `content`, embeds or files)      | `400` `{"code":50006,"message":"Cannot send an empty message"}`            |
| Body too large                                     | `413` `{"code":40005,"message":"Request entity too large"}`                |
| Too many logs per second                           | `429`, with `Retry-After: 1`                                               |
| Service busy or down                               | `503`, with `Retry-After: 1`                                               |

## Switch to the export later

If you can edit the script, the FiveDash export is faster and already reads the player's character ID. In **How to send**, click **Use export** and then **Copy AI prompt**: paste it into an AI with the script and it replaces the `PerformHttpRequest` with the export call. See [FiveM resource](https://fivedash.fivex.gg/docs/en/developers/fivem-resource).

## FAQ

**Does the log still show up on Discord?**
No. After the swap, the script sends only to FiveDash. The logs stay in the panel, with search and filters.

**I swapped the link and nothing arrived. What should I check?**
Make sure the whole link was pasted, the script was restarted (`ensure script-name`) and the link isn't from before a **Generate new link**. In **Logs → Overview**, the **Silent** block shows logs that received nothing in the last 24 h.

**I have old links with the panel's address. Do they still work?**
Yes. Log links pointing at the panel are still accepted. For new scripts, use the link the panel shows now.

**Are the screenshots the script sent along kept?**
No. The log records how many files came, but doesn't keep them. To keep screenshots, use the [CDN](https://fivedash.fivex.gg/docs/en/cdn/integrations).

## Next steps

[Create logs](https://fivedash.fivex.gg/docs/en/logs/create-logs)Create one log for each kind of webhook.
[Search and filter](https://fivedash.fivex.gg/docs/en/logs/search-and-filter)Find the logs the scripts sent.
[Logs API](https://fivedash.fivex.gg/docs/en/developers/logs-api)The technical details for developers.
[CDN integrations](https://fivedash.fivex.gg/docs/en/cdn/integrations)Keep the scripts' screenshots with a link.
