This library provides easy access to the Relay Webhooks Resource.
- all(options, callback)
List all relay webhooks.
callback- executed after task is completed. required- standard
callback(err, data) err- any error that occurreddata- full response from request client
- standard
- find(webhookId, callback)
Retrieve details about a specified relay webhook by its id
webhookId- the id of the relay webhook you want to look up requiredcallback- see all function
- create(options, callback)
Create a new recipient list
options.target- url of the target to which to POST relay batches requiredoptions.domain- inbound domain associated with this webhook requiredoptions.name- user-friendly nameoptions.authToken- authentication token to present in the X-MessageSystems-Webhook-Token header of POST requests to targetoptions.protocol- inbound messaging protocol associated with this webhookcallback- see all function
- update(options, callback)
Update an existing relay webhook
options.webhookId- the id of the relay webhook you want to update requiredoptions.target- url of the target to which to POST relay batchesoptions.domain- inbound domain associated with this webhookoptions.name- user-friendly nameoptions.authToken- authentication token to present in the X-MessageSystems-Webhook-Token header of POST requests to targetoptions.protocol- inbound messaging protocol associated with this webhookcallback- see all function
- delete(webhookId, callback)
Delete an existing relay webhook
webhookId- the id of the webhook you want to delete requiredcallback- see all function
var SparkPost = require('sparkpost');
var client = new SparkPost('YOUR_API_KEY');
client.relayWebhooks.all(function(err, data) {
if(err) {
console.log(err);
return;
}
console.log(data.body);
});Check out all the examples provided here.