Sunbird Lern
AskDot
  • LEARN
    • Overview
    • Functional Capabilities
    • Technical Architecture
      • Technical Architecture Diagram
      • Tech Stack
    • Dependencies
    • Product Roadmap
  • USE
    • Overview
    • Release Notes
      • Release V 8.0.0 (Ongoing)
      • Release V 7.0.0
      • Release V 5.4.0
      • Release V 5.3.0
      • Release V 5.2.0
      • Release V 5.1.0
      • Release V 5.0.1
      • Release V 5.0.0
      • Release V 4.10.0
      • Release V 4.9.0
      • Release V 4.8.0
      • Release V 4.7.0
    • Developer Guide
      • USER & ORG SERVICE
        • Features/Core capabilities
        • Architecture
          • Code Flow
        • Developer Installation
          • System Requirements
          • Tech Stack
          • Installation Guide
          • Keycloak Local setup
          • Additional Installation Dependencies:
          • Source Code
          • Installation Configuration
        • Data Models
          • Cassandra
            • Data Dictionary
              • User
              • Organisation
              • System Settings
              • Role
              • Bulk Upload Process
              • Tenant Preference
              • Cassandra Migration Version
              • User Consent
              • Email Template
              • OTP
              • Page Management (LMS Service)
              • Location
              • User Notes
              • Deprecated
          • Elastic Search
          • Redis
        • APIs
          • User Management
            • User Deletion API
            • Ownership Transfer API
          • Organisation Management
          • Location Management
          • Consent Management
          • OTP Services
          • Tenant Configurations
          • Bulk Upload
          • System Settings
          • API Management Service
          • Data Sync
          • Notification APIs
        • Flink Jobs
          • User Cache Updater
          • User Deletion Cleanup Flink Job
          • Ownership Transfer Flink Job
        • Reports
          • Standard Exhaust
            • State Admin Geo report
            • State Admin Report
          • Other Jobs
            • User Cache Indexer Job
            • Delete Users Assets Report
          • Data Products Developer Installation
            • System Requirements
            • Tech Stack
            • Installation Dependencies
            • Local installation of data-products
            • Server setup Guide
            • Installation Configuration
            • Data-product creation guide
            • Troubleshooting a data-product
        • Logs, Telemetry Events
        • Configuration
          • Functional Configurations
          • System Settings
          • Email Configuration
          • SMS Configuration
          • OTP based SMS Configuration
        • Roles
          • System Roles
          • User Roles
          • RBAC
        • Dependencies
        • Keycloak on Sunbird
        • How to Guide
          • Create Organization
          • Create User
          • Add new user type & location
        • Single Sign-on with Sunbird
        • Caching and Denormalising User Metadata
          • ETLUserCacheUpdaterJob
          • UserCacheUpdaterFlinkJob
        • Unit Tests and Code Coverage
        • FAQs
      • LMS(BATCH) SERVICE
        • Features/Core Capabilities
        • Architecture
          • Code Flow
        • Developer Installation
          • System Requirements
          • Tech Stack
          • Installation Guide
          • Source Code
        • Data Models
          • Cassandra
            • Data Dictionary
          • ElasticSearch
          • Redis
        • APIs
        • Flink Jobs
          • Merge User Courses
          • Relation Cache Updater
          • Activity Aggregate Updater
          • Assessment Aggregator
          • Enrolment Reconciliation
          • Collection Certificate Pre-Processor
          • Collection Certificate Generator
        • Reports
          • On-Demand Exhaust
            • Response Exhaust
            • User Info Exhaust
            • Progress Exhaust
          • Other Jobs
            • Collection Summary Job
            • Course Batch Status Updater Job
            • Cassandra Migrator Job
            • Score Metric Migration Job
            • Assessment Score Correction Job
            • Collection Reconciliation Job
            • Course Enrollment Job
            • Course Consumption Job
        • Logs, Telemetry Events
        • Configuration
          • System Configuration
          • Functional Configuration
        • Dependencies
        • Certificate Registry and Credentialing using Sunbird-RC
          • Configuring PublicKey in Sunbird-RC
          • Server Setup guide for Sunbird-RC
          • API Guide For Sunbird-RC
        • Certificate Flow
          • Certificates Creation and Configuration
        • FAQs
      • GROUPS
        • Features/Core Capabilities
        • Architecture
          • Code Flow
        • Developer Installation
          • System Requirements
          • Tech Stack
          • Installation Guide
          • Source Code
          • Installation Configuration
        • Data Models
          • Cassandra
            • Data Dictionary
          • Redis
        • APIs
          • Create Group
        • Logs, Telemetry Events
          • UI Telemetry Events
          • Service Telemetry Events
        • Configuration
          • Functional Configurations
        • Design References
        • Dependencies
        • Unit Tests and Code Coverage
      • NOTIFICATION SERVICE
        • Features/Core Capabilities
        • Architecture
          • Code Flow
        • Developer Installation
          • System Requirements
          • Tech Stack
          • Installation Guide
          • Source Code
          • Installation Configuration
        • Data Models
          • Data Dictionary
        • APIs
        • Flink Jobs
        • Logs, Telemetry Events
        • Configuration
          • Functional Configurations
        • Dependencies
        • Unit Tests and Code Coverage
      • DISCUSSION FORUM
        • Features/Core capabilities
        • Architecture
          • Code Flow
        • Developer Installation
          • System Requirements
          • Tech Stack
          • Installation Guide
            • Nodebb setup
            • Discussion Middleware Setup
            • Discussion Middleware
            • Discussion forum integration with any application
            • Discussion-UI setup along with demo application.
            • Sunbird-lern portal for DF
          • Source Code
        • APIs
          • Category APIs
          • User APIs
          • Post APIs
          • Topic APIs
          • Forum APIs
        • Context Schema
        • Configurations
          • Nodebb Admin panel settings
          • Discussion MW & Nodebb System Config
        • Telemetry Events
        • Dependencies
      • ML SERVICE
        • DATA PIPELINE (Flink Jobs)
          • Program User Info
            • Component Diagram
            • Data Model
            • Folder Structure
          • Ml User Delete
            • Component Diagram
            • Data Model
            • Folder Structure
        • DATA PRODUCTS
          • Program Exhaust
            • Component Diagram
            • Folder Structure
    • Server Installation
    • Dependency Setup
    • Deprecation
      • Release-5.4.0
    • Jenkins Jobs
    • Release Calendar
    • Learn More
      • Tech References
      • Telemetry Processing
      • Data Dictionary
        • Sample Data
      • Delete User Functionality
      • Asset Ownership Transfer
    • FAQs
  • Engage
    • Discuss
    • Contribute to Sunbird Lern
    • Raise an Issue
    • Contribution Guidelines
