Amplify Central Integration Webhooks – Basics

Amplify Central Integration Webhooks - Basics

Introduction

Integration webhooks provide an “event” based means to monitor activity in Amplify Central in an external application that you create. Coupled with Amplify Central platform APIs, integration webhooks are a powerful tool for integrating Amplify Central into the rest of your API first toolchain.

Integration webhooks are different than subscription webhooks, which are added to an environment and pertain to API subscription requests for catalog items from the environment. Integration webhooks can apply to one or more environments and pertain to many resources across those environments.

For example, you can configure an integration webhook to trigger whenever an API Service is added to one or more environments or when an attribute is added to the environment. You use Amplify Central APIs or the Amplify CLI to configure integration webhooks. In this blog post, we’ll use APIs.

Refer to the online docs: Set up integrations through Webhooks for all the technical details around integration webhooks.

Let’s walk through an example of how to set up and test an integration webhook.

Note: Refer to this blog post to learn how to make API calls to Amplify Central.

Create an Integration Webhook

Integration Webhooks can be configured using the Axway CLI or via API calls. In this blog post series, I’ll be using APIs.

In the following API calls, {{apiCentralUrl}} is the Amplify Central base address for API calls. By default, it is https://apicentral.axway.com but could be different based on your region. Also, in all the API calls below, you need to pass in the following headers as described here:

'Authorization': `Bearer <YOUR ACCESS_TOKEN>`,
'Content-Type': 'application/json'

Create the Integration

Use the following API call to create an integration called myintegration.

POST {{apiCentralUrl}}/apis/management/v1alpha1/integrations

Body:

{
    "name": "myintegration",
    "title": "Integration",
    "tags": [
        "cloud"
    ],
    "attributes": {},
    "spec": {
        "description": "This is an integration."
    }
}

Create a Secret

We can use a secret so that the app that receives the webhook can be sure it is coming from a trusted source. The secret will be sent as an Authorization header.

POST {{apiCentralUrl}}/apis/management/v1alpha1/integrations/myintegration/secrets

Body:

{
    "name": "webhooksecret",
    "title": "API Key Secret for Webhook reference",
    "tags": [
        "saas",
        "axway"
    ],
    "attributes": {
    },
    "spec": {
        "data": {
            "apikey": "Password123"
        }
    }
}

Note that in this example, my Integration named myintegration is part of the API path (/apis/management/v1alpha1/integrations/{{IntegrationName}}/webhooks). This is the name given to the Integration in the prior API call.

Note that you can see Password123 in the webhook Authorization header when triggered as follows:

Host: en9c5wvi5vta4.x.pipedream.net
X-Amzn-Trace-Id: Root=1-6065c447-3c5b35a840f6e43e078b9c79
Content-Length: 1295
Authorization: Password123
X-Axway-Event-Id: 170d3081-9c48-459e-82e2-f37f5e3f1d74
User-Agent: amplify-central
Accept: application/json
Content-Type: application/json

Create a Webhook

Let’s create a webhook in this integration. The webhook will make a POST to the url specified in the body: https://en9c5wvi5vta4.x.pipedream.net. It will send the webhook secret as an Authorization Header, Authorization: Password123, as described above.

POST /apis/management/v1alpha1/integrations/myintegration/webhooks

Body:

{
    "name": "webhook",
    "title": "Webhook to invoke requestbin.com",
    "tags": [
        "prod",
        "saas",
        "axway"
    ],
    "attributes": {
        "release": "1.0.0"
    },
    "spec": {
        "enabled": true,
        "url": "https://en9c5wvi5vta4.x.pipedream.net",
        "auth": {
            "secret": {
                "name": "webhooksecret",
                "key": "apikey"
            }
        }
    }
}

Create a Resource Hook

The resource hook will tell the integration when to invoke the webhook. In this case, we will generate a webhook call whenever there is any triggerable event in the environment, manualenv. This is derived from the online docs sample resource hook payload called “Monitor changes in a specific environment and on all its resources:”

POST /apis/management/v1alpha1/integrations/myintegration/resourcehooks/

Body:

{
   "group": "management",
   "apiVersion": "v1alpha1",
   "kind": "ResourceHook",
   "name": "environments-hook",
   "title": "Monitor Environment manualenv and all its resources",
   "metadata": {
      "scope": {
         "kind": "Integration",
         "name": "myintegration"
      }
   },
   "spec": {
      "triggers": [
         {
            "group": "management",
            "kind": "Environment",
            "name": "manualenv",
            "type": [
               "created",
               "updated",
               "deleted"
            ]
         },
         {
            "group": "management",
            "kind": "*",
            "name": "*",
            "type": [
               "created",
               "updated",
               "deleted"
            ],
            "scope": {
               "kind": "Environment",
               "name": "manualenv"
            }
         }
      ],
      "webhooks": [
         "webhook"
      ]
   }
}

Note that the resource hook is set up with two triggers. One is for any modification to the environment itself and another trigger on any resource modification in the environment: “manualenv” as signified by the * wildcard for “kind” and “name”

Test the Webhook

I manually added an API Service to the manualenv environment but did not publish it to the Unified Catalog as shown below:

and I received three webhook calls in my requestbin:

Each one is below.

The first is related to the APIService resource being created:

{
    "id": "b3ebb1a2-a6a2-49e2-a385-933d74cdd064",
    "time": "2021-04-02T12:17:40.718+0000",
    "version": "v1",
    "product": "AmplifyCentral",
    "correlationId": "0c4d5905-d3d9-4a62-859f-0bbda61f145c",
    "organization": {
        "id": "100000142"
    },
    "type": "ResourceCreated",
    "payload": {
        "finalizers": [],
        "metadata": {
            "id": "8a2e83617870fa00017892848025118c",
            "audit": {
                "createTimestamp": "2021-04-02T12:17:40.389+0000",
                "createUserId": "789f8247a10c466f36894f0f3cfdce19",
                "modifyTimestamp": "2021-04-02T12:17:40.389+0000",
                "modifyUserId": "789f8247a10c466f36894f0f3cfdce19"
            },
            "scope": {
                "id": "8a2e96e67870fa1c01788e7e19d30ed0",
                "kind": "Environment",
                "name": "manualenv",
                "selfLink": "/management/v1alpha1/environments/manualenv"
            },
            "resourceVersion": "286973",
            "references": [],
            "selfLink": "/management/v1alpha1/environments/manualenv/apiservices/comprehend"
        },
        "apiVersion": "v1alpha1",
        "kind": "APIService",
        "name": "comprehend",
        "attributes": {},
        "title": "comprehend",
        "spec": {},
        "group": "management",
        "tags": []
    }
}

The second is related to the APIServiceRevision resource being created:

