In one sentence
Students work with lists (Iterator/aggregators/Repeater) and build scenarios that don't fall over (error handlers + incomplete executions).
Preparation before the session
Time plan
- 00:00โ00:15 Review: the CRM
- 00:15โ00:45 Iterator and aggregators
- 00:45โ01:05 Repeater, Sleep and rate limits
- 01:05โ01:20 โ Break
- 01:20โ02:00 Error handlers and incomplete executions
- 02:00โ02:15 Error alerts
- 02:15โ02:50 Building together: payment reminders
- 02:50โ03:00 Summary and practice
Lecture parts and activity type
| Part | Activity type |
|---|---|
| Iterator โ array โ bundles | Simulation |
| Aggregators โ bundles โ one | Simulation |
| Repeater, Sleep and rate limits | Explanation |
| Error handlers โ what happens when something fails | Simulation + table |
| Error types and how to recognize them | Explanation |
| Building together: payment reminders | Building together |
The 3 messages that must get across
- An Iterator only when there is an array inside a bundle.
- An error handler for every external module.
- Break + incomplete executions.
Questions for class discussion
- What's the price of an automation that fails silently?
- When is it better for the scenario to stop rather than continue?
- How would you like to receive error alerts?
Live demo script
Iterator and aggregators
- Input โ JSON โ Parse JSON with [{"client":"Alpha","amount":4200},โฆ].
- Iterator โ Flow Control โ Iterator โ Array: the output.
- Text aggregator โ Tools โ Text aggregator, Source: Iterator, Row separator: New row, Text: โข {{2.client}} โ ILS {{formatNumber(2.amount; 0; "."; ",")}}.
- Sum โ In Telegram: Total: ILS {{formatNumber(sum(map(1.array; "amount")); 0; "."; ",")}}.
- Send โ Telegram Send.
Repeater and pagination
- Repeater โ Flow Control โ Repeater: Initial value 1, Repeats 5.
- HTTP โ A URL with {{1.i}}.
- Filter โ length(data) > 0.
- Count โ Numeric aggregator, Source: Repeater, Function SUM, Value: {{length(2.data)}}.
Error handlers in action
- Setup โ Scenario settings โ Allow storing of incomplete executions: Yes.
- HTTP โ GET httpstat.us/503, Evaluate all states as errors: Yes.
- Break โ Add error handler โ Telegram (error.message) โ Break: Automatically complete execution: Yes, attempts 2, interval 1.
- Compare โ Swap Break for Resume (Output: statusCode = 0) and then Ignore. Check History.
- Clean up โ Cancel the runs in incomplete executions.
Problems students will run into
| Problem | Quick fix |
|---|---|
| Telegram was sent 3 times | The aggregator is missing or the source module is wrong. |
| sum returns 0 | amount is text โ parseNumber, or map on the right field. |
| Only 20 results | The aggregator's source module is the HTTP instead of the Repeater โ check. |
| The Repeater doesn't appear | It's under Flow Control. |
| Break doesn't save | Incomplete executions is off. |
| The handler isn't called | Evaluate all states as errors is off โ 503 counts as success. |
| daysLate is negative | The invoice isn't overdue yet โ that's fine, the filter will stop it. |
| 2 reminders were sent on the same day | Update didn't run (an error) โ check the Resume, or a date comparison with spaces. |
Tips from the classroom
- Bring the scenario down on purpose in front of the class โ it's the most memorable.
- Draw the Iterator/aggregator as a funnel and a sieve.
- Have them calculate Credits before and after the run.
Adapting to different levels
For students who struggle: An Iterator + Text aggregator only.
For fast students: Group by, backoff and Rollback.
Answer key โ multiple-choice questions
Students see the answers in shuffled order, so the key gives the wording of the right answer.
| # | Right answer |
|---|---|
| 1 | Breaks an array into a bundle per item |
| 2 | The module it starts collecting bundles from |
| 3 | 300 seconds |
| 4 | Incomplete executions |
| 5 | Continues with a substitute value |
| 6 | Only actions in modules that support transactions |
| 7 | An alert to a person to renew the connection |
| 8 | 12 |
Homework
- The reminder system is active with Break.
- Preparing for session 7: create a
Salessheet with 30 rows: date, agent, product, amount, region.