APIs

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.

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
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"
  }
}

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
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
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"
  }
}

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
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
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"
  }
}

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
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
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"
  }
}

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
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
      }
    ]
  }
}

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
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"
  }
}

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
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
    }
  }
}

Last updated

Was this helpful?