Sovereign AI workflows·Operational in 14 markets
Payments
Citizen Engagement

Refer complaints to regulated entities and monitor redress

Workflow purpose

This guide shows how to build a complaint referral workflow for central banks and financial supervisors. The workflow receives a citizen's complaint via a natural conversation, uses LLM actions to extract the complaint details and contact information, then creates a referral record and pushes it to the target institution's complaints endpoint via API. The citizen receives a reference number and a clear confirmation that their case has been referred. Every step runs within the AI agent's Actions, with no code required.

Who can benefit from this guide:

  • Central banks and financial supervisors operating consumer-protection or complaints desks
  • Government regulators referring citizen issues to commercial banks or fintechs
  • Ombudsman offices logging financial disputes for referral to the relevant institution
  • Citizen engagement teams reducing the burden of repetitive intake calls
  • IT teams deploying conversational AI across WhatsApp, web, and mobile channels for public services
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. Create the trigger

Purpose: Set up a new workflow to capture citizen complaint referral requests.

  • Navigate to the Actions tab in the AI agent settings.
  • Click + New workflow and click Message received as the trigger type.
  • Set Name to: Refer Complaint
  • Set Description to: Triggers when a citizen wants to file a complaint about a financial institution and have it referred for resolution.
  • Add training phrases: “File a complaint”, “My bank won’t help me”, “I want to report my bank”, “Complain about a financial institution”, “Refer my case to the regulator”, “I need help with a dispute”

2. Send an opening message

Purpose: Reassure the citizen and invite them to describe what happened before asking structured questions.

  • Add a Send message action under the trigger.
  • Set the message text to:

Hi! I can help you file a complaint and refer it to the appropriate institution for resolution. Just tell me what happened – include the name of the institution and as much detail as you can – and I’ll take it from there.

3. Extract complaint details

Purpose: Use the LLM action to extract the institution, complaint category, and description from the citizen’s message, looping conversationally until all required fields are confirmed.

Capture the message

  • Add a Set chat variable action after the Send message.
  • Set Variable name to complaint_input and Value to _user_input.

Configure the LLM action

  • Add an LLM action after the Set chat variable.
  • Set Model to GPT-4o and Temperature to 1.
  • Set Input text to {complaint_input}.
  • Set Output variable to complaint_details.
  • Paste the following system prompt into the System prompt field:

[Insert Code block here – paste the complaint details system prompt from the Notion source.]

Inside the Success branch

  • Add a Set chat variable as the first action – Variable: complaint_details, Chat script: _.json_parse(complaint_details).
  • Add a Branch action with the following condition:

[Insert Code block here – paste the branch condition from the Notion source.]

If true – follow-up needed:

  • Add a Send message: {complaint_details["follow_up_question"]}.
  • Add an Ask survey action – Variable: more_complaint, Type: Text, Skip: On.
  • Add a Set chat variable – Variable: complaint_input, Value: {complaint_input} {more_complaint}.
  • Add a Jump to action back to the LLM action to re-run extraction.

Else – all complaint details collected:

  • Add Set chat variable actions to unpack each field:
    • complaint_description = complaint_details["complaint_description"]
    • institution = complaint_details["institution"]
    • complaint_category = complaint_details["complaint_category"]
    • prior_contact = complaint_details["prior_contact"]

Inside the Error and Timeout branches

  • Add an Ask survey action – Variable: complaint_input, Type: Text, Required: On, Skip: Off.
  • Question: I didn't quite catch that. Could you describe the complaint again?
  • Add a Jump to action back to the LLM action.

4. Collect citizen contact details

Purpose: Gather the citizen’s personal details so the referral can be filed and a follow-up sent.

  • Add a Send message after the complaint extraction Else branch: Thank you. So we can file this on your behalf, please share your full name, national ID number, email address, and phone number.
  • Add a Set chat variable – Variable: citizen_input, Value: _user_input.
  • Add a second LLM action – Input: {citizen_input}, Output variable: citizen_details.
  • Paste the following system prompt:

[Insert Code block here – paste the personal details system prompt from the Notion source.]

  • Inside the Success branch: parse with _.json_parse(citizen_details), check the follow_up_question branch condition, and loop with more_citizen appended to citizen_input – same pattern as Step 3.
  • In the Else branch, unpack: full_name, id_number, email, phone.

5. Collect supporting documents

Purpose: Give the citizen an opportunity to upload evidence before the referral is submitted.

  • Add a Send message: Do you have any supporting documents – statements, screenshots, or letters – you'd like to include?
  • Add an Ask survey action – Variable: evidence, Type: Attachment, Skip: On.

6. Confirm and submit the referral

Purpose: Let the citizen review everything captured, then create a ticket and push the referral to the institution via API.

  • Add a Send message after the Ask survey:

Here’s what I have – Name: {full_name} | ID: {id_number} | Institution: {institution} | Category: {complaint_category} | Details: {complaint_description}. Shall I refer this now?

  • Add Quick reply options: “Yes, refer my complaint” | “No, let me correct something”
  • Add a Set chat variable immediately after – Variable: referral_choice, Value: _user_input.
  • Add a Branch action on referral_choice:
    • If _.lower(referral_choice) == "no, let me correct something": capture correction with Ask survey into complaint_input and Jump to action back to the complaint LLM action.
    • If _.lower(referral_choice) == "yes, refer my complaint":
      • Add a Create ticket action – Subject: Complaint referral: {full_name} – {institution} | Description: Category: {complaint_category} | Institution: {institution} | ID: {id_number} | Prior contact: {prior_contact} | Details: {complaint_description} | Tags: complaint-referral, {complaint_category}
      • Add a Send API request to push the referral to the institution’s complaints endpoint. Pass {full_name}, {id_number}, {email}, {phone}, {institution}, {complaint_category}, {complaint_description}. Set Output variable to referral_response.
      • Add a Set chat variable – Variable: referral_response, Chat script: _.json_parse(referral_response).
      • Add a Branch: if referral_response["id"] != none, send confirmation:

Your complaint has been referred to {institution} with reference {referral_response[“id”]}. Our team will follow up and let you know as soon as there is an update. Thank you for reporting this, {full_name}.

  • Otherwise, send an error message and route to Human handoff.

7. Test the flow

Purpose: Validate the full complaint intake and referral sequence using the AI agent tester before going live.

  • Open the AI agent tester panel on the right side of the workflow builder.
  • Type “I want to file a complaint” – confirm the opening message appears and the LLM asks about the institution.
  • Provide a complaint description without naming the institution – confirm the LLM asks a conversational follow-up.
  • Provide all complaint details – confirm the citizen contact section triggers.
  • Provide all contact details – confirm the evidence upload step appears.
  • Choose “Yes, refer my complaint” – confirm the ticket is created and the API fires with the correct reference.
  • Choose “No, let me correct something” – confirm the flow loops back to the complaint extraction correctly.
  • Simulate a failed API response – confirm the flow routes to Human handoff with an empathetic message.