In today's competitive landscape, the moments after a user signs up for your product are golden. A generic "Welcome!" email is no longer enough. True engagement comes from understanding who your new user is, what their company does, and how you can deliver immediate, personalized value. But orchestrating this level of intelligence manually is impossible to scale.
This is where event-driven automation, powered by AI, changes the game. Instead of reacting with static, pre-canned responses, you can trigger dynamic, intelligent processes that research, personalize, and execute complex business logic in real-time.
At Workflows.do, we believe in turning these complex processes into reliable, event-driven services, all defined as simple Typescript code. Let's deconstruct our onUserSignup example to show you just how powerful this can be.
Imagine a new user just signed up. This is our event. With that single event, we can kick off a sophisticated chain of actions designed to create the perfect onboarding experience.
Here is the entire workflow, written as code:
import { AI } from 'workflows.do'
export default AI({
onUserSignup: async ({ ai, api, db, event }) => {
const { name, email, company } = event
// Enrich contact details with lookups from external data sources
const enrichedContact = await api.apollo.search({ name, email, company })
const socialProfiles = await api.peopleDataLabs.findSocialProfiles({ name, email, company })
const githubProfile = socialProfiles.github ? await api.github.profile({ profile: socialProfiles.github }) : undefined
// Using the enriched contact details, do deep research
const companyProfile = await ai.researchCompany({ company })
const personalProfile = await ai.researchPersonalBackground({ name, enrichedContact })
const githubActivity = githubProfile ? await ai.summarizeGithubActivity({ githubProfile }) : undefined
// Schedule a highly personalized email sequence to optimize onboarding
const emailSequence = await ai.personalizeEmailSequence({ name, company, personalProfile, companyProfile, githubActivity })
await api.scheduleEmails({ to: email, sequence: emailSequence })
// Summarize everything, save to the database, and post to Slack
const details = { enrichedContact, socialProfiles, githubProfile, companyProfile, personalProfile, githubActivity, emailSequence }
const summary = await ai.summarizeContent({ length: '3 sentences', details })
const { url } = await db.users.create({ name, email, company, summary, ...details })
await api.slack.postMessage({ channel: '#signups', content: { name, email, company, summary, url } })
},
})
It looks like straightforward code, but it represents a powerful business automation engine. Let's break it down, step-by-step.
export default AI({
onUserSignup: async ({ ai, api, db, event }) => {
const { name, email, company } = event
// ...
The workflow is triggered by an event named onUserSignup. This could come from a webhook in your application, a form submission, or a direct API call. The event object contains the initial payload—in this case, the new user's name, email, and company.
Notice the arguments passed to our function: ai, api, db, and event. The Workflows.do platform provides these pre-configured clients, giving you instant access to AI agents, third-party APIs, and your database without any boilerplate setup.
// Enrich contact details...
const enrichedContact = await api.apollo.search({ name, email, company })
const socialProfiles = await api.peopleDataLabs.findSocialProfiles({ name, email, company })
const githubProfile = socialProfiles.github ? await api.github.profile({ profile: socialProfiles.github }) : undefined
A name and an email are just the beginning. The first real action our workflow takes is to gather intelligence. Using the built-in api client, it seamlessly connects to external tools:
This is a core principle: orchestrate actions across your entire tech stack to build a complete picture of your user.
// Using the enriched contact details, do deep research
const companyProfile = await ai.researchCompany({ company })
const personalProfile = await ai.researchPersonalBackground({ name, enrichedContact })
const githubActivity = githubProfile ? await ai.summarizeGithubActivity({ githubProfile }) : undefined
This is where Agentic Workflows come to life. These are not simple function calls; they are instructions to autonomous AI agents.
In minutes, the workflow completes research that would take a human sales or success associate hours to compile.
// Schedule a highly personalized email sequence...
const emailSequence = await ai.personalizeEmailSequence({ name, company, personalProfile, companyProfile, githubActivity })
await api.scheduleEmails({ to: email, sequence: emailSequence })
Now, the workflow uses all the gathered intelligence as context. It doesn't just insert a first name into a template. It passes the comprehensive user, company, and activity profiles to another AI agent tasked with a creative goal: personalizeEmailSequence.
This agent crafts a unique email sequence that can reference the user's company's latest funding round, congratulate them on a recent project found on GitHub, or align the product's value proposition with their specific role. The result is an email that feels personal, relevant, and incredibly valuable. The workflow then schedules it for delivery via the api client.
// Summarize everything, save to the database, and post to Slack
const details = { ... }
const summary = await ai.summarizeContent({ length: '3 sentences', details })
const { url } = await db.users.create({ name, email, company, summary, ...details })
await api.slack.postMessage({ channel: '#signups', content: { name, email, company, summary, url } })
A good business process is transparent and auditable. The workflow concludes by:
The true power of Workflows.do is that this piece of code isn't just a script—it's a fully managed, reliable service.
By defining business logic as code, you create a reusable, version-controlled, and infinitely scalable asset. You've transformed a manual, inconsistent task into an intelligent, automated service that runs 24/7.
Ready to stop writing simple scripts and start building intelligent, event-driven services? Learn more at Workflows.do.