Powered by GitBook
On this page

Was this helpful?

Edit on GitHub
  1. USE
  2. Developer Guide
  3. NOTIFICATION SERVICE

APIs

PreviousData DictionaryNextFlink Jobs

Last updated 16 days ago

Was this helpful?

API Documentation:

Detailed API information present in this Reference - API Document

Example:

Group Notification will use the new notification create API to create notifications as defined in the document Notification Design Discussion.



Read User Notification Feed

get

This API is used for getting in-App notification of the user

Path parameters
userIdstringRequired

User ID to fetch notifications for

Header parameters
AuthorizationstringRequired

Bearer token for API authorization

Example: Bearer <your-auth-token>
x-authenticated-user-tokenstringRequired

User authentication token

x-authenticated-forstringOptional

Managed User token for MUA users

tsstringOptional

Request timestamp

X-msgidstringOptional

Unique request identifier

Responses
200
Successfully retrieved user notification feed
application/json
401
Unauthorized access
application/json
500
Internal server error
application/json
get
GET /api/notification/v1/feed/read/{userId} HTTP/1.1
Host: staging.sunbirded.org
Authorization: Bearer <your-auth-token>
x-authenticated-user-token: text
Accept: */*
{
  "id": "v1.notification.feed.read.1234",
  "ver": "v1",
  "ts": "1628697563377",
  "params": {
    "resmsgid": null,
    "msgid": "ed1c0b7c-8f10-4a35-9f42-93966d8d97f6",
    "err": null,
    "status": null,
    "errmsg": null
  },
  "responseCode": "OK",
  "result": {
    "feeds": [
      {
        "id": "64ef2ccd-2ec7-4759-b500-590d4a6eccf3",
        "userId": "1234",
        "category": "notification-feed",
        "priority": 1,
        "status": "read",
        "createdOn": 1628539887611,
        "updatedOn": 1628614252986,
        "createdBy": "f10d5216-6b96-404c-8d1c-cc1f720d910d",
        "updatedBy": "1234",
        "action": {
          "type": "add-member",
          "template": {
            "type": "JSON",
            "ver": "4.2",
            "data": "{\"title\":\"Math's Activity has been added\"}"
          },
          "createdBy": {
            "id": "f10d5216-6b96-404c-8d1c-cc1f720d910d",
            "name": "John",
            "type": "User"
          },
          "additionalInfo": {
            "group": {
              "id": "123434",
              "name": "Test"
            },
            "groupRole": "admin",
            "activity": {
              "id": "do_12443",
              "type": "Course",
              "name": "Math's Activity"
            }
          }
        }
      }
    ]
  }
}

Update Notification Feed Status

patch
Header parameters
Content-Typestring · enumRequiredDefault: application/jsonPossible values:
AuthorizationstringRequired

Bearer token for API authorization

Example: Bearer <your-auth-token>
x-authenticated-user-tokenstringRequired

User authentication token

x-authenticated-forstringOptional

Managed User token for MUA users

tsstringOptional

Request timestamp

X-msgidstringOptional

Unique request identifier

Body
Responses
200
Successfully updated notification status
application/json
400
Bad request - missing or invalid parameters
application/json
401
Unauthorized access
application/json
500
Internal server error
application/json
patch
PATCH /api/notification/v1/feed/update HTTP/1.1
Host: staging.sunbirded.org
Content-Type: application/json
Authorization: Bearer <your-auth-token>
x-authenticated-user-token: text
Accept: */*
Content-Length: 78

