Patient Experience

Capture consent before collecting voice data

Workflow purpose

This guide demonstrates how to use Proto's AI agents to ask for consent before any voice message is transcribed, and to keep a record of who agreed, when, and to which version of your notice.

The workflow uses two AI agents. The first works in text and buttons only, with voice recognition switched off. It explains how voice messages will be used, asks the person to agree, and records their answer. Only people who agree are handed to a second AI agent that accepts voice. Everyone else can continue in text.

In many communities one phone is shared by a family or a household, so consent from a phone number isn't consent from the person speaking. This workflow asks every time, records the name of the person agreeing, and closes the conversation at the end so the next person starts fresh.

Who can benefit from this guide:

  • Government programmes collecting voice data from citizens
  • Health services using voice for patient conversations
  • Financial inclusion programmes serving first-time phone users
  • Any organisation that needs recorded consent before processing voice

Capture consent before voice

This workflow records consent before any voice data is collected, for every person, on every phone. See how to build a voice consent workflow.

Just starting with the platform?
For initial setup of your AI agent – including workspace setup, agent training, and channel deployment – please start here. This workflow guide assumes your AI agent is set up and ready for more advanced configurations.

1. Set up two AI agents

Transcription is switched on or off for a whole AI agent, so consent and voice are kept in separate agents.

  • Consent agent – the agent people first reach on your channel. On its Voice tab, leave Enable speech-to-text recognition off. On Webchat, leave Enable audio messaging off.
  • Voice agent – the agent that handles your service. Turn Enable speech-to-text recognition on and select the languages you need.

Both agents should be in your AI Agent Network, so the consent agent can hand people to the voice agent.

People can only agree to what they understand.

Write the notice in each language you serve, in short sentences, covering what’s collected (voice messages and their transcripts), why, who can hear them, how long they’re kept, and how to withdraw. Give the notice a version number, e.g. v1.2, so you can tell which wording each person agreed to.

Put the full notice in the consent agent’s Knowledge base as a File or URL, so it can answer questions such as “Who will hear my voice?”.

In the consent agent, navigate to the Workflows tab and add a Message received trigger (e.g. “Consent”) with a description such as “Triggers when a user starts a conversation, says hello or asks for help.”

The consent agent has no other job, so make sure every first message leads to consent: under its Fallback trigger, add a Jump action to the Consent trigger.

If the person hasn’t chosen a language, add a Send message with a quick reply for each language, then a Switch language action.

4. Ask who is using the phone

On a shared phone, consent belongs to the person, not the number.

Add an Ask survey action. Action title: Person using the phone

Field Variable Type Invalid reply
What is your name? consent_name Text Please type your name
Is this your own phone, or shared? phone_type Text Please choose one of the options below

Add Quick answers to the second field: My own phone | Shared phone.

Add a Send message with the short notice, e.g.:

“{consent_name}, to help you faster you can send voice messages. Your voice messages will be turned into text and kept for 90 days by our team only. You can stop at any time by typing STOP. Do you agree?”

Add quick reply options: I agree | I don’t agree | Tell me more. Under Tell me more, add a Send attachment with the full notice, and repeat the question.

Ask on every new conversation, and never assume consent from an earlier conversation on the same number – it may have been someone else.

6. Record the answer

Under each answer, add Set variable actions:

Variable Chat script
consent_given "yes" or "no"
consent_time _.now("Asia/Karachi", "%Y-%m-%d %H:%M")
consent_version "v1.2"

Use your own time zone and notice version. Then add a Send API action (HTTP method: POST) to your consent register, sending consent_name, phone_type, consent_given, consent_time, consent_version, the language and {_channel_profile.phone_number}. The conversation itself also stays in the Inbox as a record.

7. Hand over, or continue in text

  • I agree: add a Send message (“Thank you. You can now send voice messages.”) and an AI agent handoff action to the voice agent. The voice agent can read {_transferred_context.consent_name} and {_transferred_context.consent_given}, so it can greet the person by name.
  • I don’t agree: add a Send message (“No problem – you can still use our service by typing.”) and continue in the consent agent in text, or hand over to a live agent. Never refuse the service because someone declines.

AI agent handoff works on Webchat, full-screen Webchat, WhatsApp and Messenger.

8. Handle voice messages sent too early

People may send a voice message before answering. With speech-to-text off, the consent agent doesn’t transcribe it – it arrives as an attachment.

Add an Attachment received trigger for audio in the consent agent, with a Send message: “I haven’t listened to your voice message. Please answer the question above first.” The file is still stored with the conversation like any attachment, so cover this in your data retention policy.

9. Let people withdraw, and close at the end

  • In the voice agent, add a Message received trigger for withdrawal (training phrases: STOP, I don’t want voice, withdraw consent, رک جاؤ). Under it, add a Send API action that updates the consent register, a Send message confirming it, and a Close chat action.
  • At the end of every service flow, add a Close chat action, so the next person to pick up a shared phone starts a new conversation and is asked for consent again.

10. Test the flow

Validate every path before going live using the AI agent tester side panel, and test on a real shared phone.

  • Agree, decline and ask for more information, and check each answer is recorded with the right name, time and version.
  • Send a voice message before answering and confirm it isn’t transcribed.
  • Agree, finish, then start again as a different person on the same phone, and confirm consent is asked again.
  • Withdraw consent and confirm the register is updated and the chat closes.
  • Build and test in an undeployed version – Duplicate the live version first – then Deploy it once every path passes.

Finalise the AI agent deployment by configuring your preferred channels and languages.