![]() Given how easy it is to use this thing I’m sure my brother will be unleashing MMS powered memes at me any second now. Instead of sending memes to yourself, why don’t you create a Meme-o-gram and send memes to your friends? In fact, once you’ve built it feel free to send them to (248) 686-3637 to share them with me!īuilding a meme generator was a lot of fun and it shows off one creative way to use Twilio MMS.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.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |