Skip to content
Switch branches/tags
Go to file
Cannot retrieve contributors at this time

Webhook Forwarding

Emails sent to :ref:`doc_private_addresses` (or :ref:`Catch-All addresses <sec_forwarding_catchall>`) can be forwarded to a URL also known as a webhook.

Configure Webhook

.. tabs::
   .. tab:: Mailsac Website

      .. figure:: webhook_setting_website.png

        Select `Manage Email Addresses` from the Dashboard_. Choose `Settings`
        next to the email address. In the `Forward to Custom Webhook` setting
        enter the webhook address and select `Save Settings`

   .. tab:: curl

       .. literalinclude::
          :language: bash
          :caption: Configure webhook forwarding on private address using curl

   .. tab:: Node.js Javascript

       .. literalinclude:: webhook_setting.js
          :language: javascript
          :caption: Configure webhook forwarding on a private address using
                    Node.js. requires :code:`npm install superagent`

   .. tab:: Python

       .. literalinclude::
          :language: python
          :caption: Configure webhook forwarding on a private address using

Webhook Sample JSON

This is an example of the JSON that will be passed to the Webhook URL.

{"text": "this is a message",
"headers": {
     "dkim-signature": "redacted",
     "received": "2017-05-01T05:22:03.000Z",
     "content-type": "text/plain",
     "from": "",
     "to": "",
     "subject": "",
     "message-id": "",
     "list-unsubscribe": "",
     "content-transfer-encoding": "7bit",
     "date": "Wed, 1 May 2017 05:22:03 +0000",
     "mime-version": "1.0"
"subject": "twin",
"messageId": "",
"priority": "normal",
"from": [{
     "address": "",
     "name": ""
"to": [{
     "address": "",
     "name": ""
"date": "2017-05-01T05:22:03.000Z",
"receivedDate": "2017-05-01T05:22:03.000Z",
"originalInbox": "",
"inbox": "",
"domain": "",
"encryptedInbox": "inbox-db54b7f5f09041165aaaaae5ca9557c806cf3d95f8",
"raw": "DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;;\r\n q=dns/txt; s=mailsacrelay;\r\n bh=redacted;\r\n h=from:subject:to:mime-version:content-type:content-transfer-encoding:list-unsubscribe;\r\n b=redacted\r\nReceived: from localhost ( by mailer with SMTP; Wed May 1\r\n 2017 01:22:03 GMT-0400 (EDT)\r\nContent-Type: text/plain\r\nFrom:\r\nTo:\r\nSubject: twin\r\nMessage-ID:\r\n \r\nList-Unsubscribe: \r\nContent-Transfer-Encoding: 7bit\r\nDate: Wed, 1 May 2017 05:22:03 +0000\r\nMIME-Version: 1.0\r\n\r\this is a message",
"received": "2017-05-01T05:22:04.851Z",
"_id": "IhnBcuaaiC",
"ip": ""

Webhook contents are very similar to web socket emails.

Read more about JSON Webhooks at the API Reference


If the Webhook forwarding is not working, additional debugging information is available in :ref:`doc_recent_activity`.