# Track MPESA and Airtel mobile payments: n8n workflow template

> Started by someone opening a chat with it, and works across Twilio and n8n data table. It hands the judgement calls to Gemini.

Source: https://millionrounds.com/workflow/track-mpesa-and-airtel-mobile-payments (Millionrounds; every figure on the page links to its filing or article)

[Automation library](https://millionrounds.com/workflows) · [Money admin](https://millionrounds.com/workflows?category=Money+admin#library)

# Track MPESA and Airtel mobile payments

Started by someone opening a chat with it, and works across Twilio and n8n data table. It hands the judgement calls to Gemini. 21 steps, 3 branches: large, and worth reading before you trust it with anything live.

Large Calls a model: Gemini

[Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Ftrack-mpesa-and-airtel-mobile-payments)

**21 steps** Large: read it before trusting it with anything live

**3** Branches: places the flow splits

**0** Loops or waits

**2** Services it connects to

## The flow

Starts it 2 Model 2 Logic 13 Service 4

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

- 1 **Webhook** Webhook *Starts it*
- 2 **When chat message received** Chat trigger *Starts it*
- 3 **Respond to Chat** Chat *Model*
- 4 **Edit Fields** Set *Logic*
- 5 **Classify Message** Code *Logic*
- 6 **Route** Switch *Logic*
- 7 **Drop original message** Set *Logic*
- 8 **Message a model** Google Gemini *Model*
- 9 **Delete payments** Data Table *Service*
- 10 **Fetch payments** Data Table *Service*
- 11 **Mpesa** Code *Logic*
- 12 **Airtel Money** Code *Logic*
- 13 **Merge** Merge *Logic*
- 14 **Code in JavaScript** Code *Logic*
- 15 **Create Message** Function *Logic*
- 16 **Create Summary** Function *Logic*
- 17 **Save payment** Data Table *Service*
- 18 **Build one object** Code *Logic*
- 19 **Valid message?** If *Logic*
- 20 **If sender is a phone** If *Logic*
- 21 **Send a WhatsApp message** Twilio *Service*

## How it's built

- **Starts on:** Someone opening a chat with it
- **Steps:** 21, with 3 branches
- **Size:** Large: read it before trusting it with anything live
- **Connects to:** Twilio, n8n data table
- **Model:** Gemini

## Questions

What does it need to run?

An n8n account, plus your own Twilio account, and a key for Gemini. You connect your own accounts after importing it; none are included.

What starts it?

It starts on someone opening a chat with it.

Does it use AI?

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

How long does it take to set up?

Take your time. At 21 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 21 steps before you point it at anything that matters.

## Run it in n8n

- **Create your n8n account** Free to start. n8n is where the workflow runs. [Create an n8n account ↗](https://millionrounds.com/n8n)
- **Download the workflow** Free with a Millionrounds account. [Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Ftrack-mpesa-and-airtel-mobile-payments)
- **Paste it into n8n** Open a new workflow in n8n and paste. Then connect your own accounts.

Stored with the author's traces removed: canvas notes, instance identifiers, saved credential names and any live document they had left behind.

## Connects to

Each opens the other workflows that use it.

[Twilio](https://millionrounds.com/workflows?service=Twilio#library)[n8n data table](https://millionrounds.com/workflows?service=n8n+data+table#library)

## Workflows like it

Also money admin, with the same services where possible, closest in size first.

- [**Generate research proposals with OpenAI** 21 steps · calls a model · n8n data table](https://millionrounds.com/workflow/generate-research-proposals-with-openai)
- [**Invoice overdue reminder system - delivered with Airtable** 21 steps · Airtable, Email](https://millionrounds.com/workflow/invoice-overdue-reminder-system-delivered-with-airtable)
- [**Vet supplier payments with Bright Data and OpenAI** 20 steps · calls a model · Slack, n8n data table](https://millionrounds.com/workflow/vet-supplier-payments-with-bright-data-and-openai)
- [**Chase unanswered quotes by SMS with Twilio** 20 steps · Twilio](https://millionrounds.com/workflow/chase-unanswered-quotes-by-sms-with-twilio)
- [**Validate incoming XRechnung invoices from IMAP and archive them** 20 steps · Email, n8n data table](https://millionrounds.com/workflow/validate-incoming-xrechnung-invoices-from-imap-and-archive-t)
- [**Generate invoices and send AI-powered reminders with Jotform** 23 steps · calls a model · Email, n8n data table](https://millionrounds.com/workflow/generate-invoices-and-send-ai-powered-reminders-with-jotform)