{
  "request": [
    {
      "ids": [
        "64ef2ccd-2ec7-4759-b500-590d4a6eccf3"
      ],
      "userId": "1234"
    }
  ]
}
{
  "id": "v1.notification.feed.update",
  "ver": "v1",
  "ts": "1628697773888",
  "params": {
    "resmsgid": null,
    "msgid": "ed1c0b7c-8f10-4a35-9f42-93966d8d97f6",
    "err": null,
    "status": null,
    "errmsg": null
  },
  "responseCode": "OK",
  "result": {
    "response": "SUCCESS"
  }
}

List all available notification templates

get

Retrieve a list of all notification templates available in the system

Header parameters
AuthorizationstringRequired

Bearer token for API authorization

Example: Bearer <your-auth-token>
x-authenticated-user-tokenstringRequired

User authentication token

x-authenticated-forstringOptional

Managed User token for MUA users

tsstringOptional

Request timestamp

X-msgidstringOptional

Unique request identifier

Responses
200
Successfully retrieved templates
application/json
401
Unauthorized access
application/json
500
Internal server error
application/json
get
GET /api/notification/v1/template/list HTTP/1.1
Host: staging.sunbirded.org
Authorization: Bearer <your-auth-token>
x-authenticated-user-token: text
Accept: */*
{
  "id": "v1.notification.template.list",
  "ver": "v1",
  "ts": "1628697563377",
  "params": {
    "resmsgid": null,
    "msgid": "ed1c0b7c-8f10-4a35-9f42-93966d8d97f6",
    "err": null,
    "status": null,
    "errmsg": null
  },
  "responseCode": "OK",
  "result": {
    "templates": [
      {
        "lastUpdatedBy": "1234",
        "createdBy": "f10d5216-6b96-404c-8d1c-cc1f720d910d",
        "ver": "4.4.0",
        "data": "{\"title\": \"${param1} has left the ${param2}\"}",
        "templateId": "user-exit-2-2",
        "type": "JSON",
        "config": {
          "test": "13231231"
        },
        "template_schema": "{\"$schema\":\"#/definition/params\",\"title\":\"params context\",\"description\":\"properties Data\",\"type\":\"object\",\"properties\":{\"param1\":{\"description\":\"property 1 value\",\"type\":\"string\"},\"param2\":{\"description\":\"property 2 value\",\"type\":\"string\"}},\"required\":[\"param1\",\"param2\"]}\n",
        "lastUpdatedOn": null,
        "createdOn": 1628696821794
      }
    ]
  }
}

Get template mapped to an action

get

Retrieve the notification template associated with a specific action

Path parameters
actionstringRequired

The action to get the mapped template for

Example: member-add
Header parameters
AuthorizationstringRequired

Bearer token for API authorization

Example: Bearer <your-auth-token>
x-authenticated-user-tokenstringRequired

User authentication token

x-authenticated-forstringOptional

Managed User token for MUA users

tsstringOptional

Request timestamp

X-msgidstringOptional

Unique request identifier

Responses
200
Successfully retrieved template for action
application/json
400
Action configuration not found
application/json
401
Unauthorized access
application/json
500
Internal server error
application/json
get
GET /api/notification/v1/template/{action} HTTP/1.1
Host: staging.sunbirded.org
Authorization: Bearer <your-auth-token>
x-authenticated-user-token: text
Accept: */*
{
  "id": "v1.notification.template.member-add",
  "ver": "v1",
  "ts": "1628697563377",
  "params": {
    "resmsgid": null,
    "msgid": "ed1c0b7c-8f10-4a35-9f42-93966d8d97f6",
    "err": null,
    "status": null,
    "errmsg": null
  },
  "responseCode": "OK",
  "result": {
    "action": "member-add",
    "type": "Feed",
    "template": {
      "lastUpdatedBy": "1234",
      "createdBy": "f10d5216-6b96-404c-8d1c-cc1f720d910d",
      "ver": "4.4.0",
      "data": "{\"title\": \"${param1} has left the ${param2}\"}",
      "templateId": "user-exit-2-2",
      "type": "JSON",
      "config": {
        "test": "13231231"
      },
      "template_schema": "{\"$schema\":\"#/definition/params\",\"title\":\"params context\",\"description\":\"properties Data\",\"type\":\"object\",\"properties\":{\"param1\":{\"description\":\"property 1 value\",\"type\":\"string\"},\"param2\":{\"description\":\"property 2 value\",\"type\":\"string\"}},\"required\":[\"param1\",\"param2\"]}\n",
      "lastUpdatedOn": null,
      "createdOn": 1628696821794
    }
  }
}

Map action to notification template

patch

Associate a notification template with a specific action

Header parameters
Content-Typestring · enumRequiredDefault: application/jsonPossible values:
AuthorizationstringRequired

Bearer token for API authorization

Example: Bearer <your-auth-token>
x-authenticated-user-tokenstringRequired

User authentication token

x-authenticated-forstringOptional

Managed User token for MUA users

tsstringOptional

Request timestamp

X-msgidstringOptional

Unique request identifier

Body
Responses
200
Successfully mapped action to template
application/json
400
Invalid request
application/json
401
Unauthorized access
application/json
500
Internal server error
application/json
patch
PATCH /api/notification/v1/template/action/update HTTP/1.1
Host: staging.sunbirded.org
Content-Type: application/json
Authorization: Bearer <your-auth-token>
x-authenticated-user-token: text
Accept: */*
Content-Length: 78

{
  "request": {
    "templateId": "user-exit-2-2",
    "action": "member-add",
    "type": "Feed"
  }
}
{
  "id": "v1.notification.template.action.update",
  "ver": "v1",
  "ts": "1628697773888",
  "params": {
    "resmsgid": null,
    "msgid": "ed1c0b7c-8f10-4a35-9f42-93966d8d97f6",
    "err": null,
    "status": null,
    "errmsg": null
  },
  "responseCode": "OK",
  "result": {
    "response": "SUCCESS"
  }
}

Update Notification Template

patch
Header parameters
Content-Typestring · enumRequiredDefault: application/jsonPossible values:
AuthorizationstringRequired

Bearer token for API authorization

Example: Bearer <your-auth-token>
x-authenticated-user-tokenstringRequired

User authentication token

x-authenticated-forstringOptional

Managed User token for MUA users

tsstringOptional

Request timestamp

X-msgidstringOptional

Unique request identifier

Body
Responses
200
Successfully updated notification template
application/json
400
Bad request
application/json
401
Unauthorized access
application/json
500
Internal server error
application/json
patch
PATCH /api/notification/v1/template/update HTTP/1.1
Host: staging.sunbirded.org
Content-Type: application/json
Authorization: Bearer <your-auth-token>
x-authenticated-user-token: text
Accept: */*
Content-Length: 115

