You can quickly integrate Appery.io platform with other systems using Webhooks. You can create and register a Webhook to make HTTP POST request to an external URL (your system) when a specific event occurs in Appery.io platform. In other words, your system will be notified when an event occurs in Appery.io. It’s always best to look at an example, so let’s do that.
First lets see for what kind of events you can register a Webhook. Appery.io platform supports two types of Webhooks: 1) app specific Webhooks, and 2) account specific Webhooks.
App Webhooks
You can register a Webhook for the following app events:
- App version created
- App version removed
- App version restored
- App published on Appery.io
- App published on Heroku
- Android build success
- Android build failure
- Android build abort
- Android build start
- iOS build success
- iOS build failure
- iOS build abort
- iOS build start
- App test
For example, when you create a new version of an app (App version created), you can register a Webhook that will make a request to your system, letting the system know that a new app version was created. The request includes detailed information about the event.
Account Webooks
You can register a Webhook for the following account events:
- App created
- App removed
- App renamed
For example, every time a new app is created (App created), you can register a Webhook that will notify your system that a new app was created.
Setting up a Webhook
Let’s say we want to setup a Webhook every time a new app version is created. A quick way to create an API to which you can post is to use RequestBin. All you need to do is click Create RequestBin button to create a URL. You will also see examples using several languages how to invoke the API:
- In Appery.io, go to Resources > Webhooks.
- Click Create new webhook button.
- For name enter: AppVersionCreated and for the URL paste the RequestBin URL. It should look like this:
Note that if your API requires authorization you can enter login name and password.
Click Create to create the Webhook.
Now this Webhooks needs to be attached to an event. If you want to attach it to an account-level account then you can do it on the same page. We are going to attach it to an app event — when a new app version is created.
- Go to Apps tab and select your app (don’t open the app in the app builder, view its details).
- Scroll to Webhooks section, click on Attach Webhook button.
- Select the Webhook that you just created and then check the event:
- Click Attach.
Now scroll up to Versions section and create a new version. For version comment you can enter: Version #1. A new version will be created.
Go back to RequestBin and reload the page. You will now see information about a request made to this URL. When you created a new version, the Webhook fired HTTP POST request to RequestBin URL:
The request body shows the information that was sent from Appery.io.
If you create another app version, another request will be sent:
Looking closer at the request body, you can see that a lot of information is being included. For example, the version name is: Version #2.
{ "project": { "guid": "d69b07bd-ff4c-4751-9593-ed4fa1f29446", "name": "MyApp", "description": "Mobile app built with Appery.io Mobile App Builder", "created_at": "2015-04-22T15:11:37-07:00", "edited_at": "2015-04-22T15:11:45-07:00", "owner": { "name": "Max Katz", "email": "mk@appery.io" } }, "version": { "name": "Version #1", "created_at": "2015-04-22T15:24:13-07:00", "author": { "name": "Max Katz", "email": "mk@appery.io" } }, "created_at": "2015-04-22T15:24:13-07:00", "created_by": { "name": "Max Katz", "email": "mk@appery.io" } }
App Webhooks are associated with a specific app.
Account Webhooks are associated with the entire account. For example, you can create a Webhook which will be fired on every new app creation. This means every time a new app is created the Webhook will be fired. Here is an example registering two account-level Webhooks:
Summary
Webhooks are very easy to setup but provide a very easy way to integrate with external systems. Appery.io provides a large number of events for Webhooks. When these events are fired in Appery.io, you can notify external systems about these events and pass the information about the event.
Leave a Reply