📙
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
  • Add discussion for a context
  • Prerequisite
  • How to create Parent category (pid)
  • CURL for attaching discussion forum

Was this helpful?

Edit on GitHub
  1. USE
  2. Developer Guide
  3. DISCUSSION FORUM
  4. Developer Installation
  5. Installation Guide

Discussion forum integration with any application

PreviousDiscussion MiddlewareNextDiscussion-UI setup along with demo application.

Last updated 2 years ago

Was this helpful?

Discussion forum is library and can be attached to any application. Before integrating we have to verify following things

  • Application should maintain cache.

  • Discussion forum uid have to be stored in cache.

  • Uid need to attach for all discussion forum apis as a query param link ?_uid=${discussionForum_uid}.

Add discussion for a context

We can attach discussion forum for any context like Groups/Courses/Batchs/Textbooks…etc.

Before attaching discussion forum we have to create one parent category and for context have one parent category. So that we can have all group context under one parent similarly for course, textbook.

You can see below image. Discussion forum for Groups is a parent category and all group related discussion forums are under that category.

Prerequisite

  1. Redis should be up and running.

  2. Local nodebb should be up and running.

How to create Parent category (pid)

Step:1

Login to nodebb as a admin. And go to admin panel .

Step:2

We need to create a categories in Nodebb.

  1. click on “Manage“ tab and select “Categories“

  2. You can see “+“ icon at right side bottom, click on that, It will open a popup. Enter Category name and click on Save. It will create a category “Covid 19 Guidelines”

Step:3

Click on Discussion forum for groups, You will category ID in url bar. Use that category id as a PID.

And update the form api by replacing the PID in payload.

POST: /data/v1/form/create 
{
  "request": {
    "type": "forum",
    "subType": "group",
    "action": "create",
    "data": {
      "templateName": "defaultTemplate",
      "action": "create",
      "fields": [
        {
          "category": {
            "name": "General Discussion",
            "pid": "30",
            "uid": "4",
            "description": "",
            "context": [
              {
                "type": "group",
                "identifier": "_groupId"
              }
            ]
          }
        }
      ]
    }
  }
}

Step: 4

Verify if the form api is updated or not by calling the below api.

POST: /data/v1/form/read 

Payload

{
    "request": {
        "type": "forum",
        "subType": "group",
        "action": "create"
    }
}

Response

{
    "id": "api.form.read",
    "params": {
        "resmsgid": "f18a1975-8d64-4590-b419-be495cd9d6c4",
        "msgid": "255e08db-2464-4edd-aab6-cbde4308f53e",
        "status": "successful"
    },
    "responseCode": "OK",
    "result": {
        "form": {
            "type": "forum",
            "subtype": "group",
            "action": "create",
            "component": "*",
            "framework": "*",
            "data": {
                "templateName": "defaultTemplate",
                "action": "create",
                "fields": [
                    {
                        "category": {
                            "name": "General Discussion",
                            "pid": "30",
                            "uid": "4",
                            "description": "",
                            "context": [
                                {
                                    "type": "group",
                                    "identifier": "_groupId"
                                }
                            ]
                        }
                    }
                ]
            },
            "created_on": "2021-02-15T05:33:03.734Z",
            "last_modified_on": "2021-02-15T09:52:41.820Z",
            "rootOrgId": "*"
        }
    },
    "ts": "2021-02-15T10:14:08.707Z",
    "ver": "1.0"
}

CURL for attaching discussion forum

For example, We are adding discussion forum for group, For that we have to use below api.

Request

URL: https://staging.sunbirded.org/discussion/forum/v3/create

Payload:

{
  "category": {
    "name": "General Discussion", // Name of the category 
    "pid": "30", // parent category id, under this category we are creating new categories
    "description": "", // category description: Optional
    "context": [
      {
        "type": "group", // type as a group
        "identifier": "bc190919-f9a4-4e8a-a48b-2bba9c0b827f" // group Id
      }
    ]
  }
}

CURL

curl 'https://staging.sunbirded.org/discussion/forum/v3/create' \
  -H 'Connection: keep-alive' \
  -H 'sec-ch-ua: " Not;A Brand";v="99", "Google Chrome";v="97", "Chromium";v="97"' \
  -H 'X-App-Id: staging.sunbird.portal' \
  -H 'sec-ch-ua-mobile: ?0' \
  -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36' \
  -H 'Content-Type: application/json' \
  -H 'Access-Control-Allow-Origin: *' \
  -H 'Accept: application/json' \
  -H 'X-Device-Id: 23b82f7e68c9974eb17af148415a6067' \
  -H 'X-Channel-Id: 0126796199493140480' \
  -H 'sec-ch-ua-platform: "macOS"' \
  -H 'Origin: https://staging.sunbirded.org' \
  -H 'Sec-Fetch-Site: same-origin' \
  -H 'Sec-Fetch-Mode: cors' \
  -H 'Sec-Fetch-Dest: empty' \
  -H 'Referer: https://staging.sunbirded.org/my-groups/group-details/bc190919-f9a4-4e8a-a48b-2bba9c0b827f' \
  -H 'Accept-Language: en-GB,en;q=0.9' \
  -H 'Cookie: connect.sid=s%3AS3j18UnlsjcbY4_kbWjfCdO7iBvR0h_G.1dWXH%2Ba%2BUZ3zyFN4JnK2ucdU9mFqkRfmiPJrTgxulPU' \
  --data-raw '{"category":{"name":"General Discussion","pid":"30","uid":"4","description":"","context":[{"type":"group","identifier":"bc190919-f9a4-4e8a-a48b-2bba9c0b827f"}]}}' \
  --compressed

Response

{
  "id": ".discussions.api.forum.v3.create",
  "ver": "1.0",
  "ets": 1642673148032,
  "params": {
    "resmsgid": "16ea8c5b-682c-4ac2-889e-d5896fc057fd",
    "msgid": "",
    "status": "Success"
  },
  "responseCode": "OK",
  "result": {
    "forums": [
      {
        "sbType": "group",
        "sbIdentifier": "bc190919-f9a4-4e8a-a48b-2bba9c0b827f",
        "newCid": 801, // New category created for group context 
        "cids": [801]
      }
    ]
  }
}

n the above response we have newCid that is the category id which is created for the group context that we pass in the request. So whet ever the discussions happened in the group are present in the discussion forum category.

http://localhost:4567/admin