Configure a Deployment Hook
VertiGIS Studio Mobile provides you with the framework to configure a deployment hook, using any webhook service you prefer. When you deploy an application to a deployment environment (Testing, Staging, or Production), Mobile invokes the hook, which executes an automated task.
Although the possibilities are endless, here are a few examples of an automated task you can execute using a deployment hook:
-
Update a server-side resource, such as a database.
-
Capture a set of changes in a changelog file.
-
Send an email notification about app updates.
This procedure demonstrates how you can configure a deployment hook for Mobile to invoke when you deploy your app to Production. You can also set up deployment hooks for Testing and Staging deployments as well.
Our example in this procedure uses a VertiGIS Studio Workflow Server to receive the hook request. You can use any webhook service you prefer.
To configure a deployment hook:
-
In VertiGIS Studio Workflow, create a new server workflow using the Receive Webhook Request sample.
This sample retrieves the workflow inputs and parses the JSON inputs into a ready-to-use structure.
-
Click File > Save As.
-
Enter a title for the workflow and click Save.
The workflow is now accessible at an endpoint URL that includes your workflow server name and the workflow ID, in the following format:
https://<server>/vertigisstudio/workflow/service/webhook/<workflow-id>.
For example:
https://myserver/vertigisstudio/workflow/service/webhook/d59b48bb49e346a6b8f26d81d413d4d5
-
In your VertiGIS Studio Mobile app, click Deploy > Deployment Hooks.
The Deployment Hooks window opens.
-
Enter the endpoint URL from the server workflow into the Production field.
-
Enter the URL to post to when the Build environment is deployed.
-
Click OK.
When we deploy the app to Production, Mobile invokes the deployment hook that points to the endpoint URL with a JSON data payload.
In our example, the server workflow uses the following data to execute the automated task (e.g., to capture a change in a changelog file).
The following is an example that extracts some of the data in the parsed JSON object and returns it as text.