Session 6 / 15๐Ÿ”Žืขื‘

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

  1. 00:00โ€“00:15 Review: the CRM
  2. 00:15โ€“00:45 Iterator and aggregators
  3. 00:45โ€“01:05 Repeater, Sleep and rate limits
  4. 01:05โ€“01:20 โ˜• Break
  5. 01:20โ€“02:00 Error handlers and incomplete executions
  6. 02:00โ€“02:15 Error alerts
  7. 02:15โ€“02:50 Building together: payment reminders
  8. 02:50โ€“03:00 Summary and practice

Lecture parts and activity type

PartActivity type
Iterator โ€” array โ†’ bundlesSimulation
Aggregators โ€” bundles โ†’ oneSimulation
Repeater, Sleep and rate limitsExplanation
Error handlers โ€” what happens when something failsSimulation + table
Error types and how to recognize themExplanation
Building together: payment remindersBuilding together

The 3 messages that must get across

  1. An Iterator only when there is an array inside a bundle.
  2. An error handler for every external module.
  3. 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

  1. Input โ€” JSON โ†’ Parse JSON with [{"client":"Alpha","amount":4200},โ€ฆ].
  2. Iterator โ€” Flow Control โ†’ Iterator โ†’ Array: the output.
  3. Text aggregator โ€” Tools โ†’ Text aggregator, Source: Iterator, Row separator: New row, Text: โ€ข {{2.client}} โ€” ILS {{formatNumber(2.amount; 0; "."; ",")}}.
  4. Sum โ€” In Telegram: Total: ILS {{formatNumber(sum(map(1.array; "amount")); 0; "."; ",")}}.
  5. Send โ€” Telegram Send.

Repeater and pagination

  1. Repeater โ€” Flow Control โ†’ Repeater: Initial value 1, Repeats 5.
  2. HTTP โ€” A URL with {{1.i}}.
  3. Filter โ€” length(data) > 0.
  4. Count โ€” Numeric aggregator, Source: Repeater, Function SUM, Value: {{length(2.data)}}.

Error handlers in action

  1. Setup โ€” Scenario settings โ†’ Allow storing of incomplete executions: Yes.
  2. HTTP โ€” GET httpstat.us/503, Evaluate all states as errors: Yes.
  3. Break โ€” Add error handler โ†’ Telegram (error.message) โ†’ Break: Automatically complete execution: Yes, attempts 2, interval 1.
  4. Compare โ€” Swap Break for Resume (Output: statusCode = 0) and then Ignore. Check History.
  5. Clean up โ€” Cancel the runs in incomplete executions.

Problems students will run into

ProblemQuick fix
Telegram was sent 3 timesThe aggregator is missing or the source module is wrong.
sum returns 0amount is text โ€” parseNumber, or map on the right field.
Only 20 resultsThe aggregator's source module is the HTTP instead of the Repeater โ€” check.
The Repeater doesn't appearIt's under Flow Control.
Break doesn't saveIncomplete executions is off.
The handler isn't calledEvaluate all states as errors is off โ€” 503 counts as success.
daysLate is negativeThe invoice isn't overdue yet โ€” that's fine, the filter will stop it.
2 reminders were sent on the same dayUpdate 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
1Breaks an array into a bundle per item
2The module it starts collecting bundles from
3300 seconds
4Incomplete executions
5Continues with a substitute value
6Only actions in modules that support transactions
7An alert to a person to renew the connection
812

Homework

  1. The reminder system is active with Break.
  2. Preparing for session 7: create a Sales sheet with 30 rows: date, agent, product, amount, region.