Here are just some ideas for what could be added: Now that we have a functioning meme generator, we can build upon this to add even more features. Send in a valid meme sentence to test it out! Next steps Click on the number you wish to use for the meme generator and configure the Messaging URL to point at your newly deployed Sinatra server: Log in to Twilio and head over to the numbers portal. We need to connect our app to Twilio so that incoming texts will be routed to our app logic. There’s one more thing we need to do before we have a functioning meme generator. I recommend Heroku for this and this guide will show you how to deploy your Sinatra app to Heroku. That’s it, now you can generate all the memes with a simple text message! You should deploy your server code somewhere publicly accessible so that Twilio will be able to contact your server. To make this project work we’re going to need to install some Ruby Gems: This directory is where we’ll be putting all of our application code so change into this directory. Now that we have that prerequisite squared away, open up a terminal window and create a new folder called “memegen”. For the Linux users that might need a refresher on package management, here’s a guide for using apt-get in Ubuntu. For Windows users, I would recommend checking out Ruby Installer. If you are on a Mac, this should already be the case. To get started on this project you are going to need to have Ruby and Ruby Gems installed. The full project code is available if you want to follow along: Github Setting up the project (Note: Make sure to set your Imgflip API credentials in the environment variables section.) If you want to see this in action before digging into the code, you can deploy your own instance of this project to Heroku with the handy Heroku Button below. If a meme is matched we’ll make a REST request to the Imgflip API to create a meme and use the resulting image URL to send an MMS back to the user. To make all of this happen we’ll use a Sinatra server with the twilio-ruby helper library to handle incoming texts. Any text message that is not “list” and does not match a meme format will return a text message indicating that the meme was not recognized and to use the “list” keyword to find valid formats. The user can also text the word “list” to be presented with a list of valid meme formats. For instance, an incoming text starting with the words “Brace yourselves” will match the “Brace yourselves” meme. The app will include a list of meme formats that it will match incoming text messages against. An Imgflip account – signup for free here.An MMS-enabled Twilio phone number (available in the United States and Canada).A Twilio account - you can sign up for one here for free.You can give the meme generator a try by sending the word “list” to one of the following numbers (depending on if you are in the US or Canada): United States: (215) 240-7664 Canada: (587) 410-6363 If you can’t wait because you’re super stoked about generating memes using a text message, I don’t blame you. I want to show you how I built it so you can get started on your own variations. So, this is exactly what I built for the Twilio MMS launch. The lowest friction way to accomplish the task would be to translate a sentence sent in via SMS into a meme picture returned to his phone. What would make it even easier for my brother to meme-roll me? I didn’t want him to have to switch context out of sending text messages just to generate a meme. The launch of Twilio MMS made me think about the process involved in sending those memes. Working on a seemingly impossible task? There’s a quick “one does not simply.” coming my way. ![]() When I’m stuck with a decision between two desirable things, I’m very likely to receive a “why not both?” meme. ![]() When I think of the most hilarious text message conversations I have ever had with my 26-year-old little brother they almost all involve memes.
0 Comments
Leave a Reply. |