Skip to content

Instantly share code, notes, and snippets.

@TelegramSam
Created May 27, 2011 20:46
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TelegramSam/996138 to your computer and use it in GitHub Desktop.
Save TelegramSam/996138 to your computer and use it in GitHub Desktop.
krl webhooks module source
ruleset a8x157 {
meta {
name "Webhook Module"
description <<
Provides actions for working with the Kynetx Webhook Endpoint
>>
author "Sam Curren"
logging off
provides text, html, json, xml, js, redirect
}
dispatch {}
global {
text = defaction(textstring){
send_directive("text") with body = textstring;
};
html = defaction(htmlstring){
send_directive("html") with body = htmlstring;
};
json = defaction(json){
jstring = json.encode();
send_directive("json") with body = jstring;
};
xml = defaction(xmlstring){
send_directive("xml") with body = xmlstring;
};
js = defaction(jsstring){
send_directive("js") with body = jsstring;
};
redirect = defaction(url){
send_directive("redirect") with url = url;
};
}
rule test_text {
select when webhook testtext setting ()
text("mytesting");
}
rule test_html {
select when webhook testhtml setting ()
html("<h1>Testing HTML</h1>");
}
rule test_json {
select when webhook testjson setting ()
json({"mytest":"myvalue"});
}
rule test_xml {
select when webhook testxml setting ()
xml("<myxml>myvalue</myxml>");
}
rule test_js {
select when webhook testjs setting ()
js("alert();");
}
rule test_redirect {
select when webhook testredirect setting ()
redirect("http://www.baconsalt.com");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment