Webhooks

DonorPoint supports inbound webhooks — HTTP POST endpoints that external systems can call to trigger actions in DonorPoint. Webhooks are implemented as Script Modules: any Script Module creates an implicit HTTP endpoint.

How Webhooks Work

  1. Create a Script Module in Integration → Script Modules
  2. Write the script to process the incoming data
  3. The Script Module’s URL is its webhook endpoint — authenticate via API key
  4. External systems POST to that URL; the requestBody variable contains the POST body

Writing a Webhook Script

import "mailer";

var data = JSON.parse(requestBody ? requestBody : '{}');
log.warn("Webhook received: " + JSON.stringify(data));

// Process the incoming data
if (data.event == 'payment.completed') {
    // update a record, send a notification, etc.
}

return JSON.stringify({ status: 'ok' });

Authentication

Webhook endpoints use the same authentication as the REST API. Include the API key in the request header:

BRAPITOKEN: {your-api-key}

Or use token-based authentication by first calling /userauthentication/auth.

Outbound Webhooks

For outbound webhooks — DonorPoint notifying external systems when events occur — use Event Handlers or Post-Processing Scripts with the HTTP call functions available in the scripting environment.