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.

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.

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}}" }
  • 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.
  • Retries: on server errors (5xx) and network problems, YouniqMail retries up to three times, with pauses of 1, 2 and 4 seconds. Rejections (4xx) are not retried. You set the timeout per endpoint, 30 seconds at most.
  • 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.