diff --git a/docs/configuration.md b/docs/configuration.md
index 556414e21..8fe6b7620 100644
--- a/docs/configuration.md
+++ b/docs/configuration.md
@@ -215,6 +215,7 @@ Mandatory parameters are marked as **Required**, which means that they are requi
| `telegram.balance_dust_level` | Dust-level (in stake currency) - currencies with a balance below this will not be shown by `/balance`.
**Datatype:** float
| `telegram.reload` | Allow "reload" buttons on telegram messages.
*Defaults to `True`.
**Datatype:** boolean
| `telegram.notification_settings.*` | Detailed notification settings. Refer to the [telegram documentation](telegram-usage.md) for details.
**Datatype:** dictionary
+| `telegram.allow_custom_messages` | Enable the sending of Telegram messages from strategies via the dataprovider.send_msg() function.
**Datatype:** Boolean
| | **Webhook**
| `webhook.enabled` | Enable usage of Webhook notifications
**Datatype:** Boolean
| `webhook.url` | URL for the webhook. Only required if `webhook.enabled` is `true`. See the [webhook documentation](webhook-config.md) for more details.
**Datatype:** String
@@ -225,6 +226,7 @@ Mandatory parameters are marked as **Required**, which means that they are requi
| `webhook.webhookexitcancel` | Payload to send on exit order cancel. Only required if `webhook.enabled` is `true`. See the [webhook documentation](webhook-config.md) for more details.
**Datatype:** String
| `webhook.webhookexitfill` | Payload to send on exit order filled. Only required if `webhook.enabled` is `true`. See the [webhook documentation](webhook-config.md) for more details.
**Datatype:** String
| `webhook.webhookstatus` | Payload to send on status calls. Only required if `webhook.enabled` is `true`. See the [webhook documentation](webhook-config.md) for more details.
**Datatype:** String
+| `webhook.allow_custom_messages` | Enable the sending of Webhook messages from strategies via the dataprovider.send_msg() function.
**Datatype:** Boolean
| | **Rest API / FreqUI / Producer-Consumer**
| `api_server.enabled` | Enable usage of API Server. See the [API Server documentation](rest-api.md) for more details.
**Datatype:** Boolean
| `api_server.listen_ip_address` | Bind IP address. See the [API Server documentation](rest-api.md) for more details.
**Datatype:** IPv4
diff --git a/docs/webhook-config.md b/docs/webhook-config.md
index 3677ebe89..2793bd1eb 100644
--- a/docs/webhook-config.md
+++ b/docs/webhook-config.md
@@ -94,6 +94,19 @@ Optional parameters are available to enable automatic retries for webhook messag
},
```
+Custom messages can be sent to Webhook endpoints via the dataprovider.send_msg() function. To enable this, set the `allow_custom_messages` option to `true`:
+
+```json
+ "webhook": {
+ "enabled": true,
+ "url": "https://",
+ "allow_custom_messages": true,
+ "webhookstatus": {
+ "status": "Status: {status}"
+ }
+ },
+```
+
Different payloads can be configured for different events. Not all fields are necessary, but you should configure at least one of the dicts, otherwise the webhook will never be called.
### Webhookentry
@@ -288,3 +301,13 @@ Available fields correspond to the fields for webhooks and are documented in the
The notifications will look as follows by default.
![discord-notification](assets/discord_notification.png)
+
+Custom messages can be sent from a strategy to Discord endpoints via the dataprovider.send_msg() function. To enable this, set the `allow_custom_messages` option to `true`:
+
+```json
+ "discord": {
+ "enabled": true,
+ "webhook_url": "https://discord.com/api/webhooks/",
+ "allow_custom_messages": true,
+ },
+```
diff --git a/freqtrade/rpc/rpc_manager.py b/freqtrade/rpc/rpc_manager.py
index e3b31d225..bc13c1654 100644
--- a/freqtrade/rpc/rpc_manager.py
+++ b/freqtrade/rpc/rpc_manager.py
@@ -88,10 +88,13 @@ class RPCManager:
"""
while queue:
msg = queue.popleft()
- self.send_msg({
- 'type': RPCMessageType.STRATEGY_MSG,
- 'msg': msg,
- })
+
+ for mod in self.registered_modules:
+ if mod._config.get(mod.name, {}).get('allow_custom_messages', False):
+ mod.send_msg({
+ 'type': RPCMessageType.STRATEGY_MSG,
+ 'msg': msg,
+ })
def startup_messages(self, config: Config, pairlist, protections) -> None:
if config['dry_run']: