All Apps and Add-ons

Twilio SMS Alerting: When trying to send to multiple numbers, why are alerts only being sent to the first number in the list?

kgonz
New Member

I have installed the latest version of the Twilio SMS Alerting add-on and it works great for a singular number. However, when I try to use the send to multiple numbers feature, it only sends to the first number. I have verified the two phone numbers already, so whenever I swap their position in the list, only the first number gets it. At the moment, I only have a trial account with Twilio, but don't think that is the case. Looking at the python code, it seems good but I'm not very familiar with Python. Any assistance would be appreciated.

Looking into the logs, it seems my message for the second number gets this weird compared to my first sms where it actually displays the right message?

Twilio Logs:
1) sendmodalert - action=twilio STDERR - Sending SMS via Twilio from number=ValidSecondNumber to number= ValidSecondNumber with message= < Message SM2ee>
(had to give space in the first "<" because its displaying as blank. So that might be it because my second message is blank?

2) -0700 ERROR sendmodalert - action=twilio STDERR - data should be an integer, binary, or string, or sequence

0 Karma

kgonz
New Member

As I suspect the second message is becoming blank. As a workaround, I modified the for loop in twilio.py to this.

for number in numbers_list:  
            print >> sys.stderr, "INFO Sending SMS via Twilio from number=%s to number=%s with message=%s" % (from_number, number,settings.get('message'))   
            message = client.messages.create(body=settings.get('message'),to=number,from_=from_number)    
            print >> sys.stderr, "INFO Sent Twilio SMS message with sid=%s" % message.sid

It seems the message variable that was declared earlier on gets overwritten by the first for loop iteration so I changed it to always grab the message to send, settings.get('message')

0 Karma

TonyJobling
New Member

Where is this code to be found, and how do you edit it?

0 Karma

kgonz
New Member

Sorry for the late reply. I have it an on-premise Splunk and edited the source files when I integrated it in our environment. I can check the exact location if you need further specifics?

0 Karma

citysplunk
Engager

I'm also having this issue, but cannot edit the source code since I'm using Splunk Cloud.

Is there any other way to work-around this issue?

0 Karma

kgonz
New Member

Unfortunately, I havent worked with Splunk Cloud yet. I dont know if the updated version has resolved it and Im not sure in Splunk Cloud if you can edit source files for your own environments?

0 Karma

citysplunk
Engager

I'm afraid not. The 0.7 release still appears to have this bug.

https://github.com/damiendallimore/SplunkModularInputsPythonFramework/blob/master/implementations/tw...

What I've done is download and install the app in a local Splunk environment; making the modifications to not shadow the outer scope message variable. Then creating a Splunk app package by doing Splunk package app. Currently we are waiting for Splunk support to verify the safety of the modified app for installation.

0 Karma
Get Updates on the Splunk Community!

Federated Search for Amazon S3 | Key Use Cases to Streamline Compliance Workflows

Modern business operations are supported by data compliance. As regulations evolve, organizations must ...

New Dates, New City: Save the Date for .conf25!

Wake up, babe! New .conf25 dates AND location just dropped!! That's right, this year, .conf25 is taking place ...

Introduction to Splunk Observability Cloud - Building a Resilient Hybrid Cloud

Introduction to Splunk Observability Cloud - Building a Resilient Hybrid Cloud  In today’s fast-paced digital ...