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

How to work with the challenges

The challenges here are harder than the practice tasks, and are meant for those who finished and want to go deeper. Try on your own for at least 20 minutes before opening the hints, and the solution only after that. There is no single right solution: if your scenario meets the requirements, it is right.

Broken scenario โ€” find the bug

This is what real work looks like: something broke, and all you have is the History. Read the error, and pick the right fix.

Advanced: Group by: debt per client

๐Ÿ”ฅ Advancedโฑ๏ธ ~40 min

๐ŸŽฌ The scenario

Each client has several open invoices. Send one email per client with all their invoices.

๐ŸŽฏ The requirements

  1. Group by email.
  2. One email per client with a table.
  3. A total per client.

๐ŸŽฏ The desired result โ€” how the scenario should look and work

Click Run once and then each module: you will see its settings, and on the last module โ€” the output you should get.

๐Ÿ“ค Example of the final output
{
  "emails": 4,
  "invoices": 11
}

๐ŸŽฌ Stuck? To the guided solution with a click simulation โ†’

๐Ÿ’ก Hints (try without them first)
  • Array aggregator โ†’ Group by: email.
  • After Group by โ€” a bundle per group with an array.

Search Rows โ†’ Array aggregator (Group by: {{email}}) โ†’ Text aggregator? Not needed: in the email body {{join(map(array; "invoice"); ", ")}} and a total {{sum(map(array; "amount"))}}. A bundle per client = an email per client.

๐ŸŽฌ The guided solution โ€” a click simulation

๐Ÿ“ธ The illustrated guide โ€” step by step, click by click

For every step: a screenshot of the (simulated) Make editor with the click spot marked, and below it exactly what to click and what to type. You can work from here next to an open Make window.

  1. 1
    The open invoices
    Search Rows: status = open.
    Marked screenshot โ€” step 1: The open invoices
    ๐Ÿ“ธ Step 1.1 โ€” the red ring marks where to click
    Marked screenshot โ€” step 1: The open invoices
    ๐Ÿ“ธ Step 1.2 โ€” the red ring marks where to click
    1. In the left menu click Scenarios โ†’ + Create a new scenario.
    2. Click the scenario name at the top left (New scenario) and type: C06 - Debt per customer.
    3. Click the + (the big circle in the middle, or the half-circle to the right of the last module).
    4. In the search box type Google Sheets and click the Google Sheets app.
    5. In the list of actions choose Search Rows.
    6. In the Filter field type: status = open
    7. Click OK (or Save) to close the module window.
  2. 2
    Group by customer
    Array aggregator with Group by = email โ€” a bundle per customer.
    Marked screenshot โ€” step 2: Group by customer
    ๐Ÿ“ธ Step 2 โ€” the red ring marks where to click
    1. Click the + (the big circle in the middle, or the half-circle to the right of the last module).
    2. In the search box type Flow Control and click the Flow Control app.
    3. In the list of actions choose Array aggregator.
    4. In the Source Module field type: Google Sheets - Search Rows [1]
    5. In the Group by field map (drag from the panel or type): {{1.email}}
    6. Click OK (or Save) to close the module window.
  3. 3
    One email per customer
    In the body: the invoice list and the total.
    Marked screenshot โ€” step 3: One email per customer
    ๐Ÿ“ธ Step 3 โ€” the red ring marks where to click
    1. Click the + (the big circle in the middle, or the half-circle to the right of the last module).
    2. In the search box type Gmail and click the Gmail app.
    3. In the list of actions choose Send an email.
    4. In the To field map (drag from the panel or type): {{2.__IMTKEY__}}
    5. In the Subject field type: Open invoices summary
    6. In the Content field map (drag from the panel or type): Invoices: {{join(map(2.array; "invoice"); ", ")}} ยท Total ILS {{sum(map(2.array; "amount"))}}
    7. Click OK (or Save) to close the module window.
  4. 4
    Run
    The number of emails = the number of customers, not invoices.
    Marked screenshot โ€” step 4: Run
    ๐Ÿ“ธ Step 4 โ€” the red ring marks where to click
    1. Click โ–ถ Run once at the bottom left.
    2. When the run ends, bubbles with numbers appear above the modules. Click the bubble of the last module and check the Output.
    3. The output should look roughly like this:
      {
       "emails": 4,
       "invoices": 11
      }

Experts: A smart retry with backoff

๐Ÿ”ฅ๐Ÿ”ฅ Expertsโฑ๏ธ ~50 min

๐ŸŽฌ The scenario

An API that returns 429 with a Retry-After header. Respect it.

