Triggering external webhook when user is done with content

We want to use H5P for introduction courses for new employees and students.

We have created the content, but we want to be able to send a signal of some kind when the course is finished to an external server. For example when a new employee finishes a required course, then H5P will trigger a webhook and that webhook will set a marker somewhere else that the user has completed the course and is eligible for more resources, higher privileges or has done required work.

I have spent some time in the documentation trying to figure out what I can use to achieve what we want to do and to me it seems xAPI might be usable, but it seems to only work internally in H5P?

Is this possible?

Any solution to store the username of the user somewhere when finished or trigger a webhook is welcome.

otacke's picture

Hi!

The xAPI statements are broadcasted inside the H5P iframe. You can add your own JavaScript to the H5P iframe (using the alter_scripts hook, see the respective customization page for your platform at https://h5p.org/node/2692), that script can listen for xAPI statements (or listen for other events, check the DOM for clues, etc.) and relay the information to the server where it can be processed further.

Best,

Oliver