will be possible to send a HTTP request to Twilio HTTP API with the Post Event Handler ?
var trigger = data
|alert()
.crit(lambda: "value" >= crit)
.message(message)
.post()
.endpoint('twilio')
.captureResponse()
i configured twilio as endpoint in my kapacitor.conf file like this:
[[httppost]]
endpoint = "twilio"
url = "https://api.twilio.com/2010-04-01/Accounts/XXXXXXXXXX/Messages.json"
basic-auth = { username = "ZZZ", password = "YYY" }
alert-template-file = "/templates/twilio.tmpl"
But Twilio supports requests with the following format( in curl
):
curl -X POST https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Messages.json \
--data-urlencode "From=+15005550006" \
--data-urlencode "Body=Do. Or do not. There is no try." \
--data-urlencode "To=+14108675310" \
-u ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:<token>
But i don’t have idea how to set the --data-urlencode
properties with the current version of the Post Event Handler or if it is supported at leats. I tried with alert-template-file
in my kapacitor.conf file like this:
"Body"="{{.Message}}"
"From"="+11111111"
"To"="+11111111111"
but im not sure if that’s the way. Twilios responded with 400 ( From number is required )