How would I send an SMS to a user using a Kynetx App and Twilio?
Asked
Active
Viewed 163 times
2 Answers
5
I had to do this manually using Twilio's API. Here is a rule which sends an SMS:
rule send_sms {
pre {
SMS_url = <<https://#{keys:twilio().pick("$.account_sid")}:#{keys:twilio().pick("$.auth_token")}@api.twilio.com/2010-04-01/Accounts/#{keys:twilio().pick("$.account_sid")}/SMS/Messages>>;
}
http:post("#{SMS_url}")
with params = {
"From":"+18015555555",
"To":"+18015555555",
"Body":"Hello World via SMS!"
};
}

Megan Speir
- 3,745
- 1
- 15
- 25

Jessie A. Morris
- 2,267
- 21
- 23
-
Ah. So you did it manually. Ok. I'm glad that you could get it working in any regard. – Alex Nov 19 '10 at 23:14
-
The KRL method for sending SMS didn't make it into the last code push but it will be there soon. – Mike Grace Nov 20 '10 at 03:26
1
Use the twilio:sms()
function. It takes one parameter, it's a string containing the text of the sms. Also make sure you have put your twilio keys in the meta block of your application. Something like this will do the trick:
rule send_sms {
select when pageview ".*"
{
twilio:sms("Wow! I'm sending a text message") with to = "1234567890"
}
}

Alex
- 64,178
- 48
- 151
- 180
-
1
-
Furthermore, it doesn't actually work. I think this is because it is not being run through webhooks.kynetx.com... – Jessie A. Morris Nov 19 '10 at 21:31
-
-
This works on a twilio phone call, but not to place a new outbound SMS if there is no phone call currently active. – TelegramSam Nov 29 '10 at 22:38