Skip to content

Latest commit

 

History

History
192 lines (153 loc) · 6.89 KB

sdk_webhooks.md

File metadata and controls

192 lines (153 loc) · 6.89 KB

Webhooks

With Adobe I/O Events webhooks, your application can sign up to be notified whenever certain events occur. For example, when a user uploads a file to Adobe Creative Cloud Assets, this action generates an event. With the right webhook in place, your application is instantly notified that this event happened.

To start receiving events, you register a webhook, specifying a webhook URL and the types of events you want to receive. Each event will result in a HTTP request to the given URL, notifying your application.

There are two ways to consume events. 1. webhooks 2. journaling.

To learn more about webhooks, read the Introduction to Adobe I/O Events Webhooks.

For more information on journaling, read the Subscribe to Events Using Journaling guide.

For information on installing and using the SDK, please begin by reading the getting started guide.

Create a Webhook or Journal Registration

You can register a webhook endpoint by providing the webhook_url as part of the request body. If you want to register only a journal URL, you can set the delivery_type to JOURNAL in the request body and leave the webhook_url empty.

Method

createWebhookRegistration(consumerOrgId, integrationId, body) ⇒ Promise.<object>
Parameter Type Description
consumerOrgId string Consumer Org Id from the Adobe Developer Console integration URL.
integrationId string Integration Id from the Adobe Developer Console integration URL.
body object JSON data contains details of the registration. See the sample JSON body for registering a Journal URL or a Webhook URL for details.

Sample JSON Body to Register a Journal URL

The following is a sample JSON request body to register a journal URL. The request includes a name, description, client ID, and delivery type ("JOURNAL" or "WEBHOOK"), as well as an array listing each "event of interest" as an individual object containing the event code and provider ID.

{
    "name": "<name>",
    "description": "<desc>",
    "client_id": "<client_id>",
    "delivery_type": "JOURNAL",
    "events_of_interest": [
        {
            "event_code": "<event_code>",
            "provider_id": "<provider_id>"
        }
    ]
}

Sample JSON Body to Register a Webhook URL

The following is a sample JSON request body to register a webhook URL. You can provide additional events in the events_of_interest array by creating an object for each event containing the event_code and provider_id for the events you are interested in.

{
    "name": "<name>",
    "description": "<desc>",
    "client_id": "<client_id>",
    "webhook_url": "<url>",
    "events_of_interest": [
    {
        "event_code": "<event_code>",
        "provider_id": "<provider_id>"
    },
    ...
  ]
}

Get Webhook Registration Details

You can get the registration details for a registration by providing a specific registration ID.

Method

getWebhookRegistration(consumerOrgId, integrationId, registrationId) ⇒ Promise.<object>
Parameter Type Description
consumerOrgId string Consumer Org Id from the Adobe Developer Console integration URL.
integrationId string Integration Id from the Adobe Developer Console integration URL.
registrationId string Registration id whose Adobe Developer Console are to be fetched.

Sample Response

{
        "id": 248713,
        "name": "<name>",
        "description": "<desc>",
        "client_id": "<client_id>",
        "parent_client_id": "<client_id>",
        "webhook_url": "<url>",
        "status": "VERIFIED",
        "type": "APP",
        "integration_status": "ENABLED",
        "events_of_interest":
        [  
            {
                "event_code": "<event_code>",
                "event_label": "<label>",
                "event_description": "<event_desc>",
                "provider_id": "<provider_id>",
                "provider": "<provider_name>",
                "provider_label": "<provider label>",
                "event_delivery_format": "<cloud_events or adobe_io>"
            }
        ],
        "registration_id": "<reg_id>",
        "delivery_type": "<WEBHOOK or JOURNAL>",
        "events_url": "<journal_url>",
        "created_date": "2020-02-21T07:31:24.000Z",
        "updated_date": "2020-02-21T07:31:24.000Z",
        "runtime_action": ""
 }

List all webhook registrations

Get the list of all registrations for the provided organization ID (consumerOrgId) and integration ID (integrationId).

Method

getAllWebhookRegistrations(consumerOrgId, integrationId) ⇒ Promise.<object>
Parameter Type Description
consumerOrgId string Consumer Org Id from the Adobe Developer Console integration URL.
integrationId string Integration Id from the Adobe Developer Console integration URL.

Sample Response

The response array contains an object providing the details for each webhook registration. This response has been truncated to show only the first item in the array.

[
    {
        "id": "248713",
        "name": "<name>",
        "description": "<desc>",
        "client_id": "<client_id>",
        "parent_client_id": "<client_id>",
        "webhook_url": "<url>",
        "status": "VERIFIED",
        "type": "APP",
        "integration_status": "ENABLED",
        "events_of_interest":
        [  
            {
                "event_code": "<event_code>",
                "event_label": "<label>",
                "event_description": "<event_desc>",
                "provider_id": "<provider_id>",
                "provider": "<provider_name>",
                "provider_label": "<provider label>",
                "event_delivery_format": "cloud_events"
            }
        ],
        "registration_id": "<reg_id>",
        "delivery_type": "<WEBHOOK or JOURNAL>",
        "events_url": "<journal_url>",
        "created_date": "2020-02-21T07:31:24.000Z",
        "updated_date": "2020-02-21T07:31:24.000Z",
        "runtime_action": ""
    },
    ...
]

Delete a Webhook Registration

You can delete a webhook registration by providing the ID of the registration to be deleted along with the associated Consumer Org ID and Integration ID from Adobe Developer Console.

Method

deleteWebhookRegistration(consumerOrgId, integrationId, registrationId) ⇒ Promise.<object>
Parameter Type Description
consumerOrgId string Consumer Org Id from Adobe Developer Console.
integrationId string Integration Id from the Adobe Developer Console.
registrationId string ID of the registration to be deleted.

Response

Returns HTTP Status Code 204 (No Content) when the deletion is successful or 404 (Not Found) if the registration is not present.