Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Not quite true

...

Code Block
languagejs
themeConfluence
send_sms = defaction(to, from, message, account_sid, auth_token){
  base_url = <<https://#{account_sid}:#{auth_token}@api.twilio.com/2010-04-01/Accounts/#{account_sid}/>>
  http:post(base_url + "Messages.json"), form = 
             with form = {"From":from,
                 "To":to,
                 "Body":message
                })
}

The action takes the following arguments:

...

The action creates a base URL using the instructions in the Twilio API docs and then POST POSTs to that URL. 

We can test this action, by creating a rule that uses it as follows. 

...

Unlike many programming languages, KRL rules make a syntactic distinction between operations that merely read state and those that change it. The KRL prelude is expected to not have an effect on state, either internal or external to the ruleset. This is more than stylistic, ; there are security and programming advantages to this segregation. Specifically, the action (and postlude) are conditional while the prelude declarations are made any time the rule is selected (based on the rule's event expression)not. Consequently, state changes made in the prelude that affect state are difficult to guard.

...