Conditionally iterating through Contacts? Conditional sendNotificationToContacts?

(Brian S) #1

I would like to selectively send notifications to designated contacts (selected by the contact input type on a location which has the Contact Book enabled). Specifically I’d like to have three contact lists for notifications: “always send notifications to these contacts”, “only send notifications to these contacts when they are present”, and “only send notifications to these contacts when they are away.”

I can easily use the contact input type to let the user create these three contact notification Collections. However, I don’t know how to iterate over the resulting Collections; I don’t know what structure each Collection element (a “contact”?) has, I don’t know how to associate a Collection element with a Presence sensor, etc. I’m unsure whether documentation exists on the Contact Book mechanisms including the contact input type and sendNotificationToContacts().

Has anyone done anything like this before? Does anyone have any helpful insight, or perhaps suggest a different approach? Thanks!