Hi everyone, I’m Michael de St. Aubin, Kobo’s Partner Services lead, and I wanted to start off this new forum category by sharing a workflow I built that combines KoboToolbox REST Services, Microsoft Power Automate, and Twilio WhatsApp.
The goal was to automatically send respondents a unique ID code after they filled a beneficiary registration form. That code can then be used again in later forms (baseline, endline, etc.) without needing to re-enter personal details. Respondents can choose how to receive their code either email, WhatsApp, or both.
This post walks through the setup step by step.
Overview
- Respondent fills KoboToolbox registration form.
- REST Service pushes selected fields from the submission data to Power Automate.
- Power Automate evaluates communication preference.
- If email → send automated email with code.
- If WhatsApp → send approved WhatsApp template with code.
- Respondent keeps their code safe for future surveys without re-entering personal details.
1. Setting up the KoboToolbox REST Service
External references: Beginners guide to Power Automate flows, Support article on REST Services
To start, you need to create a Power Automate flow that can receive data from KoboToolbox.
In Power Automate, create a new Instant Cloud Flow and choose the trigger “When an HTTP request is received.”
Once the flow is saved, Power Automate generates a unique endpoint URL. This is what KoboToolbox will call every time a form submission is made.
Copy this URL.
Then, go to your KoboToolbox project settings → REST Services and create a new REST Service:
Endpoint URL: Paste the Power Automate URL here
Type: JSON
Select fields subset: Choose only the fields you want to send (e.g., first name, phone, email, unique ID, communication preference).
2. Define the data schema in Power Automate
Back in Power Automate:
-
Add a Request Body JSON Schema to match the fields Kobo is sending.
-
This makes it easier to reference fields later in the flow (e.g.,
first_name,uniqueID,code_distribution).
3. Conditional branching based on communication preference
In the registration form, respondents could indicate whether they preferred to receive their code via email or WhatsApp.
I added two conditions in Power Automate:
-
Condition 1: Email → If
code_distributioncontainsemail→ send email -
Condition 2: WhatsApp → If
code_distributioncontainsphone→ send WhatsApp
4. Sending email notifications with dynamic fields
External References: Power Automate mail documentation
For the email branch, I used the Send an email notification (V3) action.
-
The subject line and body include dynamic fields (first name and unique code).
-
The email text can include instructions, links, or branding.
5. Twilio WhatsApp prerequisites + pre-approved templates
External References: Twilio WhatsApp messages and Business account docs
This step can be a bit tricky and requires Twilio and Whatsapp Business accounts. It took a few tries and variations for Twilio to approve the body of my Whatsapp message.
Account setup:
- Have a WhatsApp Business Account (WABA) in Meta Business Manager and register a WhatsApp sender (phone number) in Twilio. This links your brand/number so you can send on WhatsApp.
Templates are required:
- For business-initiated messages, WhatsApp requires a pre-approved template. Templates are approved per language and must follow Meta policy (correct category, clear copy, placeholders like
{{1}}, etc.). Facebook for Developers
Using the template in your flow (what you’ll need in Step 6):
- Create the template in Twilio’s Content Template Builder, submit for approval, then use the returned Content SID and pass values via Content Variables (e.g., map
{{1}}to youruniqueID).
6. Sending WhatsApp messages via Twilio
For the WhatsApp branch, I connected Power Automate to Twilio’s WhatsApp Business API using an HTTP POST request.
-
Endpoint: Twilio Messages API
-
Headers:
Content-Type: application/x-www-form-urlencoded -
Body parameters:
-
To=whatsapp:+<recipient_number>(field from form) -
From=whatsapp:+<your_twilio_sender> -
ContentSid= your approved template SID -
ContentVariables= JSON mapping, e.g.,{"1":"@{triggerBody()?['.../uniqueID']}"}
-
7. Save & test the flow
-
Power Automate: Click Save and make sure the flow is Turned on.
-
Submit a test record: Fill the KoboToolbox form with a real test email/WhatsApp number (E.164 format, e.g.,
+15551234567). -
Verify in Power Automate: Open Run history → confirm the run fired → expand the trigger to see the payload → check which condition path ran.
-
Check delivery:
-
Email: confirm receipt (and spam).
-
WhatsApp: in Twilio Console → Monitor → Messaging → Logs, verify status = sent/delivered.
-







