You can use webhooks to sync data between Discourse and WordPress, and enrich your integration. Reply to this topic if you have questions about how to setup the webhooks, or how they work.
Setup
WP Discourse
First setup an endpoint in WP Discourse:
- Navigate to WP Discourse > Webhooks in Wordpress admin.
- Select the endpoint(s) you want to enable (see below).
- Set a “Webhook Secret Key”, if it’s not already set.
- Click “Save Options”.
Discourse
Then create a new Webhook in Discourse (Go to /admin/api/web_hooks/new
):
- Copy the Payload URL from the relevant setting in WP Discourse.
- Enter the Secret you set in “Webhook Secret Key” in WP Discourse.
- Select the Events from the relevant setting in WP Discourse.
- Select “Active”.
- Click “Create”.
- Send a “Ping” to ensure the webhook is working.
Endpoints
Sync Comment Data
This endpoint keeps Discourse post data stored in Wordpress up-to-date as posts are updated on Discourse. This means that when Discourse comments are loaded on a Wordpress post up-to-date comment data is available without needing to make a request to Discourse. This may improve the performance of Wordpress posts that have Discourse comments.
Settings
Match Posts by Title
. When enabled, the Sync Comment Data endpoint will try to match Discourse topic titles to Wordpress post titles if the endpoint hasn’t been able to find any other relevant data to match from a Webhook payload. Keep this disabled unless you have a specific reason to enable it.
Update Userdata
This endpoint keeps Discourse user data stored in Wordpress up-to-date as it changes in Discourse. This will automatically set and update the “Discourse Username” in the Wordpress user profile, which is used to set the user when publishing posts to Discourse.
Settings
Match Users by Email
: When enabled, the Update Userdata endpoint will try to match Discourse users to Wordpress users by email if the endpoint hasn’t been able to find any other relevant data to match from the Webhook payload. Keep this disabled unless you have a specific reason to enable it.