Setting up notifications - Amazon WorkDocs

Setting up notifications

To set up notifications, follow these broad steps:

  1. Set IAM user or role permissions. These allow caller access to the notification subscription management APIs.

  2. Call the notification subscription APIs to enable or disable the publishing of SNS messages to your endpoint.

To set IAM user permissions
  • Use the IAM console to set the following permissions for the user:

    { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "workdocs:CreateNotificationSubscription", "workdocs:DeleteNotificationSubscription", "workdocs:DescribeNotificationSubscriptions" ], "Resource": "*" } ] }
To enable notifications

Enabling notifications allows you to call CreateNotificationSubscription after you subscribe to notifications.

  1. Open the Amazon WorkDocs console at https://console.aws.amazon.com/zocalo/.

  2. On the Manage Your WorkDocs Sites page, select the desired directory and choose Actions and then Manage Notifications.

  3. On the Manage Notifications page, choose Enable Notifications.

  4. Enter the ARN for the user or role you want to allow to receive notifications from your Amazon WorkDocs site.

For information about enabling Amazon WorkDocs to use notifications, see Using the Amazon WorkDocs API with the AWS SDK for Python and AWS Lambda. Once you enable notifications, you and your user can subscribe to them.

To subscribe to WorkDocs notifications
  1. Prepare your endpoint to process Amazon SNS messages. For more information, see Fanout to HTTP/S endpoints in the Amazon Simple Notification Service Developer Guide.

    Important

    SNS sends a confirmation message to your configured endpoint. You must confirm this message in order to receive notifications. Also, 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. Do the following:

    • Get an organization ID

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

      2. The Directory ID corresponding to your Amazon WorkDocs site also serves as the Organization ID for that site.

    • 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

To disable notifications
  1. Open the Amazon WorkDocs console at https://console.aws.amazon.com/zocalo/.

  2. On the Manage Your WorkDocs Sites page, select the desired directory and choose Actions and then Manage Notifications.

  3. On the Manage Notifications page, select the ARN that you wish to disable notifications for and choose Disable Notifications.