Skip to content

Instantly share code, notes, and snippets.

@bradhintze
Created November 17, 2010 23:06
Show Gist options
  • Save bradhintze/704309 to your computer and use it in GitHub Desktop.
Save bradhintze/704309 to your computer and use it in GitHub Desktop.
SMS Quiz game for Defrag
dispatch {}
global {
Q2 = <<Great Job! Q2: Can you name the majestic tree that Lisa Simpson climbed in an effort to save it? Alas, it was hit by lightning.>>;
Congrats = <<Great Job! You’ve been entered into the Cylon Drawing. We’ll text you if you win. (powered by Kynetx + Twilio) www.kynetx.com>>;
Invite = <<Free Dev Day with Kynetx Fri in Broomfield. Get a dev accnt www.kynetx.com Integrate Twilio, Twitter, Facebook, Amz and more. Reply MORE for details.>>;
MoreInfo = <<Free Dev Day Fri in Broomfield. 9-5 Learn more about events, webhooks and more. Twilio to present also. Register http://kdevdayco.eventbrite.com>>;
Sorry = <<Sorry, I don't recognize your response or you answered the question wrong. Try again :)>>;
//logging form
formurl = "https://spreadsheets.google.com/formResponse?formkey=REDACTED";
}
rule logit {
select when twilio sms From ".*"
pre {
number = event:param("From");
body = event:param("Body");
}
http:post(formurl) with params = {"entry.0.single":number, "entry.1.single":body, "submit":"Submit", "pageNumber":"0","backupCache":""};
}
rule questionone {
select when twilio sms Body ".*30.*"
twilio:sms(Q2);
fired {
last
}
}
rule questiontwo {
select when twilio sms Body "[Ss]equoia" or twilio sms Body "[Rr]edwood"
{
twilio:sms(Congrats);
twilio:sms(MoreInfo);
}
fired {
last
}
}
rule more {
select when twilio sms Body "MORE|more"
twilio:sms(MoreInfo);
fired {
last
}
}
rule star {
select when twilio sms
twilio:sms(Sorry);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment