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
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')
Where is this code to be found, and how do you edit it?
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?
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?
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?
I'm afraid not. The 0.7 release still appears to have this bug.
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.