Skip to content

Webhooks

A webhook is the simplest form of integration: an HTTP message to an address you define. Slack, Discord and Microsoft Teams accept such messages directly as channel posts; your own systems can do with them whatever they like.

Typical uses: the support address reports new requests to the team channel. The order confirmation nudges the inventory system. A customer’s server alert appears in Discord.

  1. Open Settings → Integrations → Webhooks and turn on Enable Webhooks.
  2. Choose Add endpoint and enter a Name and the URL.
  3. Under Payload preset, pick Slack, Discord, Microsoft Teams or Generic JSON. The preset fills the Payload template (JSON) with a matching skeleton that you can adjust freely.
  4. Test sends a probe message with sample data. With Slack and friends you see it in the channel immediately.

The URL comes from the respective service:

  • Slack: at api.slack.com/apps, create an app with Incoming Webhooks; the generated URL is the endpoint.
  • Discord: channel settings → Integrations → Webhooks.
  • Teams: in the channel via the Workflows app, with the template for posting when a webhook request is received.
  • Your own systems: any address accepting JSON via HTTP POST or PUT.

An endpoint is saved only once it has a name and a valid URL; until then the entry says “Not saved yet”. After restoring a backup, enter the URL again.

Several endpoints are possible, and each can be turned off on its own: the support channel and your own script can sit side by side. An endpoint that is turned off is missing from the rules’ picker, and rules that already use it fail with a note that it is switched off.

Sending happens exclusively through the automation: the Send webhook action in a rule, with the endpoint of your choice as the target.

What exactly is sent is defined in the endpoint’s payload template. In it you insert variables in double curly braces, filled with the triggering email’s data on send: {{subject}}, {{from}}, {{from_name}}, {{to}}, {{cc}}, {{date}}, {{preview}} (the start of the text), {{tags}}, {{mailbox}}, {{account_id}} and {{rule_name}}. The Variable reference below the template explains each one. A Slack message for the support channel might look like this:

{ "text": "New request from {{from_name}}: {{subject}}" }

YouniqMail inserts the values the way JSON requires: quotes, backslashes and line breaks from the subject or the text stay part of the text and cannot add fields of their own to the payload. If your template does not give valid JSON, a note right below the field says so.

  • Signature: if you enter an HMAC Secret (optional), every request carries the header X-YouniqMail-Signature: sha256=… with an HMAC-SHA256 signature of the content. Your server uses it to check that the message comes from you.
  • Custom headers: Custom headers such as Authorization cannot be added. Use the signature or a secret part of the URL to protect the endpoint.
  • Retries: How often YouniqMail tries again is set per endpoint in Retries, 0 to 3, with 1 as the default. Everything except success (2xx) and rejection (4xx) is retried, that is server errors (5xx), redirects, timeouts and network problems, with pauses of 1, 2 and 4 seconds.
  • Timeout (ms): per endpoint between 1000 and 30000 milliseconds, 10 seconds by default.
  • Method: POST is the default, PUT only if your endpoint requires it. Redirects are not followed.
  • The message goes to the endpoint you specify. Check the URL carefully, because anyone who knows it can post to the channel. Treat webhook URLs like passwords.
  • You control the content: what is transmitted is what the template contains. Use only subject and sender, and only those are shared.
  • Pro feature: Webhooks belong to the Pro feature set.