Skip to main 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 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 described 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 an Azure Function with Visual Studio Code.

Step 7: Click the button below to download the sample Azure Function. 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 propertyDescription
client_idClient ID of the OIDC application created in WSO2 IS Server.
client_secretClient secret of the OIDC application created in WSO2 IS Server.
organizationName of the organization.
hostnameThe hostname of the WSO2 Identity Server.
alert_before_in_daysThe number of days before the notification needs to be sent.
Email notification sender propertyDescription
sender_emailProvide the username of the SMTP account.
sender_passwordProvide the password of the SMTP account.
smtp_serverThe SMTP server to connect to.
smtp_portThe 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.

PropertyValue
Directory locationPreferred empty file directory location
LanguagePython
Python Programming modelModel V2
Python interpreterpython3
template for the functionSkip for now
Project open optionAdd 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 Function App locally as described here before 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.

Was this page helpful?