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

# Discord Notifications via webhook

> This guide will help you configure automatic notifications from the **TakeProfit** platform to **Discord** using Webhook. This will allow you to receive timely alerts directly on your Discord server, enhancing your work efficiency.

## Creating a Webhook in Discord

### For a Server

1. **Open Discord** and log into your server.
2. **Go to server settings:**
   * Click on the server name in the top-left corner.
   * Select **"Server Settings"**.
3. **Choose the channel for notifications:**
   * In the left menu, select **"Integrations"**.
   * Click on **"Webhooks"**.
4. **Create a new Webhook:**
   * Click **"Create Webhook"**.
   * Set a **Webhook name** (e.g., "TakeProfit Alerts").
   * Choose the **channel** where messages will be sent.
   * **Copy the Webhook URL**—you will need it for the setup in TakeProfit.
   * Click **"Save Changes"**.

***

## Configuring Webhook in TakeProfit

### Preparing the Webhook URL

* Use the Webhook URL obtained from Discord in the previous step.
* Example Webhook URL:

  ```URL theme={null}
  https://discord.com/api/webhooks/123456789012345678/abcdefghijklmnopqrstuvwxyz
  ```

### Setting Up the Payload

1. **Log in** to your **TakeProfit** account.
2. **Create a new alert** or edit an existing one.
3. **Configure the alert conditions:**
   * Specify the required parameters: **ticker**, **exchange**, **trigger condition**, etc.
4. **Add the Webhook:**
   * In the notifications section, select the **Webhook URL** option.
   * **Paste the Webhook URL** from Discord into the appropriate field.
5. **Set up the Payload:**
   * In the **Message** field, enter the JSON with the necessary parameters.

***

## Forming Messages Using Variables

You can use TakeProfit variables to dynamically form the content of the message.

**Common variables:**

* `{{ticker}}` — The instrument's ticker.
* `{{exchange}}` — Exchange name.
* `{{condition_type}}` — Type of trigger condition.
* `{{condition_source_1}}` — Condition source (e.g., price).

**Example usage in the Message field:**

```json theme={null}
{
	"content": "🔔 Alert: {{ticker}} on {{exchange}} — {{condition_type}} {{close}}"
}
```

***

## Configuration Examples

### Example 1: Simple Text Message

**Message:** `The price of BTC/USD exceeded $50,000 on Binance`

**Payload in the Message field:**

```json theme={null}
{
	"content": "🔔 Alert: The price of {{ticker}} exceeded {{close}} on {{exchange}}"
}
```

### Example 2: Sending an Embedded Message (Embed)

**Payload with Embed:**

```json theme={null}
{
	"embeds": [
		{
			"title": "📈 {{ticker}} Alert",
			"description": "**Condition:** {{condition_type}}\n**Price:** {{close}}\n**Exchange:** {{exchange}}",
			"color": 3066993
		}
	]
}
```

* **title**: Message title, can contain variables.
* **description**: Main content using Markdown for formatting.
* **color**: Color of the Embed bar in decimal RGB format (e.g., `3066993` for green).

***

## Testing the Configuration

1. **Save the alert settings** in TakeProfit.
2. **Create a condition** that will surely trigger (e.g., set the price above the current one).
3. **Check for the message** in your Discord channel.
4. **Ensure** that all variables have been correctly replaced with actual data.

***

## Troubleshooting

* **Messages are not received:**
  * Check the correctness of the Webhook URL.
  * Ensure that the alert in TakeProfit is active.
* **Incorrect message display:**
  * Verify the correctness of the JSON in the Payload.
  * Use a [JSON validator](https://jsonlint.com/) to check.
* **Variables are not replaced:**
  * Ensure the variables are spelled correctly.
  * Check if the used variables are supported by the TakeProfit platform.

***

## Helpful Tips

* **Advanced Embed Features:**
  * You can add fields, images, and other elements to the Embed. Refer to the [Discord documentation](https://discord.com/developers/docs/resources/channel#embed-object) for details.
* **Notifications in multiple channels:**
  * Create multiple Webhooks for different channels and set up corresponding alerts.
* **Security:**
  * Do not share the Webhook URL with unauthorized individuals.
  * Regularly check your server's security settings.

***

## Conclusion

You have now set up integration between **TakeProfit** and **Discord** via Webhook. This allows you to receive instant and visual notifications about important events, helping you to respond promptly to market changes.

If you have any questions or need additional assistance, refer to the official Discord documentation or contact TakeProfit support.

***

**Useful Links:**

* [Discord Developer Portal — Webhook Documentation](https://discord.com/developers/docs/resources/webhook)
* [Discord Embed Visualizer](https://leovoel.github.io/embed-visualizer/) — a tool for previewing Embeds.
* [TakeProfit — Official Website](https://takeprofit.com/)
* [JSON Validator](https://jsonlint.com/)

***

**Note:** Always stay updated on the APIs and functions you use, as they may be updated or changed over time.
