Eating a healthy, balanced diet is an important part of maintaining good health, an can help you feel your best. You know it ! But there is McDonald's and you are addicted to it. No Panic ! I have a solution.

For you, we want to develop a program where you can receive a healthy food picture every time McDonald's publishes on Twitter.

How it works ?

The keypoint of the solution is application programming interfaces (APIs), wich enables us to link different softwares together. Here we will use Zapier, an automated workflow that connects services together. With Zapier we can connect two or more apps to automate repetitive tasks without coding or relying on developers to build the integration

Let me explain the process:

  • Step 1: Every time McDonald's publishes on Twitter, Zapier gets the information.Twitter's role as the receiver is to transmit the information he has received.
  • Step 2: Then, a whebook - which allows to communicate and send messages to a specific website - is generated in Zapier.
  • Step 3: The webhook initializes a program which will generate a healthy food picture, from a facebook page, and send back its url to Facebook Messenger.
  • Step 4: The client receive a Messenger message with the picture of the Facebook page.
  • Then you don't want eat a Big Mac anymore but fruits and vegetables ! Congratulations !!!

    What do you need ? (Tutorials)

    All these steps must be followed in order to create your API :

  • Sign in or sign up on Zapier ;
  • Click on "Make a Zap" and choose a name for your Zap ;
  • Our trigger n°1 is "Twitter", so search and select this app ;
  • Clik on "User Tweet" in the Trigger event box ;
  • Sign in to Twitter ;
  • Put "@McDonald's" in the box Set up trigger ;
  • Then let Zapier test your trigger ;
  • Then we use "Webhooks by Zapier", so search and select this app ;
  • Clik on "Catch Raw Hook" in the Trigger event box ;
  • Copy the link and then "Continue" ;
  • Then we will need to develop a code in Glitch in order to code , in "server.js" ;
  • Finally, let Zapier test your trigger ;
  • Our trigger n°3 is "Messenger", so search and select this app ;
  • Clik on "Send Message from Page" in the box Action event ;
  • Sign in to Facebook Messenger ;
  • Click on Set up action ;
  • Put "@healthyfoodlemag" in the Page box ;
  • Put your username in the Recipient ID box ;
  • Put "Have a good meal !" in the text if you need some motivation ;
  • Click on continue ;
  • Then let Zapier test your trigger ;
  • Click on "Turn on Zap".
  • You are ready to give up McDonald's and start a new life !!!

    Sources of inspiration

  • Cats against Trump : an application where you can sign in to receive a cat gif every time president Trump sends a new tweet.
  • Chuck Norris : a hilarious API that provides random jokes and memes about the great American hero.
  • Spoonacular: an API with a unique food ontology that allows to build semantic relationships between ingredients, recipes, and store products.