Last updated Dec 16, 2022

Rate this page:

Webhooks and events

This page explains the webhooks and associated events of the App migration platform.

Webhooks

The webhook that you register is a callback URL to which the App migration platform sends information about migration events. A sample webhook URL looks like this: https://example.com/my-migration-listener. Ensure the endpoint can accept HTTPS POST requests.

Webhook acknowledgement: Your cloud app must return a success response code (HTTP response code 200 OK) as an event acknowledgement within 5 seconds to webhook requests sent by the App migration platform. The App migration platform will send the webhook message in the form of a POST request repeatedly to your cloud app until it receives an acknowledgement.

Use the Notification API to register webhooks with the App migration platform. Registering webhooks allows the platform to notify you when specific events take place on your server app.

We strongly recommend you always verify the JWT headers for all events received on your endpoint.

About the Notification API

The endpoints of the Notification API allow you to do the following:

  • Register webhooks
  • Get registered webhooks
  • Delete registered webhooks

The sections that follow explain all the above endpoints, and provide examples on how to use them.

Register webhooks

Use the migration/webhook endpoint to register your webhooks after your app has received the enabled lifecycle event.

We recommend that you register your cloud app to receive lifecycle events to ensure that registering your webhook with the App migration platform is successful.

The App migration platform notifies the webhook URLs specified in request payload (i.e. endpoints field) of the following API when the migrations are ready or available on the server app.

MethodEndpointPayload
PUTmigration/webhook{"endpoints" : ["https://<your-url>/<your-notification-api>"]}

The above endpoint field must contain a non-empty JSON array with an absolute URL/s.

See an example

This section shows you an example of a request and response to register a webhook.

  • Sample request

    1
    2
    curl -X PUT "https://your-cloud-site/rest/atlassian-connect/1/migration/webhook" \
    --header 'Content-Type: application/json' \
    --data-raw '{"endpoints" : ["https://<your-url>/<your-notification-api>","https://<your-url>/<your-notification-api2>"]}'
    
  • Sample response

    1
    2
    200 OK
    

Get registered webhooks

Use the endpoint below to get webhooks that your cloud app has registered with the App migration platform.

MethodEndpoint
GETmigration/webhook

See an example

This section shows you an example of a request and response get registered webhooks.

  • Sample request

    1
    2
    curl -X GET "https://your-cloud-site/rest/atlassian-connect/1/migration/webhook" \
    --header 'Content-Type: application/json'
    
  • Sample response

    1
    2
    {
        "endpoints": [
            "https://<your-url>/<your-notification-api>",
            "https://<your-url>/<your-notification-api2>"
        ]
    }
    

Delete registered webhooks

Use the endpoint below with an empty array to delete or replace existing webhooks for a specific cloud ID.

MethodEndpoint
PUTmigration/webhook

See an example

This section shows you an example of a request and response to delete existing webhook URLs for a specific cloud ID. For example, if you want to delete all existing webhooks, you can use PUT /migration/webhook with an empty list.

  • Sample request

    1
    2
    curl -X PUT "https://your-cloud-site/rest/atlassian-connect/1/migration/webhook" \
    --header 'Content-Type: application/json' \
    --data-raw '{"endpoints":[]}'
    
  • Sample response

    1
    2
    200 OK
    

Events

Types of events

The App migration platform provides notifications to your cloud app using the following event types:

Event typeDescription
listener-triggeredNotifies your cloud app when core product data migration is complete or incomplete. The App migration platform will not notify your cloud app if core product data migration fails.
app-data-uploadedNotifies your cloud app that app data upload to the Atlassian secure cloud storage is complete.
listener-erroredNotifies your cloud app that the execution of your server side listener method (onStartAppMigration) has stopped with an exception. Please refer to server side exceptions page for more information about this event and follow up actions for your cloud app.

Note: This feature is available for app migrations using CCMA v3.3.7 and JCMA v1.7.2 onwards.
transfer-cancellation-requestedNotifies your cloud app that a customer requested a transfer to be cancelled. Please refer to transfer cancellation page for more information about this event and follow up actions for your cloud app.

