Search code examples
twiliokrl

How would I send an SMS from a Kynetx app?


How would I send an SMS to a user using a Kynetx App and Twilio?


Solution

  • 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!"
         };
    }