Discover Webhook, the Prota OS app to make integrations
Are you a developer? Jump right in it here.
Regularly, our Support team receive some questions regarding the compatibility of Prota with other devices or regarding the possibility of limiting/authorizing the access of people to MicroBot Push: “I’m using Prota but I would like to know if it is compatible with [this] device?”, “Can I give access to only one of my MicroBot Push to my neighbor and how?” or other questions such as “How cool it could be to receive a notification in my team’s chat room when we send a reply to a customer, is it possible?”… And the answer to this question is the webhook app, which is capable of sending and receiving any standard HTTP requests on your Prota.
What is a webhook anyway?
For those of you who are not familiar with the term webhook, a webhook is a http request hook that triggers some specific event or action. A webhook is triggered by receiving a http request from your Prota (incoming hook) or by sending a http request to another webhook from your Prota (outgoing hook). When this event takes place, the http request is posted and information (data, name of the event…) is transmitted/received to/from another web service. Thus, a webhook allows you to extend compatibility by yourself without writing any code.
To sum up, webhooks enable you to integrate two or more web apps or services that have no compatibility whatsoever.
Webhooks are widely used to receive a notification from a service when some modifications are made or a specific event takes place. For instance, when a payment is made on Paypal or a new document is uploaded to Dropbox, a notification of this event can be received on Slack via webhook.
A lot of web services offer the possibility to use webhooks:
- Payment platforms such as Paypal, Stripe, Chargebee
- Social media: Twitter, Facebook, Instagram
- Messaging services: Slack, Skype, WhatsApp
- Mailing services: Mailchimp, Sendgrid
- And many more such as Dropbox, Zendesk, IFTTT, Zapier…
Moreover, webhooks are used by companies developing connected devices to enlarge the integration possibilities of their devices with other smart hubs, apps and/or web services. Let’s now find out how to create and use webhooks on Prota OS!
Webhook app in Prota OS
Aware of the tremendous possibilities offered by webhooks, at Naran, we wanted to offer this service to our beloved users. Our goal is indeed to always thrive to enlarge the capabilities of Prota OS by enabling the integration with other web services or IoT devices through the use of webhooks. That is why we decided to build Webhook app.
Webhook app is the integration tool of Prota OS. With Webhook app, you can create a webhook (i.e. a http request) and build the integration you wish using Stories app, Prota OS’ tool to create automation rules based on natural language.
How to use webhooks on Prota OS?
First of all, as usual on Prota OS, you need to download Webhook app from App Libraries, the app repository of Prota OS.
In Stories app, the Prota OS app that enables you to create automation rules using natural language, you will be able to set up storylines using webhooks.
There are two types of webhooks for Prota:
1. Incoming hook: when a http request is sent to Prota by another, external, app. This incoming hook is interpreted as a sensor in the storyline, that is to say, a condition that will trigger an action.
2. Outgoing hook: when Prota posts a http request to another app or service. This is interpreted as an action in the storyline.
What can you do with webhooks on Prota OS?
Now that you know how to create webhooks on Prota OS, let’s discover how you could use them.
Integrate physical devices using webhooks
A. MicroBot Push (incoming webhook): grant access to your MicroBot Push to a non-Prota user
You are a Prota user and own several MicroBots. Some are placed inside your home and others in places shared with your neighbors, on the button to call the elevator for instance. You do not wish to, and should not, share your Prota’s access link to your neighbors as they would gain an access to all your MicroBots as well as your storylines: they would be able to control your whole smart home!
Then how to allow your neighbor to use only one of your MicroBot? The answer is simple: you need to create a webhook!
- Create your webhook in Webhook app (see above)
- Create the following storyline on Stories app: “When MicroBot Push receives an incoming hook, MicroBot Push pushes the button”
- Send the webhook to your neighbor or any person you wish to share your MicroBot Push with. They simply need to click on the link each time they wish to use the MicroBot. And it’s done!
B. MicroBot Push (outgoing webhook): link 2 Prota hubs using webhook
Now, let’s imagine you have two Prota hubs, one at home and one at your office. You would like to link your two Prota hubs such as when a Microbot Push in your home (paired with your home-Prota) is activated, it triggers an action on your office-Prota.
- For instance, you would like when your MicroBot at home is activated, you would like to push a second MicroBot paired with another Prota hub.
- Or you would like to be alerted via Telegram when this MicroBot is activated but your Telegram account is not set on your home-Prota. It is set on your office-Prota.
- In office-Prota’s Webhook app, create an incoming hook.
- In home-Prota’s Stories app, create the following story: Select ‘MicroBot Push’ as the sensor, choose the desired event (push, pull…). As the actor, select ‘Webhook’ and ‘post request’ as the action. In the action’s conditions, you will need to enter the URL of the incoming hook you created in Step 1.
3. In office-Prota’s Stories app, create the following story: select ‘Webhook’ as the sensor and ‘receives an incoming hook’ as the event. Then define your action-story. And it can be anything: your MicroBot in your office pushes a button, you get a message on Telegram...
C. MicroBot Push and Apple Watch. Turn on/off your lights from your Apple Watch
You would like to control your MicroBot Push installed on your light switch using your Apple Watch because it is very handy.
- In Webhook app, create two incoming hooks: one to turn on the light and one to turn it off.
- In Stories app, create a story composed of the following storylines:
- When ‘light turns on’ receive an incoming hook (sensor-story), MicroBot pushes (or pulls) the button (actor-story).
- When ‘light turns off’ receive an incoming hook (sensor-story), MicroBot pushes (or pulls) the button (actor-story).
3. In Apple Watch app, go to ‘Request List’ and create two new requests corresponding to each storyline detailed above: set a title for each, choose ‘POST’ as the method and paste the incoming hook’s URL you have created in Webhook app.
And it’s done! You will just need to tab ‘Request’ on your Apple Watch on the desired webhook to turn on or off your lights!
Integrate popular internet services using webhooks
Integrate Gmail (or other email services), Zendesk and Slack — Convert automatically incoming emails to Zendesk tickets
Using webhooks, you can configure your office’s customer support system! Here at Naran, we use Prota to set up our customer support system and integrate three other web services together (Gmail, Zendesk and Slack).
What happens when you send a request to us on support.prota.info?
We receive your request by email at email@example.com. Then, thanks to Prota, we import this email on Zendesk, our support platform service where we manage all our users’ tickets. All our support team’s activity on Zendesk is then transmitted in real-time on Slack: when a ticket is created, answered, updated or solved on Zendesk, a notification is published on Slack. This allows our whole support team but also our technical team to be aware of the issues our users have as well as the advancement.
How to create this system?
A. Upload on Zendesk the emails you receive in your email box:
- In Stories app, set up ‘Email’ as the sensor and ‘receive a message’ as the condition in the sensor-story.
- Then, in the actor-story, select ‘Webhook’ as the actor and ‘post request’ as the action. In the action’s conditions, you will need to enter the information related to your Zendesk account: your zendesk URL, authorization and the data you wish to be uploaded.
Refer to Zendesk’s API documentation to get your URL here.
B. Integrate Zendesk and Slack:
- On your Slack account, go to ‘App Directory’ and search for Zendesk app.
- Follow Slack’s instructions to set up your integration’s settings. And you’re done!
Information regarding webhooks is often located in the ‘Developer’ or ‘API’ section of a web service.You will need to check this section to know whether you can use webhooks with a particular app and how.
To create your webhook on Prota OS or find new ideas of webhooks, don’t hesitate to check our quick guide here. You can also suggest what you wish to make on Community > Stories Writer and our Stories Writer team will work on it for you!