Skip to Content
Technical Articles
Author's profile photo Danielle Laforte

Connector Builder Guide – Implement Webhooks

Connector Builder Guide – Implement Webhooks

Open Connectors consists of over 170 connectors to 3rd Party Applications natively embedded in the SAP ecosystem. If the Connector you need does not exist in the catalog, you can build it quickly with Connector Builder. This instruction guide will walk you through using this tool, with concrete examples throughout. The beginning, Part 1, can be found here.

 

To demonstrate receiving webhooks, we will be using the Survey Monkey API. First, choose webhooks:

The webhook that Survey Monkey sends will have this format:

The next step is to create an Event Hook that parses out the relevant data from this webhook body. The webhook body will have a name of “events” that we will reference:

Once the formatting is achieved and the pertinent information is parsed out in the done statement, it can be saved.

Now, when Survey Monkey sends out a webhook, the Connector Instance can digest it and parse out the relevant information.

Enabling Webhooks

Now that we have configured receiving the webhooks in Connector Builder – we have to make sure the vendor will actually send the webhooks. Sometimes this can only be accomplished in the UI of the vendor’s application. However, sometimes this can be done programmatically, via the API. This is how it can be done in  the case of Survey Monkey.

 

To the URL https://api.surveymonkey.com/v3/webhooks, we send a body like this:

 

{
  "name": "My Webhook",
  "event_type": "survey_created",
  "subscription_url": "https://urltosendwebhookto.com"
}

Since we have enabled webhooks, any Instance we create of this Survey Monkey Connector will have a unique URL to send webhooks to – which we will put in the “subscription_url” field. To find it, first go to Connectors and search for Survey Monkey and click the little blue bubble (this assumes you have already entered your credentials and created a Connector Instance)

Edit the Instance and enable events and you will see the Webhook URL.

Great. Now we are all set up to create a webhook that will fire when a survey is created (there are others as well) and send that webhook to the Connector Instance unique Webhook URL.

We would like the Connector Instance to create the needed webhooks right when the Instance is created. To achieve this, we’ll create another POST resource called /webhooks. Here is the documentation for all of the supported webhooks:

There are two important points to note. First, the Resource Type is not API, but rather ON PROVISION WEBHOOK. This means that as soon as the Instance is created, this resource will run.

Second, the POST payload above to create a webhook is entered as the value in the body parameter. We could place the Webhook URL in that body – however, let’s put in a variable {{webhookCallbackUrl}} so that it enters the correct URL for every Instance created, dynamically.

To view any collected events, you can click on Activity in the left menu, and then Event Logs.

 

 

 

 

 

 

 

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.