Home Building Flows How to Create a Controlled Flow with External API

How to Create a Controlled Flow with External API

Last updated on Aug 27, 2026

What will you learn here?

This FAQ teaches, step by step, how to use Controlled Flows with Controlled Flow + External API to build a flow that:

  • Receives user input (e.g., ZIP code or order number)

  • Makes a request to an external API

  • Extracts and saves the returned data into variables

  • Returns a formatted response to Cláudia or directs the flow to N2


Step 1 – Create a new Controlled Flow

  1. Access Controlled Flows and click on "Create a Typebot"

  2. Start from scratch (blank bot)


Step 2 – Define the starting point (user input)

  1. Create a text input block

  2. Save user input (e.g., ZIP code) into a variable named zip


Step 3 – Configure the API call

  1. Add an HTTP Request block

  2. In the URL field, paste the API endpoint (e.g., https://viacep.com.br/ws/{{zip}}/json)

  3. Ensure the variable is within double curly braces ("{{}}"), as in {{zip}}.

  4. Method: GET


Step 4 – Test the request

  1. Click "Test Request"

  2. Enter a real test value (e.g., 01025-020)

  3. If the test fails, check if the link starts with https://


Step 5 – Map response fields

Once the request works, extract relevant data from the returned JSON. In the example, it returns:


Step 6 – Create the formatted response

Create a text block with the answer for the customer, using the extracted variables. Example:

"The ZIP code {{zip}} corresponds to the street {{street}}, in the neighborhood {{neighborhood}}, city {{city}}/{{state}}, DDD {{area_code}}."


Step 7 – Handling invalid ZIP codes

  1. Use a conditional block

  2. Check if the address variable exists:

    • If yes, proceed with the response

    • If no, send a message like "ZIP code not found" and return to Cláudia or redirect to N2


Step 8 – Returning to Cláudia

  • At the end of the flow, use the "Return to Cloud" block

  • If data was found, return a friendly response

  • If not, send a message indicating Cláudia should escalate to N2 (e.g., "Status not found. Please transfer.")


Step 9 – Publish and test with real tickets

  1. Click "Publish" at the top of the screen

  2. The flow will be available for real testing with tickets in Contents


Step 10 – Handle inputs with incorrect formatting

If the user enters ZIP code with dashes, spaces, or dots (e.g., 01.025-020), use intermediary blocks to sanitize the input (remove special characters).

Tip: use text transformation blocks or JavaScript scripts in Controlled Flows, if necessary.


Conclusion

With this Controlled Flow:

  • You automate external searches via API

  • Customize responses for the customer

  • Escalate only when necessary

  • You can replicate this model for order status inquiries, tracking, CPF verification, etc.


Other articles that may be useful