The App migration platform may notify your cloud app about events in a different order to the list above. app-data-uploaded may appear before listener-triggered event notifications.

App migration platform can introduce new event types in addition to above listed event types. New event types can have different event attributes.

It's a good practice to validate the event's payload and return an error response (HTTP 4xx) if the validation fails. This will help you monitor the failed webhook events and investigate for any missing events. We will retry sending the webhook event for this scenario.

Definitions of event attributes

This section provides information you can use to interpret events.

Event attributeDefinitionExamples of application
eventTypeSpecifies the event type.Your cloud app can respond with a request, based on the event type it receives. For example, it can make a query for mappings.
cloudAppKeyThe app key installed app key in the cloud site.NA
transferIdAn ID (UUID) that the App migration platform uniquely generates per migration for each listener.Your cloud app must include this UUID when making a request for migration-related mappings.
messageIdAn ID (UUID) that the App migration platform generates to uniquely recognise an event.The App migration platform may send duplicate notifications for the same event. Use this ID to detect duplication, if your app is sensitive to duplicate notifications.
migrationIdAn ID (UUID) that the App migration platform uses to uniquely identify a migration.NA
migrationScopeIdAn ID that the App migration platform generates to uniquely determine a source (server) and destination (cloud-site) of migration.NA
nameThe name of the migration plan provided by the user who initiated the migration.Use this as a quick way to identify a migration while troubleshooting.
createdAtTimestamp of when the app migration was created.NA
jiraClientKeyThis is the clientKey of the Jira cloud instance, present in the installed lifecycle callback sent to your cloud application during installation.This value is 'unknown' when the Jira product is not involved in the migration.
confluenceClientKeyThis is the clientKey of the Confluence cloud instance, present in the installed lifecycle callback sent to your cloud application during installation.This value is 'unknown' when the Confluence product is not involved in the migration.
cloudUrlURL of the destination cloud site for the migration.Use this URL to upload/modify data related to your app migration.
s3KeyAn ID (UUID) to uniquely identify the data your server app uploads to cloud storage. This will only be present on app-data-uploaded events.Your cloud app must use this ID to request access to ID-specific data in cloud storage.
labelMetadata that provides additional information about the data your server app uploads to cloud storage. This will only be present on app-data-uploaded events.NA

JSON representation of event object

Confluence migration event object

1
2
{
    "eventType": "listener-triggered",
    "cloudAppKey": "my-cloud-app-key",
    "transferId": "e4166374-2345-4c31-918c-83b14eb644f6",
    "migrationDetails": {
        "migrationId": "8e60dc59-78d6-484f-966a-a09ff8be8ed0",
        "migrationScopeId": "442bdd69-622d-323d-889d-383b41d8e536",
        "name": "Migration of my Confluence page",
        "createdAt": 1597211035,
        "jiraClientKey": "unknown",
        "confluenceClientKey": "03a7cb4b-23b6-3a79-8916-8824a053e786",
        "cloudUrl": "https://cloud-site-under-migration.atlassian.net"
    }
}

Jira migration event object

1
2
{
    "eventType": "app-data-uploaded",
    "cloudAppKey": "my-cloud-app-key",
    "transferId": "16a84eaa-3f88-4758-94d4-ea245a3b202f",
    "migrationDetails": {
        "migrationId": "a0b8ed5a-a335-4e0d-b20f-17d821b40c2d",
        "migrationScopeId": "47d54f22-0b9d-4cda-a527-c65ef65f2564",
        "name": "Migration of my jira project",
        "createdAt": 1597193662,
        "jiraClientKey": "acb711b8-a878-356e-abbf-1ae1730308a2",
        "confluenceClientKey": "unknown",
        "cloudUrl": "https://cloud-site-under-migration.atlassian.net"
    },
    "s3Key": "636abf0f-38a2-45c1-8c68-9c7edde97f3f",
    "label": "some-optional-label"
}

Rate this page: