Capturing Twilio ApiException

Occasionally our system sends a SMS using Twilio to a number that fails for a persistent reason like a wrong number or the recipient having sent a “STOP” message back to us (which Twilio nicely manages for us).

We would like to capture those failures and handle some of them in different ways. I know we could use the Twilio webhook pointed back at custom code under the webdev module, but I was wondering if there was any way to just capture an event on the alarm notification failure directly. The Twilio module obviously already knows about these events since it is creating com.twilio.exception.ApiException events in the log. Is there some way we could trigger a script on those directly?

This would have to be functionality we add to the Twilio module ‘first-party’; you could make a post on our ideas forum about it.

https://inductiveautomation.canny.io/ignition-features-and-ideas/p/capture-twilio-apiexception

My comment above about capturing it via a standalone webhook doesn’t appear to be true since the Ignition Twilio module uses the TwiML API. The only workaround I currently see is periodically polling the Twilio API for the status of recently sent messages.

EDIT: There appears to be a “debug” webhook that captures all account errors and warnings you can setup under this URL:
https://www.twilio.com/console/debugger/alert-triggers

I think all of the notification profiles suffer from the same lack of ability to act on a failed notification in any way - they all just log the failure right now.

Obviously we need “alarmception”. Each alarm pipeline or notification profile should support triggering alarms when there is a delivery failure. :wink:

But, seriously, this is something we need to automate on our system as the public-facing behavior is currently less than ideal. We have no way to let the right people know that their alarms aren’t getting through, and important messages are possibly being missed.