#576 — Email Webhook Integration for Merchant Tracking
Repo: Twill-AI/facade State: closed | Status: done Assignee: nadddder, sparsh-twillpayments
Created: 2025-09-11 · Updated: 2026-03-19
Description
We need to integrate EMS email events into database via webhook.
AC:
-
Set up webhooks to process incoming emails from @emscorporate.com sent to uw@twillpayments.com (Pass: TwillPayments123!)
-
Consider forwarded emails being processed same as direct emails
-
Parse email body and subject to find the matching merchant by name.
-
If no matching merchant is found, send an alert to Slack. If Merchant is found:
- Track the event on the merchant’s timeline under Gateway Message
- If a MID is found, attach it as a gateway to the matched PE merchant.
-
Idempotency: re-processing the same email should not create duplicate timeline entries or duplicate gateways.
-
A backfill endpoint/script
-
Unit tests covering merchant matching, timeline event creation, and gateway upsert.
-
track an email thread as a ticket thread in our system
Notes
Add implementation notes, blockers, and context here
Related
Add wikilinks to related people, meetings, or other tickets