The answer is to use a Webhook endpoint to communicate with KNS, rather than directly signaling an event.
You will signal your event like this:
http://webhooks.kynetxapps.net/h/a163x85.dev/echo?body=hi%20there
And such a rule:
rule x { select when webhook echo pre { body = event:param("body"); response = { 'thebody': body }; rjson = response.encode(); } send_directive("json") with body = rjson; }
For an answer like:
{"thebody":"hi there"}
Note the .dev in the URL to indicate the dev version of the application, echo as the name of the event and the domain of the webhook event.
The endpoint will even serve it with the appropriate json type / type.
Also note that you can return html, xml, js, plain text, and even redirects. For more information, see Webhook Endpoint Documents .
source share