In today's fast-paced digital environment, efficiency is king. Your business relies on a suite of powerful tools like Stripe for payments, GitHub for code, and Slack for communication. But when these tools don't talk to each other, you're left with manual, repetitive tasks that drain time and invite human error. What if you could connect them all, creating a seamless, automated workflow that just works?
Enter trigger.do, the platform for event-driven automation. With trigger.do, you can initiate complex workflows and agentic actions based on real-time events. This post will walk you through creating a powerful automation: when a customer pays via Stripe, a private GitHub repository is automatically created for them, and a notification is sent to your team's Slack channel.
Let's trigger anything and automate everything.
Imagine this common scenario:
Each step is a potential point of failure. Details can be mistyped, notifications can be forgotten, and as your business grows, this process becomes an unsustainable bottleneck.
The key to solving this is to think in terms of events and actions. The "event" or workflow trigger is the specific occurrence that starts the process. In our case, the trigger is a successful payment in Stripe. The "actions" are the tasks we want to automate in response: creating a GitHub repo and sending a Slack message.
trigger.do acts as the central nervous system for your applications. It listens for triggers from any source—webhooks, scheduled tasks, API calls, or custom events—and executes your predefined workflows with unparalleled reliability.
Let's build this automation. With the trigger.do SDK, you can define this entire multi-step process in a single, easy-to-read file.
First, we define our trigger. We'll listen for the customer.subscription.created event from Stripe. trigger.do provides a secure, reliable endpoint to receive this webhook, so you don't have to manage the infrastructure.
import { trigger } from "@do/sdk";
import { stripe } from "./integrations/stripe";
import { github } from "./integrations/github";
import { slack } from "./integrations/slack";
// Our main workflow trigger
const newCustomerOnboarding = trigger.on(stripe.events.customerSubscriptionCreated, {
name: "New Customer: Stripe to GitHub to Slack",
// ... the workflow logic goes here
});
Once the trigger fires, the run function is executed. It receives the Stripe event payload, which contains all the customer information we need. We'll use the customer's ID to create a unique repository name and then call the GitHub API to create it.
// ... inside the trigger definition
run: async (event, context) => {
const customerId = event.data.object.customer;
const repoName = `project-${customerId}`;
context.logger.info("New customer detected. Creating GitHub repo.", { customerId });
// Action 1: Create a private repository on GitHub
const repo = await github.repos.createForAuthenticatedUser({
name: repoName,
private: true,
});
// ... next action
}
With the repository created, the final step is to notify the team. We use the data from the previous steps—the customer ID and the new repository URL—to compose a helpful message and post it to a designated Slack channel.
// ... inside the run function, after creating the repo
context.logger.info("Repo created. Sending Slack notification.");
// Action 2: Post a message to the #new-customers channel
await slack.chat.postMessage({
channel: "#new-customers",
text: `🎉 New Customer Onboarded!
- *Customer ID:* ${customerId}
- *GitHub Repo:* <${repo.data.html_url}|${repoName}>`,
});
return { success: true, repoUrl: repo.data.html_url };
}
Here is the complete, production-ready workflow. It's concise, declarative, and powerfully connects three distinct services into one seamless process.
import { trigger } from "@do/sdk";
import { stripe } from "./integrations/stripe"; // Your configured integrations
import { github } from "./integrations/github";
import { slack } from "./integrations/slack";
// Trigger a workflow when a new subscription is created in Stripe
const newCustomerOnboarding = trigger.on(stripe.events.customerSubscriptionCreated, {
name: "New Customer: Stripe to GitHub to Slack",
run: async (event, context) => {
const customerId = event.data.object.customer;
const repoName = `project-${customerId}`;
context.logger.info("New customer detected. Creating GitHub repo.", { customerId });
// Action 1: Create a private repository on GitHub
const repo = await github.repos.createForAuthenticatedUser({
name: repoName,
private: true,
});
context.logger.info("Repo created. Sending Slack notification.");
// Action 2: Post a message to the #new-customers channel
await slack.chat.postMessage({
channel: "#new-customers",
text: `🎉 New Customer Onboarded!
- *Customer ID:* ${customerId}
- *GitHub Repo:* <${repo.data.html_url}|${repoName}>`,
});
return { success: true, repoUrl: repo.data.html_url };
},
});
Creating robust automations involves more than just calling APIs. trigger.do is engineered for reliability and scale.
You've just seen how to eliminate a tedious manual process and replace it with a fast, reliable, and scalable automated workflow. This is just one example. Imagine automating user de-provisioning, syncing data between a CRM and a support desk, or running nightly data processing jobs.
If you can script it, you can trigger it.
Ready to connect your digital world and automate everything? Get started with trigger.do today and build your first event-driven workflow in minutes.