Last active
August 29, 2015 14:23
-
-
Save jonleung/25c662e3e76c4acf7188 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The JS file containing the library is found at examplehost.com/static/baton.js | |
Once that file is executed, the global variable maestro which contains all of the module libraries will be ready. Any messages from the server that are not caught with callbacks will automatically be logged in the console. | |
Examples: | |
maestro.Twilio.recieveSms("*", function(sms) { //recieve any incoming sms | |
maestro.Twilio.makeCall(e.From,e.To,maestro.Twilio.twiml().play(e.Body)); //call back playing any sound file in the message | |
console.log("Calling",e.From,"from",e.To,"playing",e.Body) | |
}); | |
Things Maestro does not have: | |
Any concept of a user, there will not be any security preventing one user from using anothers twilio number for example | |
Proper error reporting to users, it is currently very possible that an error with a request as minor as "+1number" vs "number" will not be reported | |
Modules: | |
Echo: | |
very simple module, probably not useful | |
Usage: | |
Echo.echo("Text to echo back",function(reply){ | |
console.log(reply); //prints "Text to echo back" | |
}); | |
Giphy: | |
Image search | |
Look here for more details | |
Usage: | |
Giphy.command("search query,id, etc",function(giphyReply){ | |
console.log(giphyReply); | |
}); | |
=> i.e. | |
=> Giphy.findFirstPhoto | |
Giphy.search("dinosaurs", function(giphyRespohse) { | |
}) | |
Giphy.searchById("129", function(giphyResponse) { | |
}) | |
=> What are the other commands that this will work with? | |
Giphy.getFirst("dinosaurs", function(photoUrl) { | |
gives me a dinosaur url | |
}); | |
Giphy.getFirst("dinosaurs", "small", function(photoUrl)) { | |
}) | |
Commands: | |
search | |
First param mapped to q | |
getById | |
If the first param is a string it is used on /v1/gifs/<id> | |
The first param can also be an array of ids [id1,id2,id3] | |
translate | |
First param mapped to s | |
random | |
First param mapped to tag | |
trending | |
Does not have a first parameter | |
Neutrino: | |
Currently unfinished | |
wraps the neutrino api | |
The most useful commands would be Geocode Address and Geocode Reverse | |
Twilio: | |
SMS and calling | |
Wraps both the Twilio Restful API and the TWIML API | |
Usage: | |
+=> Twilio.setDefaultNumber("610-761-0083"); | |
Twilio.sendSms("to-number", "from-number", "body"); | |
Twilio.sendSms("to-number", "body"); | |
-=> Thoughts on setting a default from number? Errors on any Twilio command where it is not set | |
- tradeoffs, less clear | |
- less typing | |
- could be confusing for recieveSms | |
=== Resolved, decided to keep from number because | |
- more extensible / ppl can wrap themselves | |
=> Thoughts on changing the order of | |
- "to-number", "from-number" | |
=> "from-number", "to-number" | |
=> What does this return? | |
=> How do I know what phone numbers are available to send and recieve from? | |
=> Twilio.sendMms("to-number", "from-number", "image-url"); | |
Twilio.recieveSms("from-number", function(twilioResponse){ //from-number can also be "*" which allows all recieved messages to be used | |
console.log(twilioResponse.Body); //prints the body of the text message | |
}); | |
var twiml = Twilio.twiml(); | |
twiml.say("Hello World"); | |
twiml.pause(5); //if left empty it will default to 1 | |
twiml.play("http://here-and-now.info/audio/rickastley_artists.mp3"); | |
twiml.say("You can").pause().say("also link them together like this"); | |
Twilio.makeCall("to-number","from-number", twiml); //there is currently no callback option for this, but it would be fairly easy to make | |
=> Twilio.call(...) (renaming the funtion from `makeCall` to `call`) | |
=> What does this return? | |
=> Twilio.callWithMusic("to-number", "from-number", "mp3-url") (plays 2 seconds after answer); | |
=> Twilio.callWithSpeech("to-number", "from-number", "text to say to the person") (plays 2 seconds after answer) | |
=> | |
Twilio.recieveTextsFrom("415-123-1222", function(sms) { | |
}); | |
Twilio.recieveTextsFrom("*", function(sms) { | |
}); | |
Twilio.recieveCall("from-number",twiml,function(e){ //this callback will be destroyed after the call is made | |
console.log(e.CallStatus); //likely will print "in-progress" | |
}); | |
=======> Random Things | |
Dweet has a pretty cool API | |
http://dweet.io/ | |
https://github.com/buglabs/dweetio-client | |
- can we make sure that all method names are camel case (the first char is lowercase) | |
How easy is it to make everything work from a get request? | |
api.maestro.hackedu.us?library=Twilio&command="sms_sms"&message="yo!" | |
Scratch: | |
{ | |
messages: { | |
[ | |
{ | |
From: | |
} | |
] | |
} | |
} | |
<input> phone | |
<input> message | |
sendMessage = function() { | |
Twilio.sendSms | |
} | |
submit.onclick = sendMessage | |
Twilio.callWithMusic | |
[number, number, number].forEach(function(number) { | |
Twilio.callWithMusic(number, "well known sound track.mp3") # HOLY SHIT! THATS COOL, HOW DO I DO IT. | |
}) | |
HTML / CSS | |
Scratch | |
PencilCode - Phaser -- TOOO COMPLICATED, processing doesnt have sprites, pixi is not clear, | |
Meastro before dom | |
Dom, they're learn | |
=> Don't return | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment