Skip to content

Send notifications through an external scheduled task

This document explains the steps to configure WSO2 Identity Server to send notifications via an external scheduled task to specific users within your organization.

  1. Password expired users

  2. Idle user accounts

The WSO2 Identity Server 7.0.0 provides API support to fetch the user IDs for individuals falling under these categories. By configuring an external scheduler task, you can retrieve the list of users and send notifications through the preferred channel.

This tutorial illustrates how to send email notifications daily for users whose passwords will expire in 3 days with the Azure Function App.

Configure WSO2 Identity Server

Step 1: Create a user account in WSO2 Identity Server and provide a password at user creation.

Step 2: Activate the Password Expiration checkbox and set the value to 3 days for the purpose of this example.

Step 3: Configure the application in the WSO2 Identity Server to obtain an access token for invoking Password Expiring User Identification API

Setup Azure Function App

Step 4: Sign in to Azure portal with your Azure subscription.

Step 5: Create a function app in Azure as discribed here. Select Python as the Runtime stack and Linux as the Operating System.

Develop Azure Function with Visual Studio Code

Step 6: First Setup the Visual Studio Code and local environment to develop a Azure Function with Visual Studio Code.

Step 7: Click the button below to download the sample Azure Funtion. You can also choose to view the source before doing so.

Step 8: Unzip the downloaded sample. Navigate to the config.json file and provide the corresponding values for the following properties.

WSO2 IS Server property Description
client_id Client ID of the OIDC application creatde in WSO2 IS Server.
client_secret Client secret of the OIDC application creatde in WSO2 IS Server.
oragnization Name of the organization.
hostname The hostname of the WSO2 Identity Server.
alert_before_in_days The number of days before the notification needs to be sent.
Email notification sender property Description
sender_email Provide the username of the SMTP account.
sender_password Provide the password of the SMTP account.
smtp_server The SMTP server to connect to.
smtp_server The SMTP server port to connect.

Step 9: In the VS Code, select the Azure icon, then select the + button in the Workspace tab. Click on Azure Functions icon and select Create Function option. As you progress, provide the values as outlined below.

Property Value
Directory location Preferred empty file directory loaction
Language Python
Python Programming model Model V2
Python interpreter python3
template for the function Skip for now
Project open option Add to workspace

Step 10: Copy and replace the files from the sample Azure Function into the directory created in the previous step.

Step 11: You can test the Funtion App locally as described here befor deploying it to Azure.

Deploy Function App to Azure

Step 12 Deploy the Azure Function App as described here.

The Azure Function is now configured to send daily email notifications for users whose passwords will expire in 3 days.