{
  "request": {
    "templateId": "user-exit-2-2",
    "ver": "4.4.0",
    "data": "{\"title\": \"${param1} has left the ${param2}\"}"
  }
}
{
  "id": "v1.notification.template.update",
  "ver": "v1",
  "ts": "1628697773888",
  "params": {
    "resmsgid": null,
    "msgid": "ed1c0b7c-8f10-4a35-9f42-93966d8d97f6",
    "err": null,
    "status": null,
    "errmsg": null
  },
  "responseCode": "OK",
  "result": {
    "response": "SUCCESS"
  }
}

Delete Notification Template

patch
Header parameters
Content-Typestring · enumRequiredDefault: application/jsonPossible values:
AuthorizationstringRequired

Bearer token for API authorization

Example: Bearer <your-auth-token>
x-authenticated-user-tokenstringRequired

User authentication token

x-authenticated-forstringOptional

Managed User token for MUA users

tsstringOptional

Request timestamp

X-msgidstringOptional

Unique request identifier

Body
Responses
200
Successfully deleted notification template
application/json
400
Bad request
application/json
401
Unauthorized access
application/json
500
Internal server error
application/json
patch
PATCH /api/notification/v1/template/delete HTTP/1.1
Host: staging.sunbirded.org
Content-Type: application/json
Authorization: Bearer <your-auth-token>
x-authenticated-user-token: text
Accept: */*
Content-Length: 42

{
  "request": {
    "templateId": "user-exit-2-2"
  }
}
{
  "id": "v1.notification.template.delete",
  "ver": "v1",
  "ts": "1628697773888",
  "params": {
    "resmsgid": null,
    "msgid": "ed1c0b7c-8f10-4a35-9f42-93966d8d97f6",
    "err": null,
    "status": null,
    "errmsg": null
  },
  "responseCode": "OK",
  "result": {
    "response": "SUCCESS"
  }
}

Create Notification

post

This API allows to send email, sms, device and feed type notifications. This will only be accessible internally by different service to send notification. Template configuration needs to be configured to use this service.

Header parameters
notification-delivery-modestringRequiredExample: sync
tsstringRequired
X-msgidstringRequired
Content-TypestringRequiredExample: application/json
AuthorizationstringRequiredExample: Bearer <key>
Body
Responses
200
OK ! Successful operation. Send Notification operation was successfully executed.
application/json
400
BAD REQUEST. The Send Notifications operation failed ! The possible reason for failure is that you may have missed providing input for a mandatory parameter.
application/json
401
Unauthorized User
application/json
500
INTERNAL SERVER ERROR
application/json
post
POST /api/notification/v2/send HTTP/1.1
Host: staging.sunbirded.org
notification-delivery-mode: sync
ts: text
X-msgid: text
Content-Type: application/json
Authorization: Bearer <key>
Accept: */*
Content-Length: 454

{
  "request": {
    "notifications": [
      {
        "ids": [
          "12345"
        ],
        "priority": 1,
        "type": "feed",
        "action": {
          "type": "add-member",
          "category": "notification-feed",
          "template": {
            "type": "JSON",
            "params": {
              "param1": "Math's Activity",
              "param2": "Test"
            }
          },
          "createdBy": {
            "id": "f10d5216-6b96-404c-8d1c-cc1f720d910d",
            "name": "John",
            "type": "User"
          },
          "additionalInfo": {
            "group": {
              "id": "1234sa34",
              "name": "Test"
            },
            "groupRole": "admin",
            "activity": {
              "id": "do_12443",
              "type": "Course",
              "name": "Math's Activity"
            }
          }
        }
      }
    ]
  }
}
{
  "id": "v2.notification.send",
  "ver": "v1",
  "ts": "text",
  "params": {
    "resmsgid": "text",
    "msgid": "text",
    "err": "text",
    "status": "text",
    "errmsg": "text"
  },
  "responseCode": "OK",
  "result": {
    "response": "SUCCESS"
  }
}
  • POSTCreate Notification
  • GETRead User Notification Feed
  • PATCHUpdate Notification Feed Status
  • PATCHDelete Notification Feed
  • POSTCreate Notification Template
  • PATCHUpdate Notification Template
  • PATCHDelete Notification Template
  • GETList all available notification templates
  • PATCHMap action to notification template
  • GETGet template mapped to an action

Delete Notification Feed

patch
Header parameters
Content-Typestring · enumRequiredDefault: application/jsonPossible values:
AuthorizationstringRequired

Bearer token for API authorization

Example: Bearer <your-auth-token>
x-authenticated-user-tokenstringRequired

User authentication token

x-authenticated-forstringOptional

Managed User token for MUA users

tsstringOptional

Request timestamp

X-msgidstringOptional

Unique request identifier

Body
Responses
200
Successfully deleted notification feed
application/json
400
Bad request
application/json
401
Unauthorized access
application/json
500
Internal server error
application/json
patch
PATCH /api/notification/v1/feed/delete HTTP/1.1
Host: staging.sunbirded.org
Content-Type: application/json
Authorization: Bearer <your-auth-token>
x-authenticated-user-token: text
Accept: */*
Content-Length: 98

{
  "request": [
    {
      "ids": [
        "64ef2ccd-2ec7-4759-b500-590d4a6eccf3"
      ],
      "userId": "1234",
      "category": "groups"
    }
  ]
}
{
  "id": "v1.notification.feed.delete",
  "ver": "v1",
  "ts": "1628697773888",
  "params": {
    "resmsgid": null,
    "msgid": "ed1c0b7c-8f10-4a35-9f42-93966d8d97f6",
    "err": null,
    "status": null,
    "errmsg": null
  },
  "responseCode": "OK",
  "result": {
    "response": "SUCCESS"
  }
}

Create Notification Template

post
Header parameters
Content-Typestring · enumRequiredDefault: application/jsonPossible values:
AuthorizationstringRequired

Bearer token for API authorization

Example: Bearer <your-auth-token>
x-authenticated-user-tokenstringRequired

User authentication token

x-authenticated-forstringOptional

Managed User token for MUA users

tsstringOptional

Request timestamp

X-msgidstringOptional

Unique request identifier

Body
Responses
200
Successfully created notification template
application/json
400
Bad request
application/json
401
Unauthorized access
application/json
500
Internal server error
application/json
post
POST /api/notification/v1/template/create HTTP/1.1
Host: staging.sunbirded.org
Content-Type: application/json
Authorization: Bearer <your-auth-token>
x-authenticated-user-token: text
Accept: */*
Content-Length: 596

{
  "request": {
    "ver": "4.4.0",
    "data": "{\"title\": \"${param1} has left the ${param2}\"}",
    "templateId": "user-exit-2-2",
    "type": "JSON",
    "config": {
      "test": "13231231"
    },
    "template_schema": "{\n  \"$schema\": \"#/definition/params\",\n  \"title\": \"params context\",\n  \"description\": \"properties Data\",\n  \"type\": \"object\",\n  \"properties\": {\n    \"param1\": {\n      \"description\": \"property 1 value\",\n      \"type\": \"string\"\n    },\n    \"param2\": {\n      \"description\": \"property 2 value\",\n      \"type\": \"string\"\n    }\n  },\n  \"required\": [\"param1\", \"param2\"]\n}\n"
  }
}
{
  "id": "v1.notification.template.create",
  "ver": "v1",
  "ts": "1628697773888",
  "params": {
    "resmsgid": null,
    "msgid": "ed1c0b7c-8f10-4a35-9f42-93966d8d97f6",
    "err": null,
    "status": null,
    "errmsg": null
  },
  "responseCode": "OK",
  "result": {
    "response": "SUCCESS"
  }
}