Skip to main content

Action - Iterate over a List

Introduction

This action supports handling each item in the item list sent from API and can only be used to trigger a subroutine.

REQUIRED INPUTS

  • List: pre-defined from the trigger event (normally it is API - General Purpose)
  • Iterated Action: pre-created Subroutine.
  • Max Allowed Iteration: the maximum number of items will be handled each time.

OUTPUT

  • List (the output of looping action)

Note:

Items will be handled in order.

  Sample Configuration

Requirement

Send customized SMS to Customers with unique Voucher information every time Developers call API and send an item list to the Flow.

Configuration

I. Create a Subroutine

  1. Click Create Flow > choose Event: When triggered by other flows >Create
    • Input:
      • Parameter Name 1: Name - Data type: String
      • Parameter Name 2: Number - Data type: String
      • Parameter Name 3: Voucher - Data type: String 2. Click on the (+) icon to addAction> choose Action:Send SMS Message (legacy)Create
  • Destinations: Click the 3-dash icon to choose the output of the Event > choose <Number>
  • Sender Name: choose a purchased number
  • Message: Type in as follows:
    • "Hi <Name>, thanks for being our loyal customer. To show our appreciation, here is a 30% voucher for your next purchase <Voucher>"

3. Click Deploy to make the Subroutine active

#### II. Create a Main Flow

  1. Click Create Flow > choose Event: API - General Purpose > choose Advanced>Create
    • Template: add the data template that you will send to this Flow over Open API > Click Extract Properties > the system will automatically extract the Field names properly
      • Sample:
1

2\{

3 "customers": [

4 \{

5"name": "John",

6 "voucher": "JH30T",

7"number": "+6581234567"

8}

9 ]}


3. Click on the (+) icon to add Action > choose Action:Iterate over a List

  • List: click the 3-dash icon to choose the output of the Event > chooseAPI - General Purpose> choose**$['customers']**
  • Iterated Action: choose the pre-createdSubroutine> choose data for the Subroutine's Inputs:
    • Name: click the 3-dash icon > choose API - General Purpose > $['customers'] > $['name']
    • Number: click the 3-dash icon > choose API - General Purpose > $['customers'] > $['number']
    • Voucher: click the 3-dash icon > choose API - General Purpose>$['customers'] > $['voucher']
  • Max Allowed Iteration:100

4. Click Deploy to make the Main Flow active