x

Troubleshooting Webhooks

A Weebly Developer reached out to me in a developer support case with troubles setting up webhooks and asking me to confirm that we were broadcasting events. I hadn't received any other reports of issues with webhooks, and after I provided the developer with my step-by-step webhook troubleshooting guide, everything was working as expected.

Are you experiencing issues while developing with Webhooks?

Have you learned something about developing with Webhooks, and want to help other Weebly Developers?

2,110 Views
Message 1 of 3
Report
2 REPLIES 2

To test that your app is receiving webhook events properly, you will want to simplify the problem by reducing it down to the most simple of use cases. The easiest way to do that is to ONLY subscribe to the simplest actions a site administrator can perform and which are known to generate/broadcast expected events: user.update, app.uninstall.

Optionally, you can subscribe to site.publish events which is also a common action performed by Weebly Site Administrators.

Webhook Troubleshooting Guide:

  1. Make sure the webhooks.events array in your app's manifest.json file includes user.update, app.uninstall, and optionally site.publish.
  2. Just to make sure, I always explicitly add read:user in the scopes property of my app's manifest.json file. (If you added site.publish events to your webhook subscription, make sure to add read:site to the scopes array of your app's manifest.json).
  3. Make sure the webhooks.callback_url is set to a publicly available URI over TLS/SSL (uses the https scheme).
  4. If you had to make any of the above changes to your code or app's manifest.json, make sure to bundle/upload a new ZIP (you can use the same version in development mode).
  5. If you had to complete step 4, make sure you uninstall the previously installed version (just to be certain) using the Weebly Site Admin -> Apps -> My Apps/Manage Apps
  6. If you had to complete step 4, make sure to install the newly saved draft into your development test site and complete the authorization flow.
  7. Once the app installation is complete, logout of Weebly (https://www.weebly.com/logout) completely.
  8. Once logout has completed, log back into Weebly (https://www.weebly.com/login) as if you were going to make content changes to your Developer Test Site, and now you should receive a user.update event (I've stripped my private data from the following example).
{
    "client_id": "XXXXXXXXX",
    "client_version": "1.0.0",
    "event": "user.update",
    "timestamp": 1526502531,
    "data": {
        "user_id": XXXXXXXX
    },
    "hmac": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
}

9. If you included site.publish event in your webhook subscription, go ahead and publish the site where you have your app installed, and verify that you are receiving Site Publish events.

Let me know if this helps.

2,108 Views
Message 2 of 3
Report

Thanks for this guide. My issue was that I subscribed to site.update and then as a test I changed the time format (12h/24h) on the site and expected a webhook for it. It seems that change isn't sending a site.update. When I added the user.update and logged in/out I received the hook.
2,104 Views
Message 3 of 3
Report