๐ŸŽฏ The requirements

  1. Read Retry-After.
  2. Wait by the value (up to 300 seconds).
  3. Up to 3 attempts.

๐ŸŽฏ The desired result โ€” how the scenario should look and work

Click Run once and then each module: you will see its settings, and on the last module โ€” the output you should get.

๐Ÿ“ค Example of the final output
{
  "attempts": 2,
  "statusCode": 200
}

๐ŸŽฌ Stuck? To the guided solution with a click simulation โ†’

๐Ÿ’ก Hints (try without them first)
  • Repeater 3 + a dynamic Sleep + a filter that stops after success.
  • Evaluate all states as errors: No so you can read the status yourself.

Repeater (3) โ†’ HTTP (Evaluate all states: No) โ†’ Router: 200 โ†’ continue (and Commit/finish); 429 โ†’ Sleep {{min(300; parseNumber(get(map(2.headers; โ€ฆ); 1)))}}. This is full control, compared with Break, which waits a fixed time.

๐ŸŽฌ The guided solution โ€” a click simulation

๐Ÿ“ธ The illustrated guide โ€” step by step, click by click

For every step: a screenshot of the (simulated) Make editor with the click spot marked, and below it exactly what to click and what to type. You can work from here next to an open Make window.

  1. 1
    A Repeater for three attempts
    A Repeater with Repeats = 3.
    Marked screenshot โ€” step 1: A Repeater for three attempts
    ๐Ÿ“ธ Step 1.1 โ€” the red ring marks where to click
    Marked screenshot โ€” step 1: A Repeater for three attempts
    ๐Ÿ“ธ Step 1.2 โ€” the red ring marks where to click
    1. In the left menu click Scenarios โ†’ + Create a new scenario.
    2. Click the scenario name at the top left (New scenario) and type: C06 - Smart retry.
    3. Click the + (the big circle in the middle, or the half-circle to the right of the last module).
    4. In the search box type Flow Control and click the Flow Control app.
    5. In the list of actions choose Repeater.
    6. In the Repeats field choose: 3
    7. Click OK (or Save) to close the module window.
  2. 2
    HTTP without stopping on an error
    Evaluate all states as errors: No โ€” so a 429 does not crash the scenario.
    Marked screenshot โ€” step 2: HTTP without stopping on an error
    ๐Ÿ“ธ Step 2 โ€” the red ring marks where to click
    1. Click the + (the big circle in the middle, or the half-circle to the right of the last module).
    2. In the search box type HTTP and click the HTTP app.
    3. In the list of actions choose Make a request.
    4. In the URL field type: https://api.example.com/orders
    5. In the Evaluate all states as errors field choose: No
    6. Click OK (or Save) to close the module window.
  3. 3
    Router by status
    200 โ†’ continue; 429 โ†’ Sleep by Retry-After (up to 300).
    Marked screenshot โ€” step 3: Router by status
    ๐Ÿ“ธ Step 3.1 โ€” the red ring marks where to click
    Marked screenshot โ€” step 3: Router by status
    ๐Ÿ“ธ Step 3.2 โ€” the red ring marks where to click
    1. Click the + (the big circle in the middle, or the half-circle to the right of the last module).
    2. In the search box type Flow Control and click the Flow Control app.
    3. In the list of actions choose Router.
    4. Keep the defaults.
    5. Click OK (or Save) to close the module window.
    6. Click the small + coming out of the Router (to its right) to open a new route.
    7. In the search box type Tools and click the Tools app.
    8. In the list of actions choose Set variable.
    9. In the Variable name field choose: ok
    10. In the Variable value field type: true
    11. Click OK (or Save) to close the module window.
    12. Click the ๐Ÿ”ง icon on the line between the last two modules โ†’ Set up a filter.
    13. In the Label field type: 200.
    14. In Condition set: 2.statusCode = 200 (pick the field from the panel, the operator from the list, and type a value).
    15. Click OK โ€” a funnel icon appears on the line.
    16. Click the small + coming out of the Router (to its right) to open a new route.
    17. In the search box type Tools and click the Tools app.
    18. In the list of actions choose Sleep.
    19. In the Delay field map (drag from the panel or type): {{min(300; parseNumber(get(map(2.headers; "value"; "name"; "retry-after"); 1)))}}
    20. Click OK (or Save) to close the module window.
    21. Click the ๐Ÿ”ง icon on the line between the last two modules โ†’ Set up a filter.
    22. In the Label field type: 429.
    23. In Condition set: 2.statusCode = 429 (pick the field from the panel, the operator from the list, and type a value).
    24. Click OK โ€” a funnel icon appears on the line.
  4. 4
    Run
    In the bubbles: attempt 1 got 429, attempt 2 succeeded.
    Marked screenshot โ€” step 4: Run
    ๐Ÿ“ธ Step 4 โ€” the red ring marks where to click
    1. Click โ–ถ Run once at the bottom left.
    2. When the run ends, bubbles with numbers appear above the modules. Click the bubble of the last module and check the Output.
    3. The output should look roughly like this:
      {
       "attempts": 2,
       "statusCode": 200
      }

