Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: update quickstart #442

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 11 additions & 20 deletions docs/quickstarts/use-events-to-call-webhook.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,19 @@ Using Open edX Events in the LMS service
Live example
------------

For a complete and detailed example you can see the `openedx-events-2-zapier`_
plugin. This is a fully functional plugin that connects to
``STUDENT_REGISTRATION_COMPLETED`` and ``COURSE_ENROLLMENT_CREATED`` and sends
the relevant information to zapier.com using a webhook.
For a complete and detailed example you can see the `openedx-events-2-zapier`_ plugin. This is a fully functional plugin that connects to ``STUDENT_REGISTRATION_COMPLETED`` and ``COURSE_ENROLLMENT_CREATED`` and sends the relevant information to zapier.com using a webhook.

Let's see it working!

Setup your environment
----------------------

This tutorial assumes you're using `Tutor`_ > 13.x and its default services are
already provisioned.
This tutorial assumes you're using `Tutor`_ > 13.x and its default services are already provisioned.

Installation
------------

For this tutorial to work, you'll need a openedx image with the following package
installed:
For this tutorial to work, you'll need a openedx image with the following package installed:

- `openedx-events-2-zapier`_

Expand All @@ -30,11 +25,9 @@ You can use your preferred method for installing new packages in Tutor.
Configuration
-------------

The package we just installed is a `Django plugin`_, which adds additional
configurations to our working environment thanks to the extension mechanisms put in place. Now,
:term:`event receivers <Event Receiver>` are listening to the registration and enrollment events sent within the LMS service.
The package we just installed is a `Django plugin`_, which adds additional configurations to our working environment thanks to the extension mechanisms put in place. Now, :term:`event receivers <Event Receiver>` are listening to the registration and enrollment events sent within the LMS service.

The following is the implementation for the `event receivers <Event Receiver>` listening for the event ``STUDENT_REGISTRATION_COMPLETED``:
The following is the implementation for the :term:`event receivers <Event Receiver>` listening for the event ``STUDENT_REGISTRATION_COMPLETED``:

.. code-block:: python

Expand Down Expand Up @@ -97,9 +90,7 @@ The following is the implementation for the `event receivers <Event Receiver>` l
flatten_dict(zapier_payload),
)

Those `event receivers <Event Receiver>` work out of the box after the plugin installation. Now, we must
set the plugin settings which indicate where to send the events data. For this,
go to ``env/apps/openedx/settings/development.py`` and add your Zapier configuration:
Those :term:`event receivers <Event Receiver>` work out of the box after the plugin installation. Now, we must set the plugin settings which indicate where to send the events data. For this, go to ``env/apps/openedx/settings/development.py`` and add your Zapier configuration:

.. code-block:: python

Expand All @@ -109,13 +100,13 @@ go to ``env/apps/openedx/settings/development.py`` and add your Zapier configura
Getting data from Zapier
------------------------

Now that you have configured both `event receivers <Event Receiver>`, you'll need to trigger the events
so you receive the events data in Zapier. Try it out!
Now that you have configured both :term:`event receivers <Event Receiver>`, you'll need to trigger the events so you receive the events data in Zapier. Try it out!

.. warning::
The `event receiver <Event Receiver>` function implemented in this tutorial was intended to be lightweight, just to serve as an example for event receivers. However, in production
settings, we encourage the use of asynchronous tasks to avoid creating bottlenecks.

.. _openedx-events-2-zapier: https://github.com/eduNEXT/openedx-events-2-zapier
.. _Tutor: https://github.com/overhangio/tutor
.. _Django plugin: https://github.com/openedx/edx-django-utils/blob/master/edx_django_utils/plugins/README.rst

.. warning::
The `event receiver <Event Receiver>` function implemented in this tutorial was intended to be lightweight, just to serve as an example for event receivers. However, in production
settings, we encourage the use of asynchronous tasks to avoid creating bottlenecks.
Loading