Skip to content

Instantly share code, notes, and snippets.

@TelegramSam
Created March 22, 2011 20:33
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/881990 to your computer and use it in GitHub Desktop.
Save TelegramSam/881990 to your computer and use it in GitHub Desktop.
ruleset a8x117 {
meta {
name "CallFromEmail"
description <<
Place a call on inbound email
>>
author "Sam Curren"
logging on
key twilio {
"account_sid" : "--account_sid--",
"auth_token" : "--auth_token--"
}
}
dispatch {
domain "usbchainsaw.com"
}
global {
}
rule testing {
select when pageview ".*" setting ()
notify("CallFromEmail", "Testing call placed!");
fired {
raise explicit event "placecall" with message = "You have an unhealthy attraction to chainsaws";
}
}
//send an email to a8x117.dev@kynetxapps.net to fire this rule
rule receiveemail {
select when mail received
pre {
subject = event:param("subject");
message = "You got an email with subject #{subject}";
}
{
email:delete();
};
fired {
raise explicit event "placecall" with message = message;
}
}
rule placecall {
select when explicit placecall
pre {
message = event:param("message");
}
twilio:place_call("8018771564", "8016494601", "http://webhooks.kynetxapps.net/t/a8x117.dev/delivermessage");
//twilio:place_call("4354620197", "8016494601", "http://webhooks.kynetxapps.net/t/a8x117.dev/delivermessage"); fired {
fired {
set app:message message;
}
}
rule delivermessage {
select when twilio delivermessage
pre {
message = app:message;
}
twilio:say(message);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment