XF 2.3 Automate workflows with webhooks

hys_5_make_create_webhook.png
hys_5_spoiler.png xenforo.com_community_threads_a-first-look-at-xenforo-2-3.216641_ (1).png xenforo.com_community_threads_a-first-look-at-xenforo-2-3.216641_.png

In what is probably one of the worst kept secrets in XenForo 'Have you seen...?' history, the eagle eyed amongst you may have picked up on one or two... or three... clues that we may be talking about this soon, and the day has finally arrived! Today we're excited to show you our take on the highly requested webhook implementation in XenForo.

For those of you who haven't heard of webhooks before, they are a powerful utility that allow one application or service to send information to another when certain events occur. These can be everyday actions such as when making a payment for access to a product or service, or more specific implementations such as having a new Thread from your forum posted to Discord automatically.

It is likely that even if you're not a developer type person then you have utilised or encountered webhooks in one way or another at some point without realizing.

Here at XenForo, we automate a lot of our workflow using webhooks, some of which may be obvious, others less so. For example, we receive a webhook from GitHub every time that we fix a bug report - this is what automatically marks bug reports as fixed. Another example, is we send a webhook to Slack every time someone posts a bug report or reports content.

Webhooks as a general concept, can be a very flexible tool with an endless amount of use cases, the ability to send webhooks whenever certain events occur on your forum to another system is going to be something you can take advantage of starting with XenForo 2.3.

Now while webhooks may appear on the surface to be something targeted towards developers, there are a number of fantastic third party automation services which are capable of receiving webhooks and triggering actions. These services, such as IFTTT, Make, and Zapier, offer a convenient and user friendly way to automate and integrate applications within your website with thousands of integrations already available.

Closer integration with one or more of these services is being considered for a future release, but all three of the above examples do accept webhooks as a trigger.

As ever, there's a lot to talk about in this one so feel free to jump to a specific section below:
We're excited to hear what you think about webhooks coming to XenForo and what kind of use cases you'll be exploring. Let us know below.

Have you had enough yet? We haven't. There's more to come next week!
 
This is awesome. Can this feature also receive and act upon webhook events? e.g., when an external event happens from an integrated source (e.g., turn on an IoT light, via IFTTT), a thread could be started in a designated forum? Which could then be configured to send a notification to users subscribed to the thread.
The first release of webhooks feature is not going to be bidirectional, am I right @Chris D ?
 
The first release of webhooks feature is not going to be bidirectional, am I right @Chris D ?

Correct.

Though it's worth checking with automation providers whether they support sending custom HTTP requests.

Zapier and Make do and it may be that IFTTT and others can do similar things too:


With that in mind, you could receive a webhook from XenForo, do something, then respond with a HTTP request using the existing XenForo REST API.

That would be bidirectional.

This could also cover the automatic registration on another site case.
 
Correct.

Though it's worth checking with automation providers whether they support sending custom HTTP requests.

Zapier and Make do and it may be that IFTTT and others can do similar things too:


With that in mind, you could receive a webhook from XenForo, do something, then respond with a HTTP request using the existing XenForo REST API.

That would be bidirectional.

This could also cover the automatic registration on another site case.
And all of a sudden this just got a whole lot more powerful also.
 
I'm also wondering if webhooks can be used between xenforo installations? Or if this is planned in future?
USER registers on x.com, notify y.com (or also register on Y) .
Thread posted on x.com, mirror thread on y.com

Essentially creating links between xenforo sites, or the sharing or certain information.
It would be great if user registration could be possible between 2 xenforo. One user database for 2 forum.
 
Will there be a way to customize the webhook data/format that is sent? So we wouldn't need to go via Zapier or Make and instead to direct endpoints?
 
Could be a cool idea to have prefixes / other core thread elements being part of the thread webhook.

E.g. Thread with a prefix of 'Danger' in a specific node could trigger a webhook. However, thread with a different prefix or no prefix in that node do nothing.
 
@Chris D, Can you provide an example of creating an event and calling the created event?

Create / update / delete events are sent automatically for any Entity that uses the Webhook Behavior.

The feature/unfeature webhooks are triggered like this:

PHP:
\XF::repository(\XF\Repository\Webhook::class)->queueWebhook(
    $content->getEntityContentType(), $content->getEntityId(), 'feature', $content
);

We are fleshing a bunch of stuff out in terms of defining arbitrary events, and I'm sure we'll talk about the specifics of that in a future HYS.

There's a content type handler type system for listing those events on the webhook add/edit page, along with customisable filters etc.
 
Great feature, loads of applications come to mind. I think I'd love to see some special attention around subscriptions as well though I assume we'd need bidirectional support for things like if Stripe payment is refunded. Sending a user a notification on platform when something specific (as in not currently covered) happens with their subscription could be extremely valuable.
 
Could be a cool idea to have prefixes / other core thread elements being part of the thread webhook.

E.g. Thread with a prefix of 'Danger' in a specific node could trigger a webhook. However, thread with a different prefix or no prefix in that node do nothing.
Same. I did look for (and find) prefix_id in one of the screenshots above 👍
 
I see lots of cool here. Not sure exactly how I would use it right now given the nature of my site, but knowing of its forthcoming existence allows me to meditate on possibilities.
 
This will probs let me remove another couple addons. Except the fact that we want Discord login for less roadblocks for members to join. They like the simple 1-2 click sign up, so we may use the login features and use webhooks natively for posting from areas of the site.

Will Media Gallery pic uploads work to upload to galleries on Discord? Or is that not possible?
 
Same. I did look for (and find) prefix_id in one of the screenshots above 👍
Yeah so bear in mind the filtering example I demonstrated using Make, I think most platforms support something similar.

You can check if prefix_id is equal to a specific value and perform different actions depending on the result, or no actions at all if necessary.
 
Back
Top Bottom