Automation library · Customer support

Build an AI-powered SMS support system with Twilio and OpenAI

Started by another system calling it, and works across Gmail, Postgres and S3. It hands the judgement calls to OpenAI. 40 steps, 3 branches: large, and worth reading before you trust it with anything live.

LargeCalls a model: OpenAI

40 stepsLarge: read it before trusting it with anything live
3Branches: places the flow splits
0Loops or waits
3Services it connects to

The flow

Starts it 8Model 5Logic 11Service 16

The steps in the order they run, from what starts it.

  1. 1Incoming SMS Webhook (Twilio)WebhookStarts it
  2. 2Follow-Up Cron (24h)CronStarts it
  3. 3User Signup Webhook1WebhookStarts it
  4. 4Verify Code Webhook1WebhookStarts it
  5. 5Extract SMS Data1CodeLogic
  6. 6Find Inactive SessionsPostgresService
  7. 7Generate Verification Code1CodeLogic
  8. 8Extract Verification Data1CodeLogic
  9. 9Find User Session1PostgresService
  10. 10🤖 AI Personalized ReminderOpen AiModel
  11. 11Store VerificationPostgresService
  12. 12Check VerificationPostgresService
  13. 13🤖 AI Sentiment AnalysisOpen AiModel
  14. 14Send Reminder SMSHttp RequestService
  15. 15Send Verification SMS (Twilio API)Http RequestService
  16. 16Validate CodeSwitchLogic
  17. 17Process AI AnalysisCodeLogic
  18. 18Signup Response1Respond To WebhookStarts it
  19. 19Create SessionCodeLogic
  20. 20Verify Failed ResponseRespond To WebhookStarts it
  21. 21🤖 AI Escalation RouterSwitchLogic
  22. 22Mark VerifiedPostgresService
  23. 23Insert SessionPostgresService
  24. 24Prepare Escalation Data1CodeLogic
  25. 25🤖 AI Intent RouterSwitchLogic
  26. 26Verify Success ResponseRespond To WebhookStarts it
  27. 27Mark Session EscalatedPostgresService
  28. 28🤖 AI Intake EnrichmentOpen AiModel
  29. 29Prepare CloseoutCodeLogic
  30. 30Send Escalation EmailGmailService
  31. 31Merge Enriched DataCodeLogic
  32. 32Finalize SessionPostgresService
  33. 33Upload to S3Aws S3Service
  34. 34Send Escalation SMS1Http RequestService
  35. 35Save Enriched Intake1PostgresService
  36. 36🤖 AI Personalized CloseoutOpen AiModel
  37. 37SMS Webhook ResponseRespond To WebhookStarts it
  38. 38🤖 AI Response GeneratorOpen AiModel
  39. 39Send Closeout SMSHttp RequestService
  40. 40Send AI Response SMSHttp RequestService

How it's built

Starts on
Another system calling it
Steps
40, with 3 branches
Size
Large: read it before trusting it with anything live
Connects to
Gmail, Postgres, S3
Model
OpenAI

Questions

What does it need to run?

An n8n account, plus your own Gmail, Postgres and S3 accounts, and a key for OpenAI. You connect your own accounts after importing it; none are included.

What starts it?

It starts on another system calling it.

Does it use AI?

Yes. It calls OpenAI. Model calls are billed by the provider, not by n8n.

How long does it take to set up?

Take your time. At 40 steps it is large: read it before trusting it with anything live.

How do I import it?

Copy the workflow, open a new workflow in n8n and paste. The steps appear on the canvas, ready for your own accounts.

Before you run it

Nothing here has been tested by us. It is somebody's working automation, read and described from its own steps. Treat the connections it wants as a list of accounts it will touch, and read the 40 steps before you point it at anything that matters.