Technical How-To: Daily Discussion Forum Digests - Appsembler

Technical How-To: Daily Discussion Forum Digests

Introduction

The forums digest is a built-in edX feature that comes with the notifier app. When the notifier app is properly configured, it will send a daily digest of the activity in the forum threads that the user is following.

The user can enable the option to receive daily digests on each course, in the course discussion home.

forums-digest-ht-1

The user will receive in the digest, only notifications for the threads that the user is following.

forums-digest-ht-2

The Notifier App

When you deploy Open edX following the normal procedures for a single server, the notifier app is always installed. But to get the forums digest working you need to add some extra configurations.

The Forums Digest functionality in the notifier app relies on the LMS user’s service API and the Comments Service (Forum) API. After grabbing the subscribed users and the forums’ activity, the notifier app will use a celery task to send the emails in batches.

The discussion is a key tool in many MOOCs (Massive Open Online Courses), because it gives the students the chance to interact with each other and the instructors. The ability to receive a daily digest in their email inboxes about the discussions they are following and participating in, really helps to keep the activity in the topics.

“How to” configure the notifier app

Here we will describe two ways to configure the notifier app, first by going to the configuration and setting everything directly on the server, and second using the Ansible variables for a more automated way.

Notifier configuration on server

The notifier configuration file is located in /edx/app/notifier/notifier_env, so our first step is go and edit this file.

user@host:~$ vi /edx/app/notifier/notifier_env

Now we will walk through var to var with some examples and an explanation about each one. This is the basic configuration for a single server installation.

export FORUM_DIGEST_EMAIL_SENDER="notifications@example.com" export FORUM_DIGEST_EMAIL_SUBJECT="Daily Discussion Digest" export FORUM_DIGEST_EMAIL_TITLE="Discussion Digest" export FORUM_DIGEST_EMAIL_DESCRIPTION="A digest of unread content from course discussions you are following." export LOGO_IMAGE_URL="http://www.mydomain.com/static/images/header-logo.png"

This first set of vars are for branding, the first four are the email string that you can override, and the last one should point to you brand logo.

export EMAIL_BACKEND="smtp" export EMAIL_HOST="smtp.provider.com" export EMAIL_HOST_USER="user@example.com" export EMAIL_HOST_PASSWORD="password" export EMAIL_PORT="25" export EMAIL_USE_TLS="False"

This set of vars are related to the email provider, the tricky one is the first, because in django/edx is usual to specify the full path to the email backend, in this case you need to pick one of the three values: `’smtp’, ‘ses’, ‘console’`. In this example we are using a SMPT email provider like SendGrid or Mandrill.

export NOTIFIER_ENV="Production"

The notifier env is “Development” by default, we need to change it to production.

export LMS_URL_BASE="http://localhost:8000"

export SECRET_KEY="PUT_YOUR_SECRET_KEY_HERE"

It is important to use localhost or 127.0.0.1, because the 8000 port isn’t typically open to the world.

export CS_URL_BASE="http://localhost:18080"

export CS_API_KEY="password"

Here is the same than before, the port 18080 (the cs comments service port) is not open in general.

export US_URL_BASE="http://localhost:8000"

export US_API_KEY="PUT_YOUR_API_KEY_HERE"

export US_HTTP_AUTH_PASS="edx"

export US_HTTP_AUTH_USER="staff"

These last 4 are probably the most important. US_API_KEY is the edxapp API key, you can find the correct value in /edx/app/edxapp/lms.auth.json under the var EDX_API_KEY. The last two values, are the username and password for an edxapp user with staff rights (is_staff=1). This default will work in a new installation, because the Ansible playbook creates this demo user with this credentials, but you should never keeps this user active. The best choice is to create a new user with a secure password, give it staff access and replace those credentials.

Ansible playbook vars

An alternative way to configure the Forums Digest, is to directly include all the vars in your Ansible custom-vars.yml or group-vars. The logic for each var is explained in the previous paragraph and finally should look like this. 

NOTIFIER_DIGEST_EMAIL_SENDER: "notifications@example.com"

NOTIFIER_DIGEST_EMAIL_SUBJECT: "Daily Discussion Digest"

NOTIFIER_DIGEST_EMAIL_TITLE: "Discussion Digest"

NOTIFIER_DIGEST_EMAIL_DESCRIPTION: "A digest of unread content from course discussions you are following."

NOTIFIER_ENV: "Production"

NOTIFIER_EMAIL_BACKEND: "smtp"

NOTIFIER_EMAIL_HOST: "smtp.provider.com"

NOTIFIER_EMAIL_PORT: 25

NOTIFIER_EMAIL_USER: "user@example.com"

NOTIFIER_EMAIL_PASS: "password"

NOTIFIER_EMAIL_USE_TLS: false

NOTIFIER_LMS_URL_BASE: "http://localhost:8000"

NOTIFIER_LMS_SECRET_KEY: "{{ EDXAPP_EDX_API_KEY }}"

NOTIFIER_COMMENT_SERVICE_BASE: "http://localhost:{{ FORUM_NGINX_PORT }}"

NOTIFIER_COMMENT_SERVICE_API_KEY: "{{ FORUM_API_KEY }}"

NOTIFIER_USER_SERVICE_BASE: "http://localhost:8000"

NOTIFIER_USER_SERVICE_API_KEY: "{{ EDXAPP_EDX_API_KEY }}"

NOTIFIER_USER_SERVICE_HTTP_AUTH_USER: "staff"

NOTIFIER_USER_SERVICE_HTTP_AUTH_PASS: "edx"

NOTIFIER_CELERY_BROKER_URL: "django://"

NOTIFIER_LOGO_IMAGE_URL: "{{ NOTIFIER_LMS_URL_BASE }}/static/images/header-logo.png"

NOTIFIER_SUPERVISOR_LOG_DEST: "{{ COMMON_DATA_DIR }}/log/supervisor"

After you set up all the correct values, you can run the provisioning playbook again. In a normal single server install using edx_sandbox.yml playbook.

cd /var/tmp/configuration/playbooks && sudo ansible-playbook -c local ./edx_sandbox.yml -i "localhost," -e custom-vars.yml