SharedInbox

Sending Emails to Other Apps with Webhooks

Webhooks send events from SharedInbox to a URL you choose, the moment they happen. Today the events are about email: one for each email received by the inboxes you pick, and one for each email your team sends from them in Slack. Use them to log emails in your CRM, open tickets in your help desk, or start your own automations.

Each email reaches your URL as a POST request with a JSON body. Something has to be listening at that URL. That can be your own code, or a no-code tool like Zapier or Make that gives you a webhook URL. Each workspace has one webhook URL, and it covers all of the workspace’s inboxes.

Set up a webhook #

You need to be a SharedInbox admin for your workspace.

  1. Sign in to the SharedInbox dashboard and go to Settings, then Webhooks.
  2. In Endpoint URL, paste the URL that should get the events. It has to start with https:// and be reachable from the public internet. We don’t send to private or internal addresses, such as localhost, 10.0.0.5 or 192.168.1.20. Leave any username and password out of the URL, because the signature does that job.
  3. Under Inboxes, tick each inbox whose email should go to your URL. None are ticked to start with, so nothing is sent until you pick at least one.
  4. Leave Sending set to On, and click Save.
  5. Under Signing secret, click Copy and add the secret to your endpoint. It starts with whsec_. Your endpoint uses it to check that each request came from us.
  6. Under Test it, click Send a test event. Within a few seconds the page shows what your endpoint answered, such as Delivered (HTTP 200, 84ms).

From then on, every email that arrives in a ticked inbox, and every email your team sends from one in Slack, goes to your URL. You can change which inboxes are ticked at any time.

The events we send #

There are three types of event. The type field in the body says which one it is.

TypeWhen we send it
mail.receivedAn email arrived in one of your inboxes. We send it even if posting the email to Slack fails.
mail.sentSomeone sent an email from Slack. kind says how: reply, compose or forward. A Reply All is a reply.
webhook.testSomeone clicked Send a test event. It carries a sample email. It goes out even while sending is off or the webhook is paused.

An example event #

Here’s a mail.received event:

{
  "id": "evt_674c7a1ce2f1c3a9d8b7e602",
  "type": "mail.received",
  "api_version": "2026-11-01",
  "created_at": "2026-12-01T15:04:12.000Z",
  "account": {
    "id": "64b7f0c2a1d3e4f5a6b7c8d9",
    "slack_team_id": "T04NORTHWND"
  },
  "data": {
    "mail": {
      "id": "674c7a1be2f1c3a9d8b7e601",
      "message_id": "[email protected]",
      "direction": "inbound",
      "inbox": "[email protected]",
      "from": {
        "email": "[email protected]",
        "name": "Maria Lopez"
      },
      "to": [
        {
          "email": "[email protected]",
          "name": "Northwind Support"
        }
      ],
      "cc": [],
      "subject": "Re: Order #4821 arrived damaged",
      "text": "Hi, here are the photos of the box. Could you send a replacement?\n\nThanks,\nMaria",
      "html": "<p>Hi, here are the photos of the box. Could you send a replacement?</p><p>Thanks,<br>Maria</p>",
      "truncated": false,
      "date": "2026-12-01T15:03:58.000Z",
      "attachments": [
        {
          "filename": "box-photo.jpg",
          "size": 284311,
          "url": "https://storage.googleapis.com/sharedbox-attachments/k3j9x2/1764601452000/box-photo.jpg"
        }
      ],
      "slack": {
        "channel_id": "C05SUPPORT1",
        "thread_ts": null
      },
      "in_reply_to": "[email protected]"
    }
  }
}

A mail.sent event has the same shape, with direction set to outbound and two more fields, kind and sent_by. A test event has the same shape too, with type set to webhook.test.

Event fields #

FieldWhat it is
idThe event’s ID, starting with evt_. It stays the same when we retry the event or you resend it.
typemail.received, mail.sent or webhook.test.
api_versionThe version of this format. It’s 2026-11-01.
created_atWhen we created the event, in UTC. Retries and resends keep the original time.
account.idYour SharedInbox workspace’s ID.
account.slack_team_idYour Slack workspace’s ID, starting with T.
data.mailThe email. Its fields are below.

Email fields #

Times are in UTC, in ISO 8601 format. A field is null when we don’t have a value for it.

FieldWhat it is
idSharedInbox’s own ID for the email. It’s null in test events.
message_idThe email’s Message-ID, without the angle brackets.
directioninbound for mail.received, outbound for mail.sent.
inboxThe address of the SharedInbox inbox that received or sent the email.
fromThe sender, as email and name. name is an empty string when the email didn’t include one.
to, ccLists of email and name, from the email’s To and Cc lines.
reply_toOnly on mail.received, and only when the email set a Reply-To address. It has email and name.
subjectThe subject line. A received email with no subject has (No subject).
textThe plain-text body. When a received email is a reply, we leave out the quoted earlier messages.
htmlThe HTML body, or null.
truncatedtrue when we cut the body down. See Very large emails.
dateWhen the email was sent. For mail.received, it comes from the email’s Date line.
attachmentsThe attached files, each with filename, size in bytes and url, a link to a copy of the file. The files themselves aren’t in the event. Only mail.received lists attachments. On mail.sent this list is always empty.
slack.channel_idThe ID of the Slack channel the inbox posts to.
slack.thread_tsFor mail.sent, the Slack thread the email belongs to. For mail.received it’s always null, because we create the event before we post to Slack.
in_reply_toOnly on mail.received. The Message-ID of the email this one replies to, without angle brackets, or null. Match it against an earlier message_id to keep conversations together.
kindOnly on mail.sent. reply, compose or forward.
sent_byOnly on mail.sent. Who sent it, as slack_user_id and slack_username.

Very large emails #

We cut text and html to 262,144 characters each. If the two together are still longer than that, we drop html and send it as null. When either happens, truncated is true.

Headers #

HeaderWhat it is
Content-Typeapplication/json
User-AgentSharedInbox-Webhooks/1.0 (+https://sharedinbox.co)
X-SharedInbox-EventThe event type, the same as type.
X-SharedInbox-Event-IdThe event ID, the same as id.
X-SharedInbox-Delivery-Attempt1 on the first try, 2 on the first retry, and so on. It starts at 1 again when you resend an event.
X-SharedInbox-SignatureProof that the request came from us. See the next section.

Check that a request came from us #

Anyone who finds out your URL could send it fake events. The X-SharedInbox-Signature header lets your endpoint tell ours apart. It looks like this:

X-SharedInbox-Signature: t=1796137453,v1=4b07328697534ecc6b3640c42c3df99ebbd3cc68b1e1dbda092535ac7e5e103d
  • t is when we sent this request, in Unix seconds. Each retry gets a new t.
  • v1 is an HMAC-SHA256 of t, a dot, and the raw request body, written in hex. The key is your whole signing secret as text, including the whsec_ at the start.

To check a request:

  1. Read the body as raw bytes, before you parse the JSON. Parsing and re-encoding the JSON changes the bytes, and then the signature won’t match.
  2. Turn the request away if t is more than five minutes from now. That stops someone from replaying a request they copied.
  3. Work out the HMAC yourself and compare it with v1. Use a constant-time comparison, so the time it takes doesn’t give the answer away.
  4. If the check fails, answer with a 400 and don’t use the event.

Node.js #

const crypto = require('crypto')

// rawBody: the request body exactly as it arrived, as a Buffer or a string.
// header: the X-SharedInbox-Signature header.
// secret: your signing secret, including the whsec_ at the start.
function isFromSharedInbox(rawBody, header, secret) {
  const parts = Object.fromEntries(
    String(header || '').split(',').map((part) => part.trim().split('='))
  )
  const t = Number(parts.t)
  if (!Number.isInteger(t) || !parts.v1) return false
  if (Math.abs(Date.now() / 1000 - t) > 5 * 60) return false

  const expected = crypto
    .createHmac('sha256', secret)
    .update(`${parts.t}.`)
    .update(rawBody)
    .digest()
  const given = Buffer.from(parts.v1, 'hex')
  return given.length === expected.length && crypto.timingSafeEqual(given, expected)
}

With Express, give the webhook route express.raw() so that req.body is the raw body. Register this route before any app.use(express.json()), because that one parses the body first.

const express = require('express')
const app = express()

// express.raw keeps the body as a Buffer, which the check needs.
app.post('/sharedinbox', express.raw({ type: 'application/json' }), (req, res) => {
  const header = req.get('X-SharedInbox-Signature')
  if (!isFromSharedInbox(req.body, header, process.env.SHAREDINBOX_WEBHOOK_SECRET)) {
    return res.status(400).send('Bad signature')
  }
  const event = JSON.parse(req.body)
  // Save event.data.mail here. Skip it if you've already saved event.id.
  res.sendStatus(200)
})

Python #

import hashlib
import hmac
import time


def is_from_sharedinbox(raw_body: bytes, header: str, secret: str) -> bool:
    """raw_body is the request body exactly as it arrived, as bytes."""
    try:
        parts = dict(part.strip().split("=", 1) for part in header.split(","))
        t = int(parts["t"])
        given = parts["v1"]
    except (AttributeError, KeyError, ValueError):
        return False
    if abs(time.time() - t) > 5 * 60:
        return False

    signed = parts["t"].encode() + b"." + raw_body
    expected = hmac.new(secret.encode(), signed, hashlib.sha256).hexdigest()
    return hmac.compare_digest(expected.encode(), given.encode())

With Flask, request.get_data() gives you the raw body:

import os

from flask import Flask, request

app = Flask(__name__)


@app.post("/sharedinbox")
def sharedinbox_webhook():
    header = request.headers.get("X-SharedInbox-Signature", "")
    secret = os.environ["SHAREDINBOX_WEBHOOK_SECRET"]
    if not is_from_sharedinbox(request.get_data(), header, secret):
        return "Bad signature", 400
    event = request.get_json()
    # Save event["data"]["mail"] here. Skip it if you've already saved event["id"].
    return "", 200

Making a new secret #

If your secret gets out, make a new one. Under Signing secret, click Make a new secret…, then Make a new secret. The old secret stops working straight away, so update your endpoint right after. Events your endpoint turns away in between aren’t lost, because we retry them.

Answering events #

  • Any 2xx status means delivered. Any other status, a timeout or a connection error is a failure, and we retry.
  • Answer within 10 seconds. If saving the email takes longer, answer first and do the slow part afterwards.
  • We don’t follow redirects. A 3xx counts as a failure, so give us the final URL.
  • We read only the first 4 KB of your answer, and the delivery log keeps the first 500 characters. You don’t need to send anything back.
  • The same event can arrive more than once. For example, if your endpoint saves an event but answers after 10 seconds, we count that as a failure and send it again. Use id to skip events you’ve already saved.
  • Events can arrive out of order. Use date to put emails in order.

Retries and failed events #

When a delivery fails, we try again after about 1 minute, then 5 minutes, 30 minutes, 2 hours, 6 hours, 12 hours and 24 hours. That’s 8 tries over about two days. Every retry sends the event exactly as it was when we created it.

If the last try fails, the event moves to Failed events on the Webhooks page, and we keep it there for 30 days. Once your endpoint is fixed, click Resend next to an event, or Resend all. A resent event keeps its id and gets another 8 tries.

When your endpoint keeps failing #

We send a Slack message to your workspace’s SharedInbox admins when something changes. It shows up in the SharedInbox app’s Messages tab. We don’t send a message for each failed try.

  • Failing. When every try has failed for at least an hour, and at least 5 in a row, we tell your admins the webhook isn’t working. We keep retrying.
  • Paused. After three days with no successful delivery, we pause the webhook and tell your admins. Events that were waiting for a retry move to Failed events. While it’s paused we send nothing except test events. Emails that arrive or get sent in that time go straight to Failed events too, and we keep them for 30 days.
  • Working again. If a delivery gets through while the webhook is failing, it’s back to normal and we tell your admins.
  • One event gave up. Sometimes your endpoint takes most events but one runs out of tries, for example because it turns away very large emails. We tell your admins about that at most once a day.

To start again after a pause, fix your endpoint and click Send a test event to check it. Then click Resume, and click Resend all under Failed events.

The delivery log #

The bottom of the Webhooks page lists the last 50 delivery tries from the past 14 days. Each row shows when it was, the event and email, the result and status code, any error, and how long your endpoint took. Retries show their try number. Look here first when events aren’t arriving.

Turning it off or removing it #

  • To pause sending yourself, set Sending to Off and click Save. Emails that arrive or get sent while it’s off are never sent to your endpoint, and events waiting for a retry are dropped. Test events still go out.
  • Changing the URL, or turning sending back on, clears the failure count, so an old run of failures doesn’t count against the new setup.
  • To remove the webhook, click Remove… under Remove this webhook, then Remove webhook. We stop sending right away and delete everything we kept for it (see below). If you add a webhook again later, it gets a new signing secret.

What we keep, and deleting it #

To send your events, we keep a few things for a short time:

  • Events waiting to go out. A copy of each event, email content included, until it’s delivered or runs out of tries.
  • Failed events. The same copy, kept for 30 days so you can resend it.
  • The delivery log. When each try happened, the email’s subject, the result and the first part of your endpoint’s reply, kept for 14 days. It doesn’t hold the rest of the email.
  • Your settings. The URL, whether sending is on, and the signing secret, which we store encrypted.

Removing the webhook deletes all of these straight away. It doesn’t touch the emails in your inboxes or what your endpoint already received; anything already sent to your endpoint is yours to delete there.

Updated on December 1, 2026

Try a fully functional demo of SharedInbox for free in your own Slack workspace!

Feel free to play around in our sandbox to see how easy it is to send and receive emails from Slack! You don’t have to sign up for a trial or add credit card information in order to use it.

Just click the “Try our sandbox!” button, click “Open Slack” when prompted and see how it works for yourself!