Webhooks not triggering...

Webhooks not triggering...

by B G -
Number of replies: 7

Hello Community...

I'm new to Moodle and this forum.  We're just starting to evaluate Moodle for a 1 million user base.  As part of our checklist, we need to make sure webhooks are working fine for integration purposes.  

We're running 3.5.3 and hosted on TMD and installed a local Webhook plugin (3.0.2 (Build: 2018061910).  The plugin is installed correctly, but no webhook ever fires on any trigger events.  We first thought our callback URL was not encoded correctly, etc..    The logs don't show the webhook firing.

Since we're new with Moodle, we're convinced the problem is with the Moodle configuration not being correct, or because it's hosted on a 3rd party cloud platform.

We would really appreciate any guidance or recommendations.  If our eval of Moodle is positive, we'll most likely need to work a with a few professionals to handle this large effort.  If you are willing to help us figure this webhook issue, we would like to entertain the idea of further developing a business relationship with you or your firm.


Ben Girard, CIO/CTO

Write Score, LLC




Average of ratings: -
In reply to B G

Re: Webhooks not triggering...

by Dan Marsden -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Plugins guardians Picture of Testers Picture of Translators

Hi Ben!

Welcome to Moodle - sounds like a challenging project!

That webhooks plugin is likely to cause quite a significant performance load on your site. The webhooks plugin (and other similar ones like our tool_trigger plugin which might also do what you were looking for) add a "listener" for every event on the site - causing extra processing to occur on your server for every single moodle event. Personally I think our tool_trigger plugin is more efficient than the webhooks plugin but I have to admit I could be biased and haven't spent a lot of time looking at the webhooks plugin codebase.

With the planned size of your site you would probably be better to write a custom plugin that listened to the specific events you were interested in and make sure the code is very efficient/makes use of the Moodle caching apis etc.

Just a big warning though - TMD is not a certified Moodle Partner and does not have the contacts or experience with Moodle to run a project this large - with a project this size you would be better to engage directly with an official Moodle Partner that has experience with running large sites and help you to achieve what you are looking for with the webhooks plugin without causing a performance impact on your site.

Good luck!

In reply to B G

Re: Webhooks not triggering...

by Justin Hunt -
Picture of Particularly helpful Moodlers Picture of Plugin developers

Hi Ben

Just to provide another option. We also developed a webhook tool for a client, and its also called "trigger" (sorry Dan). It was designed to interface with Zapier and via that sync user data to a CRM

It is here : https://github.com/justinhunt/moodle-local_trigger

In the case of this one it only adds a listener for the events the admin selects, and it stores them as Moodle settings.

So it avoids the "heavy" that Dan warned about. And so it also requires a trip to the Site admin -> notifications page after you register a new webhook against an event. Possibly the webhooks plugin works the same way, and that is why its not working? Sorry I am not familiar with it. Perhaps it helps.

Average of ratings: Useful (1)
In reply to Justin Hunt

Re: Webhooks not triggering...

by Dan Marsden -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Plugins guardians Picture of Testers Picture of Translators
haha - awesome! - at least we used different plugin types! smile - would be good to see that submitted to  plugins db.


Interesting to hear your method of subscribing to single events  - we thought about that but instead spent a lot of time making sure we could make the lowest performance impact possible using lots of caching and the actions get processed in a queue outside the page load.

Maybe one day we could reformat the events subscription process in core so that it we can rebuild it differently for this scenario.

Ben - if you are hitting the ground running with 1Million users, I'd still lean towards writing your own custom plugin to manage this, in some cases (for performance) you may find events are the wrong thing to use to trigger the external call, but if you are starting with a smaller set of users you may find one of those plugins will suit your needs in the short-term.

Justin - interesting to hear zapier mentioned too - I was looking at zapier recently for a client that wanted to use the zapier webhooks to trigger a webservices call in Moodle - but we found the format of the posted data didn't suit the core moodle webservice service types. - Our webservice_restful plugin got me close - but I had issues passing the token in the autorization header (https://github.com/catalyst/moodle-webservice_restful/issues/4)

It wouldn't have taken much to modify that plugin to accept the token in a different var though!

In reply to Justin Hunt

Re: Webhooks not triggering...

by B G -

Hi Justin,

First, thank you developing a webhook plugin!!   We just installed it on our first Moodle instance 3.6 on Windows Azure, using a Azure SQL as the DB and Windows server as the base image.  The trigger/webhook setup was a breeze, the environment is really fast, but webhook don't get triggered by the event.  The events that are supposed to fire do show up in the Logs.  Do I need enable a specific protocol somewhere?

Would you have an idea as to where I can look to figure out the problem and get the trigger to fire?

Here's the text I get when I go to the System Administration/Notifications.

Thanks in Advance

Your Moodle code is up-to-date!

Check for available updates
Last check done on 5 December 2018, 3:15 AM
The cli/cron.php maintenance script has not been run for at least 24 hours. 
The Moodle app is not enabled. 
Enable web services for mobile devices


In reply to B G

Re: Webhooks not triggering...

by Justin Hunt -
Picture of Particularly helpful Moodlers Picture of Plugin developers

@Ben So since we are in the General Help forum, and you are in the evaluation stage. How about you tell us what your solution needs to do? And what the non-Moodle options you are looking at are? 

@Dan. Yeah I guess we will release local_trigger .. its just that maintaining all these plugins takes time. With Zapier it was much easier to sync Moodle -> Zapier -> CRM than the other way around. Though we did both. Ping me if you want more on that.

In reply to Justin Hunt

Re: Webhooks not triggering...

by B G -

Hi Justin,

At this point of our research, we're using Moodle to qualify contractors and make them take certain tests.  I must have webhooks working to pass the metadata that I need (name, email, course, etc..) to trigger other workflows (e-signature, onboarding processes, etc..).  

This is the 2nd webhook plugin that I try (on a brand new Moodle tenant) and still get nothing to trigger my process.  The strange part is no activity shows up in the log of Moodle and I know my callback URL to Microsoft Flow (like Zappier) works.

I'm convinced there is something not configured correctly...but have no clue what it is..

We're brand new to Moodle, what is the best support model in this case?  (a 3rd party plugin).  Can I call a number and pay X dollars to get someone to troubleshoot?

Thanks...




In reply to B G

Re: Webhooks not triggering...

by Justin Hunt -
Picture of Particularly helpful Moodlers Picture of Plugin developers

Hi Ben

When I try all sort of different things and absolutely nothing works, thats a pretty good sign that I am Mario Kart driving in the wrong direction on the grass. And I need to rethink my assumptions. I made a video of installing local_trigger, adding a webhook and testing it. Its about 5 mins all up. Lets hope this gets you back on the fast lane.

https://www.screencast.com/t/lkEDt9FlO7K

With regards support in Moodle. That is usually the domain of Moodle partners, or in some cases you might have an ad-hoc relationship with a Moodle professional. There are restrictions on who can promote themselves as able to provide Moodle services. Basically you need to have been approved by Moodle and stuff. I know there are Moodle partners who are flexible enough to allow you to host it in your own way, and just provide support.

I am from Poodll and we just support our own plugins. We do not provide Moodle services per se.

PS one other thing I did not add in the screencast, which could be pertinent. Moodle caches a lot of settings and stuff. After adding a webhook in local_trigger, you should 'purge all caches', to make sure Moodle picks it up. Do that at:

site admin->debugging->purge all caches