In a world where digital services are the backbone of every business, connecting them shouldn't be a manual, time-consuming task. We've all been there: copying data from a payment processor to a spreadsheet, manually notifying the team about a new support ticket, or painstakingly updating a CRM after a new user signs up. What if your applications could talk to each other instantly, the moment an event happens?
That's not magic; it's the power of webhooks. And this guide will show you how to harness them.
Webhooks are the secret ingredient behind modern, real-time automation. They are the digital glue that enables event-driven systems to react instantly to changes. At trigger.do, we believe they are fundamental to building powerful, agentic workflows. Let's dive into how you can use them to automate just about anything.
Imagine you're waiting for a package. You have two options:
A webhook is simply an automated message sent from one app to another when a specific event occurs. It’s a "user-defined HTTP callback." In simpler terms:
This event-driven approach is far more efficient and immediate than constantly asking, "Is there anything new yet?"
While the concept of webhooks is simple, managing the endpoint, ensuring reliability, and handling failures can be complex. That's where trigger.do comes in. We provide a simple API to build reliable, event-driven systems without the boilerplate.
Here’s how you can trigger a workflow from any webhook in just a few lines of code.
First, decide what event you want to automate. For this example, let's say we want to post a message to a Slack channel every time a new issue is created in our GitHub repository.
Next, you define a Job in your codebase using the trigger.do SDK. This Job will listen for the event.
import { eventTrigger } from "@trigger.do/sdk";
import { slack } from "@trigger.do/slack";
new Job(client, {
// This is the unique identifier for your Job
id: "github-to-slack-issue-notifier",
name: "GitHub to Slack Issue Notifier",
version: "0.0.1",
// eventTrigger will create a unique, secure webhook URL for you
trigger: eventTrigger({
name: "github.issues", // This is the name of the custom event
}),
run: async (payload, io, ctx) => {
// The 'payload' is the data sent from the GitHub webhook
const { action, issue, repository } = payload;
// We only want to run this workflow when an issue is 'opened'
if (action !== 'opened') {
return;
}
// Use the Slack integration to post a message
await io.slack.postMessage("send-to-slack", {
channel: "C12345678", // Your Slack Channel ID
text: `🚨 New Issue in ${repository.name}: "${issue.title}"\n<${issue.html_url}|View on GitHub>`,
});
await io.logger.info("Successfully sent a message to Slack.");
},
});
When you run your code, trigger.do automatically registers this Job and generates a unique, secure webhook URL for the github.issues event.
The final step is to tell the source application (GitHub) where to send its webhook notifications.
That's it! Now, every time a new issue is created in that repository, GitHub will fire a webhook to trigger.do, which will securely execute your code, and a notification will appear in Slack instantly.
What happens if Slack is temporarily down when your webhook fires? Traditional setups might just fail and lose the event. trigger.do is built for resiliency.
Webhooks are the key to unlocking powerful, real-time automation. By connecting the events in one application to actions in another, you can eliminate manual work, improve efficiency, and build smarter systems. With trigger.do, you have a simple, reliable, and developer-friendly platform to trigger anything and automate everything.
Ready to build your first event-driven workflow? Check out our docs and get started for free!
What is a workflow trigger?
A trigger is a specific event that initiates a predefined workflow or agentic action. It's the starting point for any automated process, like receiving a webhook, a scheduled time, or a custom API call.
What types of triggers does trigger.do support?
trigger.do supports a wide range of event sources, including HTTP webhooks from services like Stripe or GitHub, cron-based schedules for recurring tasks, direct API calls, and custom events from your own applications.
Can I chain multiple workflows together?
Yes. The completion of one workflow can be configured as a custom event to trigger another, allowing you to build complex, multi-step automations and stateful agentic processes.
How does trigger.do handle trigger failures or retries?
Our platform is built for reliability. We offer configurable automatic retries with exponential backoff for transient failures, detailed logging for debugging, and real-time monitoring to ensure your event-driven workflows run successfully.