Subscribe to notifications - Amazon WorkDocs

Subscribe to notifications

You can subscribe to notifications that Amazon WorkDocs sends when specific actions occur.

To subscribe to WorkDocs notifications

  1. Prepare your endpoint to process Amazon SNS messages. For more information, see Make sure your endpoint is ready to process Amazon SNS messages in the Amazon Simple Notification Service Developer Guide.

    Note

    If you require FIPS 140-2 validated cryptographic modules when accessing AWS through a command line interface or an API, use a FIPS endpoint. For more information about the available FIPS endpoints, see Federal Information Processing Standard (FIPS) 140-2.

  2. Enable notifications for the IAM role that your application is using. See Managing notifications for an IAM user or a role.

  3. Create the subscription request as follows:

    CreateNotificationSubscriptionRequest request = new CreateNotificationSubscriptionRequest(); request.setOrganizationId("d-1234567890"); request.setProtocol(SubscriptionProtocolType.Https); request.setEndpoint("https://my-webhook-service.com/webhook"); request.setSubscriptionType(SubscriptionType.ALL); CreateNotificationSubscriptionResult result = amazonWorkDocsClient.createNotificationSubscription(request); System.out.println("WorkDocs notifications subscription-id: " result.getSubscription().getSubscriptionId());

SNS Notifications

The message includes the following information:

  • organizationId — The ID of the organization.

  • parentEntityType — The type of the parent (Document | DocumentVersion | Folder).

  • parentEntityId — The ID of the parent.

  • entityType — The type of the entity (Document | DocumentVersion | Folder).

  • entityId — The ID of the entity.

  • action — The action, which can be one of the following values:

    • delete_document

    • move_document

    • recycle_document

    • rename_document

    • revoke_share_document

    • share_document

    • upload_document_version

Follow these steps to obtain a Amazon WorkDocs organization ID from the AWS console:

To get an organization ID

  1. In the AWS Directory Service console navigation pane, choose Directories.

  2. Note the Directory ID value that corresponds to your Amazon WorkDocs site. That is the Organization ID for the site.