{
    "id": "86dab2e4-ed6c-41bc-850b-6631325ccea6",
    "time": "2021-04-02T12:17:40.951+0000",
    "version": "v1",
    "product": "AmplifyCentral",
    "correlationId": "41597cc1-ef32-4f53-aeff-4a1a71ea4122",
    "organization": {
        "id": "100000142"
    },
    "type": "ResourceCreated",
    "payload": {
        "finalizers": [],
        "metadata": {
            "id": "8a2e83617870fa00017892848124118d",
            "audit": {
                "createTimestamp": "2021-04-02T12:17:40.644+0000",
                "createUserId": "789f8247a10c466f36894f0f3cfdce19",
                "modifyTimestamp": "2021-04-02T12:17:40.644+0000",
                "modifyUserId": "789f8247a10c466f36894f0f3cfdce19"
            },
            "scope": {
                "id": "8a2e96e67870fa1c01788e7e19d30ed0",
                "kind": "Environment",
                "name": "manualenv",
                "selfLink": "/management/v1alpha1/environments/manualenv"
            },
            "resourceVersion": "286974",
            "references": [
                {
                    "id": "8a2e83617870fa00017892848025118c",
                    "kind": "APIService",
                    "name": "comprehend",
                    "type": "hard",
                    "selfLink": "/management/v1alpha1/environments/manualenv/apiservices/comprehend"
                }
            ],
            "selfLink": "/management/v1alpha1/environments/manualenv/apiservicerevisions/comprehend-version"
        },
        "apiVersion": "v1alpha1",
        "kind": "APIServiceRevision",
        "name": "comprehend-version",
        "attributes": {},
        "title": "comprehend-version",
        "spec": {
            "apiService": "comprehend",
            "definition": {
                "type": "oas2",
                "value": "ewogICJzd2FnZ2VyIjogIjIuMCIsCiAgImluZm8iOiB7CiAgICAidGl0bGUiOiAiY29tcHJlaGVuZCIsCiAgICAiZGVzY3JpcHRpb24iOiAiQW4gQVBJIEJ1aWxkZXIgc2VydmljZSIsCiAgICAidmVyc2lvbiI6ICIxLjAuMCIKICB9LAogICJob3N0IjogIjZmMzA3NjJlN2Y1ODEzMzllMDVkYzFhNjJiYjkzNDAxMmQzZmRmZjAuY2xvdWRhcHAtZW50ZXJwcmlzZS5hcHBjZWxlcmF0b3IuY29tIiwKICAiYmFzZVBhdGgiOiAiL2NvbXByZWhlbmQiLAogICJzZWN1cml0eSI6IFt7CiAgICAiYXBpa2V5IjogW10KICB9XSwKICAicGF0aHMiOiB7CiAgICAiL2RldGVjdGRvbWluYW50bGFuZ3VhZ2UiOiB7CiAgICAgICJnZXQiOiB7CiAgICAgICAgInJlc3BvbnNlcyI6IHsKICAgICAgICAgICIyMDAiOiB7CiAgICAgICAgICAgICJkZXNjcmlwdGlvbiI6ICJMYW5ndWFnZXMiLAogICAgICAgICAgICAic2NoZW1hIjogewogICAgICAgICAgICAgICJ0eXBlIjogIm9iamVjdCIsCiAgICAgICAgICAgICAgInJlcXVpcmVkIjogWyJzdWNjZXNzIiwgInJlcXVlc3QtaWQiLCAia2V5Il0sCiAgICAgICAgICAgICAgInByb3BlcnRpZXMiOiB7CiAgICAgICAgICAgICAgICAiY29kZSI6IHsKICAgICAgICAgICAgICAgICAgInR5cGUiOiAiaW50ZWdlciIsCiAgICAgICAgICAgICAgICAgICJmb3JtYXQiOiAiaW50MzIiCiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgInN1Y2Nlc3MiOiB7CiAgICAgICAgICAgICAgICAgICJ0eXBlIjogImJvb2xlYW4iCiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgInJlcXVlc3QtaWQiOiB7CiAgICAgICAgICAgICAgICAgICJ0eXBlIjogInN0cmluZyIKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAibWVzc2FnZSI6IHsKICAgICAgICAgICAgICAgICAgInR5cGUiOiAic3RyaW5nIgogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICJ1cmwiOiB7CiAgICAgICAgICAgICAgICAgICJ0eXBlIjogInN0cmluZyIKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAia2V5IjogewogICAgICAgICAgICAgICAgICAidHlwZSI6ICJzdHJpbmciLAogICAgICAgICAgICAgICAgICAiZW51bSI6IFsibGFuZ3VhZ2UiXQogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICJsYW5ndWFnZSI6IHsKICAgICAgICAgICAgICAgICAgIiRyZWYiOiAiIy9kZWZpbml0aW9ucy9zY2hlbWEuY29tcHJlaGVuZF9sYW5ndWFnZXMiCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICB9LAogICAgICAgICAgIjQwMSI6IHsKICAgICAgICAgICAgImRlc2NyaXB0aW9uIjogIlVuYXV0aG9yaXplZCIsCiAgICAgICAgICAgICJzY2hlbWEiOiB7fQogICAgICAgICAgfQogICAgICAgIH0sCiAgICAgICAgImRlc2NyaXB0aW9uIjogIkRldGVybWluZXMgdGhlIGRvbWluYW50IGxhbmd1YWdlIG9mIHRoZSBpbnB1dCB0ZXh0IHBhc3NlZCBpbiB0aGUgVGV4dCBxdWVyeSBwYXJhbWV0ZXIgKGUuZy4gXCJMZXMgQVBJIHNvbnQgY29vbFwiIHJldHVybnMgXCJmclwiIGZvciBGcmVuY2gpIiwKICAgICAgICAib3BlcmF0aW9uSWQiOiAiZmluZERldGVjdGRvbWluYW50bGFuZ3VhZ2UiLAogICAgICAgICJwYXJhbWV0ZXJzIjogW3sKICAgICAgICAgICJuYW1lIjogIlRleHQiLAogICAgICAgICAgImluIjogInF1ZXJ5IiwKICAgICAgICAgICJkZXNjcmlwdGlvbiI6ICJBIFVURi04IHRleHQgc3RyaW5nLiBFYWNoIHN0cmluZyBtdXN0IGNvbnRhaW4gZmV3ZXIgdGhhdCA1LDAwMCBieXRlcyBvZiBVVEYtOCBlbmNvZGVkIGNoYXJhY3RlcnMgd2l0aCBhIG1pbmltdW0gbGVuZ3RoIG9mIDEuIiwKICAgICAgICAgICJ0eXBlIjogInN0cmluZyIKICAgICAgICB9XSwKICAgICAgICAicHJvZHVjZXMiOiBbImFwcGxpY2F0aW9uL2pzb24iLCAiYXBwbGljYXRpb24veG1sIiwgInRleHQveWFtbCIsICJ0ZXh0L2NzdiIsICJ0ZXh0L3BsYWluIl0sCiAgICAgICAgInRhZ3MiOiBbImRldGVjdGRvbWluYW50bGFuZ3VhZ2UiXQogICAgICB9CiAgICB9LAogICAgIi9kZXRlY3RlbnRpdGllcyI6IHsKICAgICAgImdldCI6IHsKICAgICAgICAicmVzcG9uc2VzIjogewogICAgICAgICAgIjIwMCI6IHsKICAgICAgICAgICAgImRlc2NyaXB0aW9uIjogIkVudGl0aWVzIiwKICAgICAgICAgICAgInNjaGVtYSI6IHsKICAgICAgICAgICAgICAidHlwZSI6ICJvYmplY3QiLAogICAgICAgICAgICAgICJyZXF1aXJlZCI6IFsic3VjY2VzcyIsICJyZXF1ZXN0LWlkIiwgImtleSJdLAogICAgICAgICAgICAgICJwcm9wZXJ0aWVzIjogewogICAgICAgICAgICAgICAgImNvZGUiOiB7CiAgICAgICAgICAgICAgICAgICJ0eXBlIjogImludGVnZXIiLAogICAgICAgICAgICAgICAgICAiZm9ybWF0IjogImludDMyIgogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICJzdWNjZXNzIjogewogICAgICAgICAgICAgICAgICAidHlwZSI6ICJib29sZWFuIgogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICJyZXF1ZXN0LWlkIjogewogICAgICAgICAgICAgICAgICAidHlwZSI6ICJzdHJpbmciCiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgIm1lc3NhZ2UiOiB7CiAgICAgICAgICAgICAgICAgICJ0eXBlIjogInN0cmluZyIKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAidXJsIjogewogICAgICAgICAgICAgICAgICAidHlwZSI6ICJzdHJpbmciCiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgImtleSI6IHsKICAgICAgICAgICAgICAgICAgInR5cGUiOiAic3RyaW5nIiwKICAgICAgICAgICAgICAgICAgImVudW0iOiBbImVudGl0eSJdCiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgImVudGl0eSI6IHsKICAgICAgICAgICAgICAgICAgIiRyZWYiOiAiIy9kZWZpbml0aW9ucy9zY2hlbWEuY29tcHJlaGVuZF9lbnRpdGllcyIKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgIH0sCiAgICAgICAgICAiNDAxIjogewogICAgICAgICAgICAiZGVzY3JpcHRpb24iOiAiVW5hdXRob3JpemVkIiwKICAgICAgICAgICAgInNjaGVtYSI6IHt9CiAgICAgICAgICB9CiAgICAgICAgfSwKICAgICAgICAiZGVzY3JpcHRpb24iOiAiRGV0ZWN0IHRoZSBlbnRpdGllcyBvZiB0aGUgdGV4dCBwYXNzZWQgaW4gdGhlIFRleHQgcXVlcnkgcGFyYW1ldGVyIChlLmcuIFwiSm9obiBtb3ZlZCB0byAxMzEzIE1vY2tpbmdiaXJkIExhbmUgaW4gMjAxMlwiIHJldHVybnMgUEVSU09OLCBMT0NBVElPTiBhbmQgREFURSkiLAogICAgICAgICJvcGVyYXRpb25JZCI6ICJmaW5kRGV0ZWN0ZW50aXRpZXMiLAogICAgICAgICJwYXJhbWV0ZXJzIjogW3sKICAgICAgICAgICJuYW1lIjogIlRleHQiLAogICAgICAgICAgImluIjogInF1ZXJ5IiwKICAgICAgICAgICJkZXNjcmlwdGlvbiI6ICJBIFVURi04IHRleHQgc3RyaW5nLiBFYWNoIHN0cmluZyBtdXN0IGNvbnRhaW4gZmV3ZXIgdGhhdCA1LDAwMCBieXRlcyBvZiBVVEYtOCBlbmNvZGVkIGNoYXJhY3RlcnMgd2l0aCBhIG1pbmltdW0gbGVuZ3RoIG9mIDEuIiwKICAgICAgICAgICJ0eXBlIjogInN0cmluZyIKICAgICAgICB9LCB7CiAgICAgICAgICAibmFtZSI6ICJMYW5ndWFnZUNvZGUiLAogICAgICAgICAgImluIjogInF1ZXJ5IiwKICAgICAgICAgICJkZXNjcmlwdGlvbiI6ICJUaGUgbGFuZ3VhZ2Ugb2YgdGhlIGlucHV0IHRleHQ6ICBlbiB8IGVzIHwgZnIgfCBkZSB8IGl0IHwgcHQgfCBhciB8IGhpIHwgamEgfCBrbyB8IHpoIHwgemgtVFciLAogICAgICAgICAgInR5cGUiOiAic3RyaW5nIgogICAgICAgIH1dLAogICAgICAgICJwcm9kdWNlcyI6IFsiYXBwbGljYXRpb24vanNvbiIsICJhcHBsaWNhdGlvbi94bWwiLCAidGV4dC95YW1sIiwgInRleHQvY3N2IiwgInRleHQvcGxhaW4iXSwKICAgICAgICAidGFncyI6IFsiZGV0ZWN0ZW50aXRpZXMiXQogICAgICB9CiAgICB9LAogICAgIi9kZXRlY3RwaWllbnRpdGllcyI6IHsKICAgICAgImdldCI6IHsKICAgICAgICAicmVzcG9uc2VzIjogewogICAgICAgICAgIjIwMCI6IHsKICAgICAgICAgICAgImRlc2NyaXB0aW9uIjogIkVudGl0aWVzIiwKICAgICAgICAgICAgInNjaGVtYSI6IHsKICAgICAgICAgICAgICAidHlwZSI6ICJvYmplY3QiLAogICAgICAgICAgICAgICJyZXF1aXJlZCI6IFsic3VjY2VzcyIsICJyZXF1ZXN0LWlkIiwgImtleSJdLAogICAgICAgICAgICAgICJwcm9wZXJ0aWVzIjogewogICAgICAgICAgICAgICAgImNvZGUiOiB7CiAgICAgICAgICAgICAgICAgICJ0eXBlIjogImludGVnZXIiLAogICAgICAgICAgICAgICAgICAiZm9ybWF0IjogImludDMyIgogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICJzdWNjZXNzIjogewogICAgICAgICAgICAgICAgICAidHlwZSI6ICJib29sZWFuIgogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICJyZXF1ZXN0LWlkIjogewogICAgICAgICAgICAgICAgICAidHlwZSI6ICJzdHJpbmciCiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgIm1lc3NhZ2UiOiB7CiAgICAgICAgICAgICAgICAgICJ0eXBlIjogInN0cmluZyIKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAidXJsIjogewogICAgICAgICAgICAgICAgICAidHlwZSI6ICJzdHJpbmciCiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgImtleSI6IHsKICAgICAgICAgICAgICAgICAgInR5cGUiOiAic3RyaW5nIiwKICAgICAgICAgICAgICAgICAgImVudW0iOiBbInBpaWVudGl0eSJdCiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgInBpaWVudGl0eSI6IHsKICAgICAgICAgICAgICAgICAgIiRyZWYiOiAiIy9kZWZpbml0aW9ucy9zY2hlbWEuY29tcHJlaGVuZF9waWllbnRpdGllcyIKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgIH0sCiAgICAgICAgICAiNDAxIjogewogICAgICAgICAgICAiZGVzY3JpcHRpb24iOiAiVW5hdXRob3JpemVkIiwKICAgICAgICAgICAgInNjaGVtYSI6IHt9CiAgICAgICAgICB9CiAgICAgICAgfSwKICAgICAgICAiZGVzY3JpcHRpb24iOiAiRGV0ZWN0IFBJSSAoUGVyc29uYWxseSBJZGVudGlmaWFibGUgSW5mb3JtYXRpb24pIGVudGl0aWVzIG9mIHRoZSB0ZXh0IHBhc3NlZCBpbiB0aGUgVGV4dCBxdWVyeSBwYXJhbWV0ZXIgKGUuZy4gXCJIZWxsbyBQYXVsbyBTYW50b3MuIFRoZSBsYXRlc3Qgc3RhdGVtZW50IGZvciB5b3VyIGNyZWRpdCBjYXJkIGFjY291bnQgMTExMS0wMDAwLTExMTEtMDAwMCB3YXMgbWFpbGVkIHRvIDEyMyBBbnkgU3RyZWV0LCBTZWF0dGxlLCBXQSA5ODEwOVwiIHJldHVybnMgTkFNRSwgQ1JFRElUX0RFQklUX05VTUJFUiBhbmQgQUREUkVTUykiLAogICAgICAgICJvcGVyYXRpb25JZCI6ICJmaW5kRGV0ZWN0cGlpZW50aXRpZXMiLAogICAgICAgICJwYXJhbWV0ZXJzIjogW3sKICAgICAgICAgICJuYW1lIjogIlRleHQiLAogICAgICAgICAgImluIjogInF1ZXJ5IiwKICAgICAgICAgICJkZXNjcmlwdGlvbiI6ICJBIFVURi04IHRleHQgc3RyaW5nLiBFYWNoIHN0cmluZyBtdXN0IGNvbnRhaW4gZmV3ZXIgdGhhdCA1LDAwMCBieXRlcyBvZiBVVEYtOCBlbmNvZGVkIGNoYXJhY3RlcnMgd2l0aCBhIG1pbmltdW0gbGVuZ3RoIG9mIDEuIiwKICAgICAgICAgICJ0eXBlIjogInN0cmluZyIKICAgICAgICB9LCB7CiAgICAgICAgICAibmFtZSI6ICJMYW5ndWFnZUNvZGUiLAogICAgICAgICAgImluIjogInF1ZXJ5IiwKICAgICAgICAgICJkZXNjcmlwdGlvbiI6ICJUaGUgbGFuZ3VhZ2Ugb2YgdGhlIGlucHV0IHRleHQ6ICBlbiB8IGVzIHwgZnIgfCBkZSB8IGl0IHwgcHQgfCBhciB8IGhpIHwgamEgfCBrbyB8IHpoIHwgemgtVFciLAogICAgICAgICAgInR5cGUiOiAic3RyaW5nIgogICAgICAgIH1dLAogICAgICAgICJwcm9kdWNlcyI6IFsiYXBwbGljYXRpb24vanNvbiIsICJhcHBsaWNhdGlvbi94bWwiLCAidGV4dC95YW1sIiwgInRleHQvY3N2IiwgInRleHQvcGxhaW4iXSwKICAgICAgICAidGFncyI6IFsiZGV0ZWN0cGlpZW50aXRpZXMiXQogICAgICB9CiAgICB9LAogICAgIi9kZXRlY3RzZW50aW1lbnQiOiB7CiAgICAgICJnZXQiOiB7CiAgICAgICAgInJlc3BvbnNlcyI6IHsKICAgICAgICAgICIyMDAiOiB7CiAgICAgICAgICAgICJkZXNjcmlwdGlvbiI6ICJTZW50aW1lbnQiLAogICAgICAgICAgICAic2NoZW1hIjogewogICAgICAgICAgICAgICJ0eXBlIjogIm9iamVjdCIsCiAgICAgICAgICAgICAgInJlcXVpcmVkIjogWyJzdWNjZXNzIiwgInJlcXVlc3QtaWQiLCAia2V5Il0sCiAgICAgICAgICAgICAgInByb3BlcnRpZXMiOiB7CiAgICAgICAgICAgICAgICAiY29kZSI6IHsKICAgICAgICAgICAgICAgICAgInR5cGUiOiAiaW50ZWdlciIsCiAgICAgICAgICAgICAgICAgICJmb3JtYXQiOiAiaW50MzIiCiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgInN1Y2Nlc3MiOiB7CiAgICAgICAgICAgICAgICAgICJ0eXBlIjogImJvb2xlYW4iCiAgICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICAgInJlcXVlc3QtaWQiOiB7CiAgICAgICAgICAgICAgICAgICJ0eXBlIjogInN0cmluZyIKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAibWVzc2FnZSI6IHsKICAgICAgICAgICAgICAgICAgInR5cGUiOiAic3RyaW5nIgogICAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAgICJ1cmwiOiB7CiAgICAgICAgICAgICAgICAgICJ0eXBlIjogInN0cmluZyIKICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAia2V5IjogewogICAgICAgICAgICAgICAgICAidHlwZSI6ICJzdHJpbmciLAogICAgICAgICAgICAgICAgICAiZW51bSI6IFsic2VudGltZW50Il0KICAgICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgICAic2VudGltZW50IjogewogICAgICAgICAgICAgICAgICAiJHJlZiI6ICIjL2RlZmluaXRpb25zL3NjaGVtYS5jb21wcmVoZW5kX3NlbnRpbWVudCIKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgIH0sCiAgICAgICAgICAiNDAxIjogewogICAgICAgICAgICAiZGVzY3JpcHRpb24iOiAiVW5hdXRob3JpemVkIiwKICAgICAgICAgICAgInNjaGVtYSI6IHt9CiAgICAgICAgICB9CiAgICAgICAgfSwKICAgICAgICAiZGVzY3JpcHRpb24iOiAiRGV0ZWN0IHRoZSBzZW50aW1lbnQgb2YgdGhlIHRleHQgcGFzc2VkIGluIHRoZSBUZXh0IHF1ZXJ5IHBhcmFtZXRlciAoZS5nLiBcIkFQSXMgYXJlIGNvb2xcIiByZXR1cm5zIFBPU0lUSVZFIHdpdGggYSBQb3N0aXZlIFNlbnRpbWVudCBTY29yZSBvZiAwLjg2NDQwNzA2MjUzMDUxNzYpIiwKICAgICAgICAib3BlcmF0aW9uSWQiOiAiZmluZERldGVjdHNlbnRpbWVudCIsCiAgICAgICAgInBhcmFtZXRlcnMiOiBbewogICAgICAgICAgIm5hbWUiOiAiVGV4dCIsCiAgICAgICAgICAiaW4iOiAicXVlcnkiLAogICAgICAgICAgImRlc2NyaXB0aW9uIjogIkEgVVRGLTggdGV4dCBzdHJpbmcuIEVhY2ggc3RyaW5nIG11c3QgY29udGFpbiBmZXdlciB0aGF0IDUsMDAwIGJ5dGVzIG9mIFVURi04IGVuY29kZWQgY2hhcmFjdGVycyB3aXRoIGEgbWluaW11bSBsZW5ndGggb2YgMS4iLAogICAgICAgICAgInR5cGUiOiAic3RyaW5nIgogICAgICAgIH0sIHsKICAgICAgICAgICJuYW1lIjogIkxhbmd1YWdlQ29kZSIsCiAgICAgICAgICAiaW4iOiAicXVlcnkiLAogICAgICAgICAgImRlc2NyaXB0aW9uIjogIlRoZSBsYW5ndWFnZSBvZiB0aGUgaW5wdXQgdGV4dDogIGVuIHwgZXMgfCBmciB8IGRlIHwgaXQgfCBwdCB8IGFyIHwgaGkgfCBqYSB8IGtvIHwgemggfCB6aC1UVyIsCiAgICAgICAgICAidHlwZSI6ICJzdHJpbmciCiAgICAgICAgfV0sCiAgICAgICAgInByb2R1Y2VzIjogWyJhcHBsaWNhdGlvbi9qc29uIiwgImFwcGxpY2F0aW9uL3htbCIsICJ0ZXh0L3lhbWwiLCAidGV4dC9jc3YiLCAidGV4dC9wbGFpbiJdLAogICAgICAgICJ0YWdzIjogWyJkZXRlY3RzZW50aW1lbnQiXQogICAgICB9CiAgICB9CiAgfSwKICAiZGVmaW5pdGlvbnMiOiB7CiAgICAiUmVzcG9uc2VNb2RlbCI6IHsKICAgICAgInR5cGUiOiAib2JqZWN0IiwKICAgICAgInJlcXVpcmVkIjogWyJzdWNjZXNzIiwgInJlcXVlc3QtaWQiXSwKICAgICAgInByb3BlcnRpZXMiOiB7CiAgICAgICAgImNvZGUiOiB7CiAgICAgICAgICAidHlwZSI6ICJpbnRlZ2VyIiwKICAgICAgICAgICJmb3JtYXQiOiAiaW50MzIiCiAgICAgICAgfSwKICAgICAgICAic3VjY2VzcyI6IHsKICAgICAgICAgICJ0eXBlIjogImJvb2xlYW4iCiAgICAgICAgfSwKICAgICAgICAicmVxdWVzdC1pZCI6IHsKICAgICAgICAgICJ0eXBlIjogInN0cmluZyIKICAgICAgICB9LAogICAgICAgICJtZXNzYWdlIjogewogICAgICAgICAgInR5cGUiOiAic3RyaW5nIgogICAgICAgIH0sCiAgICAgICAgInVybCI6IHsKICAgICAgICAgICJ0eXBlIjogInN0cmluZyIKICAgICAgICB9CiAgICAgIH0KICAgIH0sCiAgICAiRXJyb3JNb2RlbCI6IHsKICAgICAgInR5cGUiOiAib2JqZWN0IiwKICAgICAgInJlcXVpcmVkIjogWyJtZXNzYWdlIiwgImNvZGUiLCAic3VjY2VzcyIsICJyZXF1ZXN0LWlkIl0sCiAgICAgICJwcm9wZXJ0aWVzIjogewogICAgICAgICJjb2RlIjogewogICAgICAgICAgInR5cGUiOiAiaW50ZWdlciIsCiAgICAgICAgICAiZm9ybWF0IjogImludDMyIgogICAgICAgIH0sCiAgICAgICAgInN1Y2Nlc3MiOiB7CiAgICAgICAgICAidHlwZSI6ICJib29sZWFuIiwKICAgICAgICAgICJkZWZhdWx0IjogZmFsc2UKICAgICAgICB9LAogICAgICAgICJyZXF1ZXN0LWlkIjogewogICAgICAgICAgInR5cGUiOiAic3RyaW5nIgogICAgICAgIH0sCiAgICAgICAgIm1lc3NhZ2UiOiB7CiAgICAgICAgICAidHlwZSI6ICJzdHJpbmciCiAgICAgICAgfSwKICAgICAgICAidXJsIjogewogICAgICAgICAgInR5cGUiOiAic3RyaW5nIgogICAgICAgIH0KICAgICAgfQogICAgfSwKICAgICJzY2hlbWEuY29tcHJlaGVuZF9sYW5ndWFnZXMiOiB7CiAgICAgICJ0eXBlIjogIm9iamVjdCIsCiAgICAgICJwcm9wZXJ0aWVzIjogewogICAgICAgICJMYW5ndWFnZXMiOiB7CiAgICAgICAgICAidHlwZSI6ICJhcnJheSIsCiAgICAgICAgICAiaXRlbXMiOiB7CiAgICAgICAgICAgICJ0eXBlIjogIm9iamVjdCIsCiAgICAgICAgICAgICJwcm9wZXJ0aWVzIjogewogICAgICAgICAgICAgICJMYW5ndWFnZUNvZGUiOiB7CiAgICAgICAgICAgICAgICAidHlwZSI6ICJzdHJpbmciCiAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAiU2NvcmUiOiB7CiAgICAgICAgICAgICAgICAidHlwZSI6ICJpbnRlZ2VyIgogICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgIH0KICAgICAgfQogICAgfSwKICAgICJzY2hlbWEuY29tcHJlaGVuZF9lbnRpdGllcyI6IHsKICAgICAgInR5cGUiOiAib2JqZWN0IiwKICAgICAgInByb3BlcnRpZXMiOiB7CiAgICAgICAgIkVudGl0aWVzIjogewogICAgICAgICAgInR5cGUiOiAiYXJyYXkiLAogICAgICAgICAgIml0ZW1zIjogewogICAgICAgICAgICAidHlwZSI6ICJvYmplY3QiLAogICAgICAgICAgICAicHJvcGVydGllcyI6IHsKICAgICAgICAgICAgICAiU2NvcmUiOiB7CiAgICAgICAgICAgICAgICAidHlwZSI6ICJudW1iZXIiCiAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAiVHlwZSI6IHsKICAgICAgICAgICAgICAgICJ0eXBlIjogInN0cmluZyIKICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICJUZXh0IjogewogICAgICAgICAgICAgICAgInR5cGUiOiAic3RyaW5nIgogICAgICAgICAgICAgIH0sCiAgICAgICAgICAgICAgIkJlZ2luT2Zmc2V0IjogewogICAgICAgICAgICAgICAgInR5cGUiOiAiaW50ZWdlciIKICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICJFbmRPZmZzZXQiOiB7CiAgICAgICAgICAgICAgICAidHlwZSI6ICJpbnRlZ2VyIgogICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgIH0KICAgICAgfQogICAgfSwKICAgICJzY2hlbWEuY29tcHJlaGVuZF9waWllbnRpdGllcyI6IHsKICAgICAgInR5cGUiOiAib2JqZWN0IiwKICAgICAgInByb3BlcnRpZXMiOiB7CiAgICAgICAgIkVudGl0aWVzIjogewogICAgICAgICAgInR5cGUiOiAiYXJyYXkiLAogICAgICAgICAgIml0ZW1zIjogewogICAgICAgICAgICAidHlwZSI6ICJvYmplY3QiLAogICAgICAgICAgICAicHJvcGVydGllcyI6IHsKICAgICAgICAgICAgICAiU2NvcmUiOiB7CiAgICAgICAgICAgICAgICAidHlwZSI6ICJudW1iZXIiCiAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAiVHlwZSI6IHsKICAgICAgICAgICAgICAgICJ0eXBlIjogInN0cmluZyIKICAgICAgICAgICAgICB9LAogICAgICAgICAgICAgICJCZWdpbk9mZnNldCI6IHsKICAgICAgICAgICAgICAgICJ0eXBlIjogImludGVnZXIiCiAgICAgICAgICAgICAgfSwKICAgICAgICAgICAgICAiRW5kT2Zmc2V0IjogewogICAgICAgICAgICAgICAgInR5cGUiOiAiaW50ZWdlciIKICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICB9CiAgICAgIH0KICAgIH0sCiAgICAic2NoZW1hLmNvbXByZWhlbmRfc2VudGltZW50IjogewogICAgICAidHlwZSI6ICJvYmplY3QiLAogICAgICAiYWxsT2YiOiBbewogICAgICAgICIkcmVmIjogIiMvZGVmaW5pdGlvbnMvc2VudGltZW50LWV4IgogICAgICB9LCB7CiAgICAgICAgInR5cGUiOiAib2JqZWN0IiwKICAgICAgICAicHJvcGVydGllcyI6IHsKICAgICAgICAgICJTZW50aW1lbnRTY29yZSI6IHsKICAgICAgICAgICAgIiRyZWYiOiAiIy9kZWZpbml0aW9ucy9TZW50aW1lbnRTY29yZSIKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgIH1dCiAgICB9LAogICAgInNlbnRpbWVudC1leCI6IHsKICAgICAgInR5cGUiOiAib2JqZWN0IiwKICAgICAgInByb3BlcnRpZXMiOiB7CiAgICAgICAgIlNlbnRpbWVudCI6IHsKICAgICAgICAgICJ0eXBlIjogInN0cmluZyIKICAgICAgICB9CiAgICAgIH0KICAgIH0sCiAgICAiU2VudGltZW50U2NvcmUiOiB7CiAgICAgICJ0eXBlIjogIm9iamVjdCIsCiAgICAgICJwcm9wZXJ0aWVzIjogewogICAgICAgICJQb3NpdGl2ZSI6IHsKICAgICAgICAgICJ0eXBlIjogIm51bWJlciIKICAgICAgICB9LAogICAgICAgICJOZWdhdGl2ZSI6IHsKICAgICAgICAgICJ0eXBlIjogIm51bWJlciIKICAgICAgICB9LAogICAgICAgICJOZXV0cmFsIjogewogICAgICAgICAgInR5cGUiOiAibnVtYmVyIgogICAgICAgIH0sCiAgICAgICAgIk1peGVkIjogewogICAgICAgICAgInR5cGUiOiAibnVtYmVyIgogICAgICAgIH0KICAgICAgfSwKICAgICAgImFkZGl0aW9uYWxQcm9wZXJ0aWVzIjogZmFsc2UKICAgIH0KICB9LAogICJzZWN1cml0eURlZmluaXRpb25zIjogewogICAgImFwaWtleSI6IHsKICAgICAgInR5cGUiOiAiYXBpS2V5IiwKICAgICAgIm5hbWUiOiAiYXBpa2V5IiwKICAgICAgImluIjogImhlYWRlciIsCiAgICAgICJkZXNjcmlwdGlvbiI6ICJSZXF1aXJlIGF1dGhvcml6ZWQgYWNjZXNzIHRvIEFQSSIKICAgIH0KICB9LAogICJzY2hlbWVzIjogWyJodHRwIl0KfQo="
            }
        },
        "group": "management",
        "tags": []
    }
}

Note the Base64 encoded OAS2 Swagger definition for the API I imported above.

The third is related to the APIServiceInstance resource being created:

{
    "id": "6ed03d54-448e-4306-abc5-3c0498d2169a",
    "time": "2021-04-02T12:17:41.273+0000",
    "version": "v1",
    "product": "AmplifyCentral",
    "correlationId": "22f13510-20f5-4e77-bbb5-7f8b2f3c674d",
    "organization": {
        "id": "100000142"
    },
    "type": "ResourceCreated",
    "payload": {
        "finalizers": [],
        "metadata": {
            "id": "8a2e83617870fa00017892848284118f",
            "audit": {
                "createTimestamp": "2021-04-02T12:17:40.996+0000",
                "createUserId": "789f8247a10c466f36894f0f3cfdce19",
                "modifyTimestamp": "2021-04-02T12:17:40.996+0000",
                "modifyUserId": "789f8247a10c466f36894f0f3cfdce19"
            },
            "scope": {
                "id": "8a2e96e67870fa1c01788e7e19d30ed0",
                "kind": "Environment",
                "name": "manualenv",
                "selfLink": "/management/v1alpha1/environments/manualenv"
            },
            "resourceVersion": "286975",
            "references": [
                {
                    "id": "8a2e83617870fa00017892848124118d",
                    "kind": "APIServiceRevision",
                    "name": "comprehend-version",
                    "type": "hard",
                    "selfLink": "/management/v1alpha1/environments/manualenv/apiservicerevisions/comprehend-version"
                }
            ],
            "selfLink": "/management/v1alpha1/environments/manualenv/apiserviceinstances/comprehend-endpoint"
        },
        "apiVersion": "v1alpha1",
        "kind": "APIServiceInstance",
        "name": "comprehend-endpoint",
        "attributes": {},
        "title": "comprehend",
        "spec": {
            "endpoint": [],
            "apiServiceRevision": "comprehend-version"
        },
        "group": "management",
        "tags": []
    }
}

In each case, the headers looked similar to the following, including the Authorization header which contains the secret set above, Password123:

Host: en9c5wvi5vta4.x.pipedream.net
X-Amzn-Trace-Id: Root=1-6065c447-3c5b35a840f6e43e078b9c79
Content-Length: 1295
Authorization: Password123
X-Axway-Event-Id: 170d3081-9c48-459e-82e2-f37f5e3f1d74
User-Agent: amplify-central
Accept: application/json
Content-Type: application/json

Summary

In this blog post, we looked at an example of how to set up an Integration Webhook for all resources in a particular Amplify Central environment using Amplify Central API calls. The webhook calls were sent to requestbin for analysis but in a real-world application, the webhooks would trigger your application, which would parse the payload and perform the necessary actions.

In the next blog post, we’ll look at an example of an Integration Builder flow that processes Integration Webhooks.

Learn more about Amplify Central.