Boss challenge: A transaction with Rollback

๐Ÿ‘‘ Boss challengeโฑ๏ธ ~60 min

๐ŸŽฌ The scenario

Moving stock between warehouses in a data store: take from warehouse A and add to B โ€” or nothing.

๐ŸŽฏ The requirements

  1. Two data store updates.
  2. An artificial failure in the second module.
  3. A Rollback that restores the first.

๐ŸŽฏ The desired result โ€” how the scenario should look and work

Click Run once and then each module: you will see its settings, and on the last module โ€” the output you should get.

๐Ÿ“ค Example of the final output
{
  "A": 50,
  "B": 20,
  "note": "rolled back"
}

๐ŸŽฌ Stuck? To the guided solution with a click simulation โ†’

๐Ÿ’ก Hints (try without them first)
  • A data store supports transactions.
  • Scenario settings: Auto commit off.

Scenario settings โ†’ Auto commit: No. Data store Update (A โˆ’10) โ†’ Data store Update (B +10, with a field that will cause an error) โ†’ Error handler: Rollback. Check that A's stock didn't change. With Auto commit on โ€” it would have changed.

๐ŸŽฌ The guided solution โ€” a click simulation

๐Ÿ“ธ The illustrated guide โ€” step by step, click by click

For every step: a screenshot of the (simulated) Make editor with the click spot marked, and below it exactly what to click and what to type. You can work from here next to an open Make window.

  1. 1
    Auto commit off
    Scenario settings โ†’ Auto commit: No โ€” so Rollback works.
    Marked screenshot โ€” step 1: Auto commit off
    ๐Ÿ“ธ Step 1.1 โ€” the red ring marks where to click
    Marked screenshot โ€” step 1: Auto commit off
    ๐Ÿ“ธ Step 1.2 โ€” the red ring marks where to click
    1. In the left menu click Scenarios โ†’ + Create a new scenario.
    2. Click the scenario name at the top left (New scenario) and type: C06 - Transaction.
    3. Click โš™๏ธ Scenario settings in the bottom bar.
    4. In the Auto commit field choose: No
    5. In the Allow storing of incomplete executions field choose: Yes
    6. Click OK.
  2. 2
    Take from warehouse A
    Data store Update: stock A โˆ’ 10.
    Marked screenshot โ€” step 2: Take from warehouse A
    ๐Ÿ“ธ Step 2 โ€” the red ring marks where to click
    1. Click the + (the big circle in the middle, or the half-circle to the right of the last module).
    2. In the search box type Data store and click the Data store app.
    3. In the list of actions choose Update a record.
    4. In the Key field choose: A
    5. In the qty field map (drag from the panel or type): {{2.qty - 10}}
    6. Click OK (or Save) to close the module window.
  3. 3
    Add to warehouse B (with a deliberate failure)
    Update B + 10, with a wrong field that causes an error.
    Marked screenshot โ€” step 3: Add to warehouse B (with a deliberate failure)
    ๐Ÿ“ธ Step 3 โ€” the red ring marks where to click
    1. Click the + (the big circle in the middle, or the half-circle to the right of the last module).
    2. In the search box type Data store and click the Data store app.
    3. In the list of actions choose Update a record.
    4. In the Key field choose: B
    5. In the qty field type: abc
    6. Click OK (or Save) to close the module window.
  4. 4
    Error handler: Rollback
    Right-click the second module โ†’ Add error handler โ†’ Rollback.
    Marked screenshot โ€” step 4: Error handler: Rollback
    ๐Ÿ“ธ Step 4 โ€” the red ring marks where to click
    1. Right-click module 2 โ†’ Add error handler.
    2. Choose the Rollback directive.
  5. 5
    Test
    Run and check in the data store that stock A did not change.
    Marked screenshot โ€” step 5: Test
    ๐Ÿ“ธ Step 5 โ€” the red ring marks where to click
    1. Click โ–ถ Run once at the bottom left.
    2. When the run ends, bubbles with numbers appear above the modules. Click the bubble of the last module and check the Output.
    3. The output should look roughly like this:
      {
       "A": 50,
       "B": 20,
       "note": "rolled back"
      }