ifttt.com is an online automation platform that enables you to automate a lot of processes through bindings between some services. For example IFTTT can automatically send you an email once a forecast service detects a rain for tomorrow.
Thus IFTTT enables your bots to send any data to any of dozens services integrated into IFTTT. With IFTTT you don't have to integrate with Google Drive API to post some data from your bot to your Google Sheets for example. You just have to create an IFTTT applet and use an HTTP Request block in your scenario. No coding is required.
How to use IFTTT in Aimylogic
You have to create IFTTT applet - the pipe between your bot and the service you'd like to use.
An applet contains two parts - a trigger (it accepts an HTTP request from your bot) and an action (an actual service that does some useful stuff).
How to create a trigger
Go to ifttt.com and click on My Applets -> New applet in top right corner to create a new applet.
Click on this and search for webhook keyword in a query field. Click on Webhooks and then Receive a web request. Here you have to come up with some name for the event your bot will send to activate this applet. Just remember this event - we will use it in future.
Click on Create a trigger. See the short video below to see it in action.
How to create an action
Now we have to create an action - an actual function of our applet. You are free to select any service in IFTTT that has some appropriate function for you. Here in this guide we create an applet that writes some data to the Google Sheets.
Click on that and type sheet in the query field. Then click on Google Sheets and then Add row to spreadsheet.
A settings page appears. Here you can define a name of the file on Google Drive, a folder's name and the actual data you'd like to store in this file. in Formatted row field you have to define which cells you'd like to store. Each cell is separated by triple | from each other. Value1, Value2 and Value3 - are variable names. Your bot sends these variables through a HTTP Request to the webhook we created above. Thus you can forward these variables to any service in IFTTT (we store them to Google Sheet in this particular guide).
Note that IFTTT doesn't allow more that only three variables
Click on Create Action and then Finish.
How to use an IFTTT applet from the bot
To fire this applet from your bot you have to use an HTTP Request block. This block sends a JSON body with three variables to the URL of your IFTTT webhook, this webhook fires an action that obtains these variables and pipes them to the service configured as an action of the applet. IFTTT recognises an applet by the event name in the webhook's URL.
Obtain Webhook URL
First of all we have to obtain a Webhook's URL. It differs for every user of IFTTT.
Click on Search field on top of page and type webhook. Then select Services tab and click on Webhook. Then click on Settings button. A webhook's settings page appears.
Here you can find an URL. You have to copy it and paste it in your browser address line and hot Enter. The webhook test page appears. Here you can test your webhook. Just fill an event field and variables values. If there is some applet configured with a webhook as a trigger with this event name, IFTTT will fire an action and pass variables (Value1, Value2 and Value3) to the connected service.
Just copy your webhook's URL from the field named "Make a POST or GET web request to:" This URL you should use in HTTP Request block in Aimylogic. Create an HTTP Request block in your scenario and paste this URL there
Select POST instead of GET and fill the body with a JSON with value1, value2 and value3 fields. You can use any variables to pass actual values to the applet.
Note that you also have to define header Content-Type with value "application/json" on the Headers tab
Once your bot executes this HTTP Request block, your IFTTT applet fires through the event you've defined in URL. All variables from the body will be passed to the action in applet and it will perform some useful things. For example - it saves these variables' values to the sheet on Google Drive.
Published on: 03 / 10 / 2018