How can you use webhooks to change the state of other applications you already use?
You may, for example, want to report or log machine alarm occurrences by creating a chat message for your service team or log the alarms in Google Sheets for reporting. In this blog, we will show you how you can use IXON Cloud’s webhooks to trigger custom actions in other applications you use.
Sending machine data from IXON Cloud to Google applications via Zapier
In the below step by step example, you’ll learn how to integrate IXON Cloud with Google Sheets and Google Chat via Zapier. We use Zapier to set up our integrations with these applications. Google Sheets doesn’t support webhooks and requires you to make automated changes via their API, and Google Chat requires the webhook data to have a specific format – different from the IXON Cloud format.
Zapier is a web API translation service that has integrations for a lot of popular apps like Google Sheets. You can also create a new webhook in Zapier and format the data so it meets the required format for apps like Google Chat.
Step-by-step guide on how to integrate the use of webhooks
In the example below we describe how to:
- Create a Zapier webhook as a trigger and set up a connection with the IXON Cloud, so that the webhook is triggered when a machine alarm goes off
- Create an action (example 1): create new rows in Google Sheets to log the alarm information
- Create an action (example 2): create a Google Chat message to inform your service team about the alarm information.
The ‘Zaps’ we are going to create consist of two parts; a Trigger App and an Action App. The Trigger App receives webhooks from IXON Cloud in Zapier. Next, the Action App makes a change in our target application.
Requirements to integrate IXON Cloud with Google applications
To follow this tutorial you need:
- an IXON Cloud account and a device (e.g. IXrouter) with Cloud Notify activated to trigger alarms.
- Google account for using Google Sheets and Google Chat.
- Zapier account (free version is fine).
1. Connect the IXON Cloud to a webhook in Zapier using a trigger
First, we have to create a webhook in Zapier so we can use this to trigger alarm information from the IXON Cloud.
Open Zapier and make a new Zap:
Create a Trigger App. Select Webhooks as your Trigger App:
Choose Catch Hook:
Copy the URL provided by Zapier:
Open IXON Cloud and navigate to Messages -> Settings:
Add a new webhook:
Enter a name and paste the URL from Zapier:
You can now see your newly created Webhook:
Go back to Zapier and press “Ok, I did this”. Zapier will now start listening for a sample Webhook.
Trigger an alarm you have configured in the Cloud Notify app of your device. A message will be created in your messages tab and a webhook will be sent to Zapier. Wait for a sample to show up as shown below:
We have now successfully created a Trigger App.
2. Create an action (example 1) to log the machine alarm in Google Sheets
The data collected in step 1 is now available for external applications. In this example, we will create a new row in a Google Sheets document to log the machine alarm information.
Add an Action App to our Zap.
Choose Google Sheets as the action app:
We want to create a new row in our sheet whenever an alarm is triggered:
You will need to grant Zapier access to your Google Drive account:
Create a Google Sheets with column headers on the first row:
In Zapier, select your spreadsheet and configure what data you want to have placed in each column:
Let Zapier send a test to your spreadsheet:
You can see the new row in your spreadsheet:
You can now give your Zap a name and turn it ON:
3. Create an action (example 2) to send a message in Google Chat
Now we’ll use the alarm information from step 1 to create a Google Chat message. As mentioned in the beginning of this article, we cannot send the webhook straight to Google Chat because it requires a different format. That’s why we use Zapier to transform the data and push it to Google Chat using a new webhook.
Create a new Action App and choose webhooks:
Select POST request:
Open Google Chat and create a new room (or use an existing one):
Select Configure webhooks:
Give your incoming webhook a name:
Copy the generated URL:
Open Zapier, paste the URL, set Payload Type to “json” and add a key: ‘text’ with the data you want to show up in the message:
Let Zapier send a test webhook to Google Chat:
Open Google Chat and you can see the message that has been sent by Zapier:
You can now give your Zap a name and turn it on:
That’s it! You can add as many actions or Zaps as you want, to use the data from the IXON Cloud in external applications.
We showed you the steps on how to use IXON Cloud webhooks to update a Google Sheets document and create a new Google Chat message. You can use these examples to implement your own custom use cases!
New to IXON Cloud? Set up your free account today and test it yourself.