Skip to content

Instantly share code, notes, and snippets.

@remixz
Last active February 24, 2016 00:16
Show Gist options
  • Save remixz/95bb8d5176bf0592eaeb to your computer and use it in GitHub Desktop.
Save remixz/95bb8d5176bf0592eaeb to your computer and use it in GitHub Desktop.
add another thought

notes

passing thoughts

  • the email to get the promo code is an autoresponder, but it looks like a person's actual email. we should make it an @hackclub.com email.
  • when setting up the account, make sure to note that the credit card country is USA. for people not in USA, it defaults to their country.
  • i created a phone number myself with my area code, so i didn't have to worry about any long distance charges. however, this doesn't add the dweet webhook automatically, which made the demos not work until i deleted the number i made, and then realized it was automatically provisioning a US number with the dweet webhook. i think we should add the creation of a number to the tutorial, so that they can create a number in their location and not worry about fees. basic flow
    • go to https://www.twilio.com/user/account/phone-numbers/search
    • change country to current country (if not already set)
    • change the dropdown that says number to location
    • type in your current city
    • press search
    • look for the cheapest number that is in their area code, and ensure it has all three services enabled (voice, sms, mms)
    • click buy and then confirm in dialog
    • click setup number
    • scroll down to "messaging"
    • in "request URL", enter "https://dweet.io/dweet/for/NUMBER", where NUMBER is the number they chose, without any spaces, brackets or dashes (i.e. if the number is shown as (123) 456-7890, they would enter 1234567890)
    • save changes
  • alternatively, we could update our twilio library to get the user's country code somehow when provisioning the number, instead of defaulting to the US. to do it without user interaction from the browser (i.e. via the geolocation api), we could set up a small geo ip service. there's a few open source ones, here's one example: https://github.com/fcambus/telize
  • let's add a description of some of the important properties we get from the msg property passed in the callback when listening for messages, so that we can hack on it easier. full object for reference later:
{
	"toCountry": "CA",
	"toState": "British Columbia",
	"smsMessageSid": "<sid>",
	"numMedia": "0",
	"toCity": "",
	"fromZip": "",
	"smsSid": "<sid>",
	"fromState": "BC",
	"smsStatus": "received",
	"fromCity": "KELOWNA",
	"body": "Test",
	"fromCountry": "CA",
	"to": "<number>",
	"toZip": "",
	"numSegments": "1",
	"messageSid": "<sid>",
	"accountSid": "<sid>",
	"from": "<number>",
	"apiVersion": "2010-04-01"
}

post-workshop thoughts

  • this one was a lot of fun. i actually lost track of time with this one, since it was just fun to try things out. i definitely enjoyed this one more than the first tutorial.
  • the concepts are more advanced in this one, but i wonder if maybe this could be the first tutorial. creating a website is cool and all, but this definitely felt a lot more substantial. there also wasn't a whole lot of theory in this one, like there was with the first tutorial and its html/css theory. i think with some rewording, this might be a better first glimpse into a club. this just has a lot more potential than the personal website, since it can be used to create something actually useful. this can make goofy things like prank calls/texts too, but i think a lot of people will try to make something useful. i made a lyrics search using the genius api. https://definitelynew.github.io/twilio/ (note: uses a canadian number, so watch out for any long distance charges)
  • moving the personal website to a second tutorial makes more sense to me, since it's a bit more theory, involves a bit more searching the web for resources, and could also be used with what they learned from twilio. for example, they might look up how to make JS react to a form, and then use twilio to maybe send voice messages based on an input or something. obviously something to have a bigger discussion about, but these are my thoughts.
  • might be cool to do a part 2 to this tutorial, where we introduce writing this code on the server, so the user doesn't have to keep their browser open for their app to work. there's a cool site called tonic (https://tonicdev.com/), let's you have playgrounds that execute the JS with node. the cooler part is that it offers webhooks, where you just export a function, and when the page is visited, it runs the code. would require a couple tweaks to our custom twilio client, but definitely feasible, and would be a good introduction into creating resources. also could transition into bigger api resources for open data.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment