Webhook Notifications

Webhook notifications let your backend react to events in your Membrane workspace — connections being created, disconnected, or archived.

Setup

Configure a webhook URL in the Console under Settings > Webhook Notifications. Membrane sends a POST request to your URL whenever a matching event occurs.

Event Types

EventWhen it fires
connection.createdA new connection is established (OAuth completed, API key saved)
connection.disconnectedA connection lost access (token expired, credentials revoked)
connection.reconnectedA previously disconnected connection is restored
connection.deletedA connection is archived

Payload

Each webhook POST includes a JSON body with the event type and the affected resource:

{
  "event": "connection.created",
  "data": {
    "id": "con_abc123",
    "integrationId": "int_xyz789",
    "integrationKey": "slack",
    "name": "Slack",
    "disconnected": false,
    "customerId": "customer-123"
  }
}

Handling Webhooks

Example Express.js endpoint:

app.post('/api/membrane-webhook', async (req, res) => {
  const { event, data } = req.body

  switch (event) {
    case 'connection.created':
      // Run an action on the new connection
      const membrane = new MembraneClient({ token: process.env.MEMBRANE_ACCESS_TOKEN })
      await membrane.action('send-slack-message').run(
        { channel: 'general', text: 'Your app is now connected!' },
        { connectionId: data.id }
      )
      break
    case 'connection.disconnected':
      // Notify user to reconnect
      break
  }

  res.sendStatus(200)
})

Retry Behavior

If your endpoint returns a non-2xx status code, Membrane retries with exponential backoff.

See Also

  • Connections — connection lifecycle and management
  • Events — data events from external apps (distinct from webhook notifications)