Ever want to track the number of replies to an email in your Gmail inbox? Last week, I wanted to track email replies to the “Invitation to Pair” email Keen IO users get from my teammates. If you’re a Keen IO user, you might have seen an email come from Joe, Maggie, or me offering to pair program with you. The emails are sent with Hubspot. Although we know how many emails are sent and how many links are clicked, we aren’t able to track the number of replies. It’s important to know this data since we each reply to many of these emails.
We’re an analytics company, we should be able to do this!
Then we got an idea!
Let’s try to use IFTTT. IFTTT (If This Then That) is a free web-based service that allows you to create chains of different services, called Applets. An Applet is triggered by changes that occur within web services, like Gmail. Basically, if this happens then that happens.
You can create Applets that send data to Keen IO with the Maker service as the Action. The Maker service allows “you can create Applets that work with any devices or apps that can make or receive a web request (aka webhooks).”
Luckily, we recently wrote a guide to help you send data to Keen IO with webhooks.
Photo by the amazing #WocInTechChat
For this example, we are going to show you how to send data from Gmail to Keen IO, but you can really send data from any IFTTT Triggers.
If you don’t already have a Keen IO account, sign up for a free one here. You will need this in a few minutes.
Next, you need to select “this” so we can select a service for our trigger. For this example, we are going to use Gmail for the service.
After you have selected “Gmail,” then we are going to use the “New email in inbox from search” Trigger so we can see when a specific email is replied to.
For our example, what we are searching for is going to be pretty simple:
Gmail’s search operators are super helpful for creating a search query. Our example’s is pretty simple, but you can make them more complex.
After we select “Create trigger,” we select “that” next.
This is where the Maker service comes into play, like searching for “Gmail” earlier, we search for “Maker.” Once the Maker service is selected, we choose the “Make a web request” action.
Now it is time to add your webhook that will stream data to Keen IO. The URL format will look like this:
You will need to replace
WRITE_KEY with your own values from the Keen IO project you want to use.
You can find
WRITE_KEY in the “Access” section in your project’s “Settings” tab. Your
EVENT_COLLECTION can be whatever name you would like it to be. In this example, a good event collection name would be “reply.”
Your Method will be POST since you are posting data to Keen.
Now that we have set up where to send the data, we can set what data will be sent.
You will want to set the Content Type to application/json, then you will want to craft the body aka the data that will be sent to Keen.
You can use their +Ingredient button to see what all you can send from the Gmail trigger. We will be using the FromAddress that Gmail + IFTTT provides to us.
Remember: You need to send valid JSON to Keen or the event will fail and no data will be sent. You can double check to make sure your JSON is valid by copy and pasting it into JSONLint.
For the purpose of the example: We are manually including the email address for the Gmail account the Applet is connect to.
After the Body is set, time to “Create action!”
Then you can review your applet and select, “Finish.”
As we mentioned before, making sure the JSON is valid is really important. If it is not, the request to Keen will fail.
I would recommend testing the applet by sending yourself an email with the exact subject line that the Applet will be searching for to email@example.com then going to your Keen IO project to see if the data was received.
Here’s an example graph from this Applet:
This is tracking replies to the Invitation to Pair email. It is a
'count' with group_by: [ "to" ], timeframe: 'this_14_days', interval: 'daily'.
Now we have data on emails that we never knew before! For example: February 20th was a really popular day for replies for all three of us. Awesome, right?
You can send data from any trigger that IFTTT has. With hundreds of different triggers, the possibilities are pretty great. If you think of a helpful one, let us know! We’d love to share it.
Share your Applets sending data to Keen IO with us on Twitter.
Next week, I am going to try this out with Zapier too and write about it. Stay tuned!