Attempting to register Webhooks

I’m trying to register a custom webhook (using a sandbox environment) and getting a permissions error. Would appreciate some help!

The OAuth connection is established with the following scopes:
ITEMS_READ MERCHANT_PROFILE_READ PAYMENTS_WRITE_ADDITIONAL_RECIPIENTS PAYMENTS_WRITE PAYMENTS_READ DEVELOPER_APPLICATION_WEBHOOKS_WRITE

The request code is as follows:

const { webhookSubscriptionsApi } = new Client({
        accessToken: util.types.toString(myConnection.token?.access_token),
        environment: Environment.Sandbox
      });

      await webhookSubscriptionsApi.createWebhookSubscription({
        idempotencyKey: uuidv4(),
        subscription: {
          name: 'Example Webhook Subscription',
          eventTypes: [
            'payment.created',
            'payment.updated'
          ],
          notificationUrl:  <notification URL>,
          apiVersion: '2021-12-15'
        }
      });

Below is a snippet of the response (I can provide the full responses if helpful):

{
  "errors": [
    {
      "category": "AUTHENTICATION_ERROR",
      "code": "INSUFFICIENT_SCOPES",
      "detail": "The merchant has not given your application sufficient permissions to do that. The merchant must authorize your application for the following scopes: DEVELOPER_APPLICATION_WEBHOOKS_WRITE"
    }
  ]
}

The WebhookSubscription endpoint can only be called with your personal access token. Not an OAuth access token. Webhook subscriptions are scoped to the entire application not to each sellers account. Any event the application is subscribed to you will get it with every seller that’s OAuth’d to it. :slightly_smiling_face:

Well that was an instant success! Thank you :grin: