If you've ever built an application that needs to notify external systems, you know the pain of webhooks. You start with a simple POST request, but soon you're building custom retry queues, implementing complex signing mechanisms, and struggling to debug failed deliveries. What if you could offload all that heavy lifting?
Welcome to Webhooks as a Service.
At webhooks.do, we believe your developers should focus on core product features, not on building and maintaining webhook infrastructure. Our unified webhook API allows you to standardize how you send events, with delivery, security, and monitoring handled for you.
This guide will walk you through sending your first secure, monitored webhook in under five minutes using our SDK. Let's get started.
Before we begin, make sure you have:
First, let's add the webhooks.do Node.js SDK to your project. Open your terminal and run the following command:
npm install @do-inc/sdk
Or if you're using Yarn:
yarn add @do-inc/sdk
In the webhooks.do dashboard, you need to add a "Destination." A destination is simply the endpoint URL where you want to send your events. This could be a customer's server, a Slack integration, a Zapier workflow, or your own microservice.
For this tutorial, you can use a free service like webhook.site to create a temporary URL to receive and inspect your events.
Once you've created a destination in the dashboard, you'll get a unique destinationId (e.g., dest_123_acme_corp). Keep this handy for the next step.
Now for the fun part. With the SDK installed and your destinationId ready, you can send an event with just a few lines of code.
Create a new file (e.g., send-event.ts) and add the following code.
import { Webhooks } from '@do-inc/sdk';
// Initialize the client with your API key from the dashboard
const webhooks = new Webhooks({
apiKey: 'your_api_key' // <-- Replace with your actual API key
});
// A sample order object for our payload
const sampleOrder = {
id: 'order_abc_456',
customer: {
email: 'hello@example.com'
},
totalPrice: 49.99
};
// Define an async function to send the event
async function sendOrderConfirmation(order: any) {
console.log(`Sending event for order: ${order.id}`);
try {
await webhooks.send({
destinationId: 'dest_123_acme_corp', // <-- Replace with your destination ID
event: 'order.confirmed',
payload: {
orderId: order.id,
customerEmail: order.customer.email,
total: order.totalPrice
}
});
console.log('Event sent successfully!');
} catch (error) {
console.error('Failed to send event:', error);
}
}
// Call the function to send the event
sendOrderConfirmation(sampleOrder);
Before you run it, make sure to replace 'your_api_key' and 'dest_123_acme_corp' with your actual credentials.
Now, run the script from your terminal:
ts-node send-event.ts
That's it! You've just sent your first event through the webhooks.do unified API.
You wrote a few simple lines of code, but webhooks.do just did a lot of work for you:
By integrating a webhook management platform, you eliminate the need to build bespoke solutions for event delivery. You get a single, reliable API for all your event-driven integrations, freeing up your team to focus on what they do best: building your product.
Ready to standardize how you send and receive webhooks? Sign up for free at webhooks.do and ship your next integration with confidence.