Webhook endpoint that receives Notion database automation events. When a CRM entry is moved to βSend Emailβ status, this automatically sends the onboarding transactional email via Loops.
This is a webhook endpoint - called by Notion automations, not directly by users.
How It Works
- User submits email on website β stored in Notion CRM (Waitlist column)
- You manually move the card to βSend Emailβ column in Notion
- Notion automation triggers webhook to this endpoint
- Endpoint extracts email from payload and sends onboarding email via Loops
- Contact is automatically added to Loops audience (
addToAudience: true)
Notion Automation Setup
- Open your CRM database in Notion
- Click β¦ menu β Automations
- Create new automation:
- Trigger: Status set to Send Email
- Action: Send webhook
- URL:
https://searchcompany-main.up.railway.app/webhooks/send-onboarding-email
- Content: Check only Email property
- Click Enable
Request Body (from Notion Automation)
Notion automation sends the selected properties in the payload:
{
"source": {
"type": "automation"
},
"data": {
"properties": {
"Email": {
"type": "title",
"title": [
{
"type": "text",
"text": {
"content": "[email protected]"
}
}
]
}
}
}
}
Response
true if email sent successfully
Status message with recipient email
Flow Diagram
βββββββββββββββ βββββββββββββββ βββββββββββββββ
β Website ββββββΆβ Notion ββββββΆβ Backend β
β (submit) β β (Waitlist) β β (webhook) β
βββββββββββββββ βββββββββββββββ βββββββββββββββ
β β
β Move to β Send email
β "Send Email" β via Loops
βΌ βΌ
βββββββββββββββ βββββββββββββββ
β Notion β β Loops β
β (automation)β β (email) β
βββββββββββββββ βββββββββββββββ