Getting this flow to iterate over a list (sending messages to people in calendar events)

Hay everyone!

I’m trying to set up automated SMS reminders for my patients, but I’m stuck on what I think is the final hurdle.

As it is now, it pulls events from the next day, extracts the title, parses the text, uses the text to pull the contact, which is then passed into the messages block. The problem is that it only sends the message to the first person booked for the day, and not the rest. When I tried using the “repeat for each” scripting block (input from Upcoming Events), it texts the first person, x number of times - where x is the number of events booked.

I’m not sure if I explained the issue correctly, but I’m trying to get the flow to run through each event booked. Can anyone help? Here’s the iCloud link below:

Thanks so much :slight_smile: :slight_smile:

I can’t really test this but I’ve added in a repeat loop so it should work through all of the eight calendar items rather than just one, and I’ve simplified it a little bit with the use of magic variables. I hope :man_shrugging:t2:

Thank you for that, and thank you for adding the extra parameter in the contacts block and simplifying it :slight_smile:

Unfortunately it works for the first event of the day, but this time the subsequent texts don’t contain a contact :frowning: Would you have have any other ideas? I can’t seem to find another forEach function :frowning:

Maybe there’s a mistake in the shortcut, but equally it could be an issue with the data. It’s hard for me to figure out the former without the latter as that’s what drives everything.

Because I don’t have your calendar or your address book, I can’t see what is going on when you run it. Based on your original, everything contacts related is being derived from the event title. Therefore I would suggest using a quick look action to examine both the retrieved title and the found contact.

Off the top of my head, the things I’d be checking against are as follows.

  • It could be the event title has no details to search for.
  • it could be that no matching contact could be found.
  • it could be that the contact record has no messaging information.

To that end I’ve added several quick looks into the shortcut to try and show what is being picked up at each stage; including some intermediate ones for the above.

Hope that helps.

Sorry for the late reply, I’ve been swamped at work (that time of year) - but it works! Thank you so much for your time :slight_smile: You’re right, everything contact related (the name) was derived from just the event title. The quick looks gave all the correct outputs, and it still worked after removing the quick look blocks.

I’ll be sure to make use of quick look blocks in the future to make sure the data being passed is correct for future projects - thanks again :slight_smile: