Skip to main content

Tài liệu tích hợp CRM_IOT


sort: 9

Tài liệu tích hợp RalliSmart CRM V2

A. Phần dành cho Back_end

Trong quá trình sử dụng ứng dụng RalliSmart, người dùng có thể có các khiếu nại hoặc yêu cầu về hệ thống, do đó họ muốn có một chức năng phù hợp với việc gửi các khiếu nại này.

CRM là phần mềm quản lý và chăm sóc khách hàng, đây sẽ là nơi tiếp nhận các yêu cầu của RalliSmart.

Việc tích hợp tài khoản/ người dùng của RalliSmart và CRM từ đó trở nên cần thiết, phục vụ cho việc gửi, xử lý các yêu cầu cũng như gửi các thông báo cho người dùng.

Với mỗi người dùng/ tài khoản đăng nhập trên RalliSmart, CRM sẽ có một khách hàng lẻ tương ứng, đây sẽ là đối tượng tham gia vào các vấn đề phát sinh.

Lưu ý: Với hiện thống hiện tại của CRM, chỉ cho phép tạo khách hàng lẻ khi cung cấp sdt, do đó chỉ những tài khoản chứa thông tin sdt trên RalliSmart mới có thể sử dụng tính năng này

Kiến trúc hệ thống

graph TD
    A[IOT_EBE]
    B[CRM_IOT]
    B --> C[CRM_IOT DB]
    D[CRM]
    D --> E[CRM DB]

1. Lấy token để call API tới CRM-IOT

STT Trường dữ liệu Dạng Ghi chú
rpc/portal/service-profile/login POST
1 Code String Tên tài khoản: PORTAL_CODE
2 Password String Mật khẩu: PORTAL_PASSWORD
3 AliasUserId Long UserId: 1 ( sẽ cập nhật lại khi BA tạo tài khoản dùng để tích hợp)
4 AliasTypeId Long TypeId: 1
5 Token String Response trả về Token để call API
  • Thông tin tài khoản ServiceUser được cung cấp bởi đội phát triển Portal và được lưu trong appsettings
  "ExternalServices": {
    "CRMAccount": {
      "Code" : "{PORTAL_CODE}",
      "Password" : "{PORTAL_PASSWORD}",
      "AliasUserId": "{ALIAS_USER_ID}",
      "AliasUserType": "{ALIAS_USER_TYPE_ID}"
    },
    "CRMSecret" : "{CRM_SECRET}"
  }
Tài khoản Mật khẩu
PORTAL_CODE PORTAL_PASSWORD

Sample Request

{
  "code": "{PORTAL_CODE}",
  "aliasTypeId": {ALIAS_USER_ID},
  "aliasUserId": {ALIAS_USER_TYPE_ID},
  "password": "{PORTAL_PASSWORD}"
}

Sample Response

{
  "code": "{PORTAL_CODE}",
  "aliasTypeId": {ALIAS_USER_ID},
  "aliasUserId": {ALIAS_USER_TYPE_ID},
  "password": null,
  "token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1laWRlbnRpZmllciI6IjQzMTkwIiwiaHR0cDovL3NjaGVtYXMueG1sc29hcC5vcmcvd3MvMjAwNS8wNS9pZGVudGl0eS9jbGFpbXMvbmFtZSI6IlJhbGxpU21hcnQiLCJodHRwOi8vc2NoZW1hcy5taWNyb3NvZnQuY29tL3dzLzIwMDgvMDYvaWRlbnRpdHkvY2xhaW1zL3ByaW1hcnlzaWQiOiI5OTE2ZGMzMi01YmM0LTQ4NzAtYjU1MS04YjQyZGNiNDM3ZWYiLCJVc2VyVHlwZSI6IjEiLCJuYmYiOjE2ODcyNDU2ODgsImV4cCI6MTY4NzI4ODg4OH0.odIXaIu5pdkseBQgt7oKK5_6lL_9F2_J1LNV2pt6im7OHJ_gahSRhv45ZoLb6iwLZa7R6snkKnPgu_4Z_NAjLT0cghTFW2eu41fp3q-YbL72-8y5wmMzD2vYzQAVG1cNR3YNoqjCoItT9V3FxLK6jh7xoM77mrBTeWS4LeYd31oyUNEmMe_0B_43OKbflcJRc2r0TYTyJmUzrTiAdKiJm0lD-8jYrY3U_n_57ECZWsamLJh4qNxkIWGLfUM-Uzwc_1Oo9UUAFjS1jfM_wp4eD3hHIc11Qpd2Psd0stm_GUW9NhaJg-5bbMcPD2mJDZAbr3T8VRFN-oL2jSoJBki0Dw",
  "expiredTime": "2023-06-20T19:21:28.789Z",
  "informations": null,
  "warnings": null,
  "errors": null,
  "disabled": null,
  "generalInformations": [],
  "generalWarnings": [],
  "generalErrors": []
}

2. Đồng bộ khách hàng:

  • Mỗi tài khoản sử dụng RalliSmart được xem là một Khách hàng lẻ của hệ thống CRM. Một hoặc nhiều tài khoản RalliSmart sẽ được gán với 1 Khách hàng lẻ trên CRM, phục vụ việc chăm sóc khách hàng.
sequenceDiagram
autonumber
    participant A as RalliSmart
    participant B as IOT.EBE
    participant C as CRM-IOT
    participant D as CRM

    A ->> B: Tạo mới/ cập nhật tài khoản
    B ->> C: Lấy Token
    C -->> B: Token
    B ->> C: Tích hợp tài khoản
    note over C, B: Thông tin tài khoản Ralli
    C ->> C: Kiểm tra RS_Id
    alt RS_Id đã map với KH
        C ->> C: Thêm sdt,email vào KH nếu thiếu
        C ->> D: Sync KH
        C ->> A: Tạo mới/ cập nhật thành công
    else RS_ID chưa map với KH
        C ->> C: Account RS có Sdt
        alt Có
            C ->> C: So sách Sdt với KH lẻ đã có
            alt Trùng Sdt
                C ->> C: Map RS với KH
                C ->> A: Tạo mới/ cập nhật thành công
            else Không
                C ->> D: Tạo KH mới với thông tin sdt,email của RS
                C ->> C: Map RS_ID với KH mới
                C ->> A: Tạo mới/ cập nhật thành công
        else Không
            C ->> A: Thông báo tài khoản RS chưa có sdt
        end
    end
  end

API :

rpc/crm-iot/customer/sync

Phương thức : POST

Header :

Content-Type: application/json

Cookie: Token = {token} (token lấy được từ bước 1)

Request

STT Trường dữ liệu Dạng Ghi chú
1 Id long Id của Khách hàng Ralli
2 Name String Tên khách hàng
3 Phone String Số điện thoại
4 Email string Email khách hàng
5 StatusId Int 1: Hoạt động, 0: Không hoạt động

Response

3. Gửi yêu cầu, khiếu nại

3.1. Lấy thông tin loại vấn đề

RalliSmart gọi api của crm-iot để lấy thông tin các loại vấn đề đang có, khi đó ralliSmart có thể tùy chọn hoặc lưu lại trên db hoặc không ( việc update các loại vấn đề trên crm chưa có luồng cập nhật sang ralliSmart)

API :

rpc/crm-iot/issue-type/count
rpc/crm-iot/issue-type/list

Phương thức : POST

Header :

Content-Type: application/json

Cookie: Token = {token} (token lấy được từ bước 1)

3.2. Tạo vấn đề

Chỉ áp dụng với các tài khoản có sdt

Khi người dùng tạo mới một vấn đề, IOT.EBE sẽ bắn sang CRM_IOT để tạo một vấn đề mới, sau đó đồng bộ vấn đề mới này về CRM.

sequenceDiagram
autonumber
    participant A as RalliSmart
    participant B as IOT.EBE
    participant C as CRM-IOT
    participant D as CRM

    A ->>+ B: Tạo/ cập nhật vấn đề
    B ->> C: Lấy token
    C -->> B: Token
    B ->>+ C: Tạo/cập nhật vấn đề
    note over C, B: Vấn đề
    C ->> C: Tạo/cập nhật vấn đề
    C ->> D: Tạo/cập nhật vấn đề
    note over D, C: Vấn đề
    C -->>- B: Thông tin vấn đề
    B -->>- A: Thông tin vấn đề

API :

rpc/crm-iot/issue/create

Phương thức : POST

Header :

Content-Type: application/json

Cookie: Token = {token} (token lấy được từ bước 1)
STT Trường dữ liệu Dạng Ghi chú
1 Id Int Id của vấn đề
2 Description String Nội dung vấn đề
3 Title String Tiêu đề vấn đề
4 IssueStatusId int Trạng thái của vấn đề
5 RalliId Int Id của tài khoản Ralli tạo vấn đề
6 CreatedAt Date Ngày tạo vấn đề
7 UpdatedAt Date Ngày cập nhật lần cuối
8 DeletedAt Date Ngày xóa vấn đề
9 IssueFileMappings List<IssueFileMapping> Danh sách tệp đính kèm
10 ResolveContent string Nội dung giải quyết vấn đề
11IssueTypeIdint (nullable)Id loại vấn đề

IssueStatus

STT Trường dữ liệu Dạng Ghi chú
1 Id Int Id của trạng thái
2 Code String Mã trạng thái
3 Name String Tên trạng thái
ID Code Name
1 WAITING Chờ xử lý
2 PROCESSING Đang xử lý
3 DONE Hoàn thành

IssueType

STTTrường dữ liệuDạngGhi chú
1IdIntId của loại vấn đề
2CodeStringMã loại vấn đề
3NameStringTên loại vấn đề

IssueFileMapping

STT Trường dữ liệu Dạng Ghi chú
1 Id Int Id của mapping
2 IssueId Int Id vấn đề
3 FileId Int Id file
4 File File entity file

File

STT Trường dữ liệu Dạng Ghi chú
1 Id Int Id của mapping
2 IssueId Int Id vấn đề
3 FileId Int Id file
4 File File entity file

File

STT Trường dữ liệu Dạng Ghi chú
1 Id Int Id ảnh
2 Name string Tên file
3 Path string url download của ảnh

Các mẫu thông báo Thông báo thay đổi trạng thái đang xử lý

Vấn đề {Issue.Title} đã được chuyển sang trạng thái đang xử lý

Thông báo thay đổi trạng thái hoàn thành

Vấn đề {Issue.Title} đã được chuyển sang trạng thái hoàn thành

4. Chăm sóc khách hàng của CRM chuyển trạng thái đang xử lý vấn đề

Sau khi vấn đề được tạo mới sẽ được hiển thị trên CRM, khi đó người quản lý chăm sóc khách hàng sẽ có thể chuyển vấn đề này sang trạng thái Đang xử lý.

Trạng thái đang xử lý sẽ được đồng bộ trên CRM-IOT, sau đó CRM-IOT sẽ bắn một thông báo thay đổi trạng thái cho người tạo vấn đề.

sequenceDiagram
autonumber
    participant A as RalliSmart
    participant B as IOT.EBE
    participant C as CRM-IOT
    participant D as CRM

    D ->>+ C: Chuyển trạng thái đang xử lý
    note over C, D: Vấn đề
    C ->> C: Cập nhật vấn đề
    C ->>- B: Webhook thông báo
    note over B, C: Message
    B ->> A: Gửi thông báo

5. Chăm sóc khách hàng phản hồi trên CRM

Sau khi một vấn đề được tạo ra trên CRM từ vấn đề Ralli, đội ngũ chăm sóc khách hàng của CRM sẽ có thể vào phản hồi để giải quyết vấn đề. Khi đó phản hồi sẽ được lưu tại CRM, sau đó đồng bộ về CRM-IOT và từ đó gửi thông báo chăm sóc khách hàng phàn hồi cho người dùng.

sequenceDiagram
autonumber
    participant A as RalliSmart
    participant B as IOT.EBE
    participant C as CRM-IOT
    participant D as CRM

    D ->> D: phản hồi
    D ->>+ C: Gửi phản hồi
    C ->> C: Lưu phản hồi
    C ->>- B: Webhook thông báo phản hồi
    note over B,C: Message
    B ->> A: Gửi thông báo

Thông báo phản hồi ở mục 8

6. Người tạo vấn đề phản hồi trên app RalliSmart

Tương tự, người tạo vấn đề có thể phản hồi vào vấn đề mình đã tạo để trao đổi với phía Quản trị viên. phản hồi sẽ được lưu về CRM-IOT. Tiếp theo, CRM-IOT sẽ gửi phản hồi để lưu về CRM.

API :

rpc/crm-iot/discussion/create

Phương thức : POST

Header :

Content-Type: application/json

Cookie: Token = {token} (token lấy được từ ServiceUser)

Comment

STT Trường dữ liệu Dạng Ghi chú
1 Id Int Id của phản hồi
2 DiscussionId Guid = RowId của vấn đề
3 IsOwner bool = true nếu người dùng hiện tại tạo phản hồi
4 Content string Nội dung phản hồi
5 EndUserId Int Id của tài khoản Ralli tạo phản hồi
6 Url string
7 CreatorId long Id người phản hồi
8 CreatedAt Date Ngày tạo phản hồi
9 UpdatedAt Date Ngày cập nhật lần cuối
10 DeletedAt Date Ngày xóa phản hồi
11 CommentAttachments List<CommentAttachment> Danh sách đính kèm

CommentAttachment

STT Trường dữ liệu Dạng Ghi chú
1 Id Int Id của phản hồi
2 CommentId int Id của bình luận
3 AttachmentTypeId int Id của loại đính kèm
4 Url string Url ảnh
5 BaseUrl string BaseUrl của folder ảnh
6 Size string ?
7 Name string Tên đính kèm
8 Checksum string
9 Type string
10 Thumbnail string

AttachmentType

ID Code Name
1 Image Image
2 Sticker Sticker
3 File File
4 Url Url
sequenceDiagram
autonumber
    participant A as RalliSmart
    participant B as IOT.EBE
    participant C as CRM-IOT
    participant D as CRM

    A ->>+ B: Phản hồi
    B ->>+ C: Lấy token
    C -->> B: Token
    B ->>- C: Gửi phản hồi
    C ->>+ D: Gửi phản hồi
    D ->> D: Tạo phản hồi
    D ->>-C: Gửi lại phản hồi
    C ->> C: Lưu phản hồi
    C -->> B: Thông báo phản hồi thành công
    B -->> A: Thông báo phản hồi thành công

7.CRM_IOT bắn thông báo cho app RalliSmart khi có thay đổi trạng thái vấn đề

Sử dụng Webhook, Base URL và Secret sẽ được lưu trong appsettings,:

  "ExternalServices": {
    "IOT_EBE": "{IOT_EBE_URL}",
    "IOT_EBE_SECRET": "{IOT_EBE_SECRET}"
  }

IOT_EBE nhận thông báo và check secret trước khi thông báo cho người dùng

  "ExternalServices": {
    "CRMSecret" : "{CRM_SECRET}"
  }

Cấu trúc JSON thông báo:

{
  "Id": "int",
  "Title": "string",
  "Content": "string",
  "DeviceId": "Guid?",
  "DeviceAttributeId": "long?",
  "DormitoryId": "long?",
  "HomeControllerId": "long?",
  "Unread": "bool",
  "SenderId": "int",
  "RecipientId": "long?",
  "Link": "string",
  "Time": "datetime"
}

Thông báo mẫu:

{
  "Id": "1",
  "Title": "Thay đổi trạng thái vấn đề",
  "Content": "Vấn đề 'App lỗi đăng xuất' đã được chuyển sang trạng thái đang xử lý",
  "DeviceId": null,
  "DeviceAttributeId": null,
  "DormitoryId": null,
  "HomeControllerId": null,
  "Unread": true,
  "SenderId": null,
  "RecipientId": 193209747938213888,
  "Link": "rpc/iot-ebe/issue/get/12",
  "Time": "2023-02-07T02:18:13.483Z"
}

B. Phần dành cho Mobile

1. Màn hình Danh sách vấn đề

Khi vào chức năng vấn đề, call 2 api count/list để lấy ra danh sách vấn đề người dùng đã tạo

API Count :

rpc/iot-ebe/issue/count

Cấu trúc body:

{}

Response Mẫu:

2

API List :

rpc/iot-ebe/issue/list

Cấu trúc body:

{
  "skip": "int",
  "take": "int"
}

Response mẫu

[
  {
    "id": 72,
    "title": "Chim gap bac chao mao chao bac",
    "issueStatusId": 2,
    "description": "Chim gap co son ca chao co",
    "endUserId": 249442343927676928,
    "customerId": 622797,
    "rowId": "e08347c4-42f3-4199-973f-4f401b1fdcec",
    "createdAt": "2023-06-22T08:08:34.203Z",
    "updatedAt": "2023-06-22T08:26:23.330Z",
    "completedAt": null,
    "issueStatus": {
      "id": 2,
      "code": "PROCESSING",
      "name": "Đang xử lý",
      "informations": null,
      "warnings": null,
      "errors": null,
      "disabled": null,
      "generalInformations": [],
      "generalWarnings": [],
      "generalErrors": []
    },
    "endUser": null,
    "issueFileMappings": [
      {
        "id": 0,
        "issueId": 72,
        "fileId": 861401,
        "issue": null,
        "file": null,
        "informations": null,
        "warnings": null,
        "errors": null,
        "disabled": null,
        "generalInformations": [],
        "generalWarnings": [],
        "generalErrors": []
      }
    ],
    "informations": null,
    "warnings": null,
    "errors": null,
    "disabled": null,
    "generalInformations": [],
    "generalWarnings": [],
    "generalErrors": []
  },
  {
    "id": 64,
    "title": "Anh khong di len tu duoi day",
    "issueStatusId": 1,
    "description": "5y34sge",
    "endUserId": 249442343927676928,
    "customerId": 227542,
    "rowId": "00000000-0000-0000-0000-000000000000",
    "createdAt": "2023-06-22T07:49:56.000Z",
    "updatedAt": "2023-06-22T07:50:05.577Z",
    "completedAt": null,
    "issueStatus": {
      "id": 1,
      "code": "WAITING",
      "name": "Chờ xử lý",
      "informations": null,
      "warnings": null,
      "errors": null,
      "disabled": null,
      "generalInformations": [],
      "generalWarnings": [],
      "generalErrors": []
    },
    "endUser": null,
    "issueFileMappings": [
      {
        "id": 0,
        "issueId": 64,
        "fileId": 861401,
        "issue": null,
        "file": null,
        "informations": null,
        "warnings": null,
        "errors": null,
        "disabled": null,
        "generalInformations": [],
        "generalWarnings": [],
        "generalErrors": []
      }
    ],
    "informations": null,
    "warnings": null,
    "errors": null,
    "disabled": null,
    "generalInformations": [],
    "generalWarnings": [],
    "generalErrors": []
  }
]

2. Màn hình chi tiết vấn đề

Khi bấm vào 1 vấn đề trong danh sách, gọi api get để lấy dữ liệu vấn đề

API :

rpc/iot-ebe/issue/get

Cấu trúc body:

{
  "id": "int"
}

Response Mẫu:

{
  "id": 72,
  "title": "Loi chao cao hon mam co",
  "issueStatusId": 1,
  "description": "Em di thua ve trinh",
  "resolveContent": null,
  "endUserId": 0,
  "customerId": 622797,
  "rowId": "e08347c4-42f3-4199-973f-4f401b1fdcec",
  "createdAt": "2023-06-22T08:08:34.203Z",
  "updatedAt": "2023-06-22T08:08:34.203Z",
  "completedAt": null,
  "issueStatus": {
    "id": 1,
    "code": "WAITING",
    "name": "Chờ xử lý",
    "informations": null,
    "warnings": null,
    "errors": null,
    "disabled": null,
    "generalInformations": [],
    "generalWarnings": [],
    "generalErrors": []
  },
  "endUser": null,
  "issueFileMappings": [
    {
      "id": 0,
      "issueId": 72,
      "fileId": 861401,
      "issue": null,
      "file": {
        "id": 861401,
        "name": "9a680e45-6dc4-46e0-91a3-e4a5cdc05285.jpg",
        "mimeType": "image/jpeg",
        "isFile": false,
        "path": "http://localhost:5031/rpc/utils/file/download/issue/20230622/9a680e45-6dc4-46e0-91a3-e4a5cdc05285.jpg",
        "level": 0,
        "content": null,
        "endUser": null,
        "informations": null,
        "warnings": null,
        "errors": null,
        "disabled": null,
        "generalInformations": [],
        "generalWarnings": [],
        "generalErrors": []
      },
      "informations": null,
      "warnings": null,
      "errors": null,
      "disabled": null,
      "generalInformations": [],
      "generalWarnings": [],
      "generalErrors": []
    }
  ],
  "informations": null,
  "warnings": null,
  "errors": null,
  "disabled": null,
  "generalInformations": [],
  "generalWarnings": [],
  "generalErrors": []
}

API Upload các ảnh lên hệ thống

  Method: POST
  Header: files

  URL: {BASE_URL}/rpc/iot-ebe/issue/multi-upload

Response mẫu

[
  {
    "id": 861415,
    "name": "fe408661-82f8-4fdc-be3c-945d016a1a55.png",
    "mimeType": "image/png",
    "isFile": false,
    "path": "http://localhost:5031/rpc/utils/file/download/issue/20230622/fe408661-82f8-4fdc-be3c-945d016a1a55.png",
    "level": 0,
    "content": null,
    "endUser": null,
    "informations": null,
    "warnings": null,
    "errors": null,
    "disabled": null,
    "generalInformations": [],
    "generalWarnings": [],
    "generalErrors": []
  },
  {
    "id": 861416,
    "name": "2a885dd7-c035-4055-9b86-fe33d39bfb7f.jpg",
    "mimeType": "image/jpeg",
    "isFile": false,
    "path": "http://localhost:5031/rpc/utils/file/download/issue/20230622/2a885dd7-c035-4055-9b86-fe33d39bfb7f.jpg",
    "level": 0,
    "content": null,
    "endUser": null,
    "informations": null,
    "warnings": null,
    "errors": null,
    "disabled": null,
    "generalInformations": [],
    "generalWarnings": [],
    "generalErrors": []
  }
]

API tạo vấn đề:

  Method : POST

  URL : {BASE_URL}/rpc/iot-ebe/issue/create

Payload mẫu

{
  "Title": "Loi chao cao hon mam co",
  "Description": "Em di thua ve trinh",
  "IssueFileMappings": [
    {
      "FileId": 861401
    }
  ]
}

Response mẫu:

{
  "id": 72,
  "title": "Loi chao cao hon mam co",
  "issueStatusId": 1,
  "description": "Em di thua ve trinh",
  "resolveContent": null,
  "endUserId": 0,
  "customerId": 622797,
  "rowId": "e08347c4-42f3-4199-973f-4f401b1fdcec",
  "createdAt": "2023-06-22T08:08:34.203Z",
  "updatedAt": "2023-06-22T08:08:34.203Z",
  "completedAt": null,
  "issueStatus": {
    "id": 1,
    "code": "WAITING",
    "name": "Chờ xử lý",
    "informations": null,
    "warnings": null,
    "errors": null,
    "disabled": null,
    "generalInformations": [],
    "generalWarnings": [],
    "generalErrors": []
  },
  "endUser": null,
  "issueFileMappings": [
    {
      "id": 0,
      "issueId": 72,
      "fileId": 861401,
      "issue": null,
      "file": {
        "id": 861401,
        "name": "9a680e45-6dc4-46e0-91a3-e4a5cdc05285.jpg",
        "mimeType": "image/jpeg",
        "isFile": false,
        "path": "http://localhost:5031/rpc/utils/file/download/issue/20230622/9a680e45-6dc4-46e0-91a3-e4a5cdc05285.jpg",
        "level": 0,
        "content": null,
        "endUser": null,
        "informations": null,
        "warnings": null,
        "errors": null,
        "disabled": null,
        "generalInformations": [],
        "generalWarnings": [],
        "generalErrors": []
      },
      "informations": null,
      "warnings": null,
      "errors": null,
      "disabled": null,
      "generalInformations": [],
      "generalWarnings": [],
      "generalErrors": []
    }
  ],
  "informations": null,
  "warnings": null,
  "errors": null,
  "disabled": null,
  "generalInformations": [],
  "generalWarnings": [],
  "generalErrors": []
}

API đóng vấn đề :

Trong màn hình chi tiết vấn đề, có nút Đóng vấn đề khi người dùng thấy vấn đề đã được giải quyết

rpc/iot-ebe/issue/close

Cấu trúc body:

{
  "id": "int"
}

Response Mẫu:

2

Hoặc nút Cập nhật khi người dùng muốn sửa chi tiết vấn đề

API :

rpc/iot-ebe/issue/update

Cấu trúc body:

{
  "id": "long",
  "title": "string",
  "issueStatusId": "long",
  "description": "string"
}

Request mẫu:

{
  "id": 72,
  "code": 72,
  "title": "Chim gap bac chao mao chao bac",
  "issueStatusId": 1,
  "description": "Chim gap co son ca chao co",
  "resolveContent": null,
  "customerId": 622797,
  "rowId": "e08347c4-42f3-4199-973f-4f401b1fdcec",
  "createdAt": "2023-06-22T08:08:34.203Z",
  "updatedAt": "2023-06-22T08:08:34.203Z",
  "completedAt": null,
  "issueStatus": {
    "id": 1,
    "code": "WAITING",
    "name": "Chờ xử lý"
  },
  "endUser": null,
  "issueFileMappings": [
    {
      "id": 0,
      "issueId": 72,
      "fileId": 861401,
      "issue": null,
      "file": {
        "id": 861401,
        "name": "9a680e45-6dc4-46e0-91a3-e4a5cdc05285.jpg",
        "mimeType": "image/jpeg",
        "isFile": false,
        "path": "http://localhost:5031/rpc/utils/file/download/issue/20230622/9a680e45-6dc4-46e0-91a3-e4a5cdc05285.jpg",
        "level": 0,
        "content": null,
        "endUser": null
      }
    }
  ]
}

Response Mẫu:

{
  "id": 72,
  "title": "Chim gap bac chao mao chao bac",
  "issueStatusId": 1,
  "description": "Chim gap co son ca chao co",
  "resolveContent": null,
  "endUserId": 0,
  "customerId": 622797,
  "rowId": "e08347c4-42f3-4199-973f-4f401b1fdcec",
  "createdAt": "2023-06-22T08:08:34.203Z",
  "updatedAt": "2023-06-22T08:17:17.190Z",
  "completedAt": null,
  "issueStatus": {
    "id": 1,
    "code": "WAITING",
    "name": "Chờ xử lý",
    "informations": null,
    "warnings": null,
    "errors": null,
    "disabled": null,
    "generalInformations": [],
    "generalWarnings": [],
    "generalErrors": []
  },
  "endUser": null,
  "issueFileMappings": [
    {
      "id": 0,
      "issueId": 72,
      "fileId": 861401,
      "issue": null,
      "file": {
        "id": 861401,
        "name": "9a680e45-6dc4-46e0-91a3-e4a5cdc05285.jpg",
        "mimeType": "image/jpeg",
        "isFile": false,
        "path": "http://localhost:5031/rpc/utils/file/download/issue/20230622/9a680e45-6dc4-46e0-91a3-e4a5cdc05285.jpg",
        "level": 0,
        "content": null,
        "endUser": null,
        "informations": null,
        "warnings": null,
        "errors": null,
        "disabled": null,
        "generalInformations": [],
        "generalWarnings": [],
        "generalErrors": []
      },
      "informations": null,
      "warnings": null,
      "errors": null,
      "disabled": null,
      "generalInformations": [],
      "generalWarnings": [],
      "generalErrors": []
    }
  ],
  "informations": null,
  "warnings": null,
  "errors": null,
  "disabled": null,
  "generalInformations": [],
  "generalWarnings": [],
  "generalErrors": []
}

Khi gọi api get để lấy dữ liệu vấn đề, đồng thời gọi api count/list của phản hồi

API Count :

rpc/iot-ebe/discussion/count

Cấu trúc body:

{
  "discussionId": {
    "equal": "9f04bacc-b6b1-4ae2-8d2f-86cb9929a42d"
  }
}

Response Mẫu:

2

API List :

rpc/iot-ebe/discussion/list

Cấu trúc body:

{
  "discussionId": {
    "equal": "e08347c4-42f3-4199-973f-4f401b1fdcec"
  }
}

Response Mẫu:

[
  {
    "id": 10146,
    "isOwner": false,
    "discussionId": "e08347c4-42f3-4199-973f-4f401b1fdcec",
    "content": "Co con chim vanh khuyen nho",
    "url": null,
    "creatorId": 3892,
    "endUserId": null,
    "createdAt": "2023-06-22T08:54:01.337Z",
    "updatedAt": "2023-06-22T08:54:01.387Z",
    "deletedAt": null,
    "creator": {
      "id": null,
      "username": null,
      "displayName": "Hệ thống chăm sóc khách hàng",
      "password": null,
      "newPassword": null,
      "phoneNumber": null,
      "email": null,
      "token": null,
      "refreshToken": null,
      "deviceName": null,
      "ownedProfileId": "0",
      "sexId": null,
      "verificationTypeId": 0,
      "verificationStatusId": null,
      "uid": null,
      "tuyaUid": null,
      "tuyaUsername": null,
      "tuyaUsernameTypeId": null,
      "tuyaPassword": null,
      "ownedProfile": null,
      "sex": null,
      "verificationType": null,
      "endUserProfiles": null,
      "birthday": null,
      "createdAt": "0001-01-01T00:00:00.000Z",
      "updatedAt": "0001-01-01T00:00:00.000Z",
      "informations": null,
      "warnings": null,
      "errors": null,
      "disabled": null,
      "generalInformations": [],
      "generalWarnings": [],
      "generalErrors": []
    },
    "commentAttachments": null,
    "informations": null,
    "warnings": null,
    "errors": null,
    "disabled": null,
    "generalInformations": [],
    "generalWarnings": [],
    "generalErrors": []
  },
  {
    "id": 10145,
    "isOwner": false,
    "discussionId": "e08347c4-42f3-4199-973f-4f401b1fdcec",
    "content": "chim gap trung bestie hi keo",
    "url": null,
    "creatorId": 3892,
    "endUserId": null,
    "createdAt": "2023-06-22T08:45:48.117Z",
    "updatedAt": "2023-06-22T08:50:10.230Z",
    "deletedAt": null,
    "creator": {
      "id": null,
      "username": null,
      "displayName": "Hệ thống chăm sóc khách hàng",
      "password": null,
      "newPassword": null,
      "phoneNumber": null,
      "email": null,
      "token": null,
      "refreshToken": null,
      "deviceName": null,
      "ownedProfileId": "0",
      "sexId": null,
      "verificationTypeId": 0,
      "verificationStatusId": null,
      "uid": null,
      "tuyaUid": null,
      "tuyaUsername": null,
      "tuyaUsernameTypeId": null,
      "tuyaPassword": null,
      "ownedProfile": null,
      "sex": null,
      "verificationType": null,
      "endUserProfiles": null,
      "birthday": null,
      "createdAt": "0001-01-01T00:00:00.000Z",
      "updatedAt": "0001-01-01T00:00:00.000Z",
      "informations": null,
      "warnings": null,
      "errors": null,
      "disabled": null,
      "generalInformations": [],
      "generalWarnings": [],
      "generalErrors": []
    },
    "commentAttachments": null,
    "informations": null,
    "warnings": null,
    "errors": null,
    "disabled": null,
    "generalInformations": [],
    "generalWarnings": [],
    "generalErrors": []
  }
]

Hoặc tạo phản hồi cho người dùng

API Create :

rpc/iot-ebe/discussion/create

Cấu trúc body:

{
  "discussionId": "Guid",
  "content": "string"
}

Request mẫu

{
  "discussionId": "e08347c4-42f3-4199-973f-4f401b1fdcec",
  "content": "Chim gap anh chich choe chao anh",
  "commentAttachments": [
    {
      "attachmentTypeId": 1,
      "url": "https://gandalf.truesight.asia/rpc/utils/file/download/discussion/20230717/3db0d5cf-2ce4-4342-8775-508d329fa648/cainit.jpg",
      "name": "3018885b-d0e9-4f3b-be91-02536f6c1db0.png"
    }
  ]
}

Response Mẫu:

{
  "id": 10143,
  "isOwner": true,
  "discussionId": "e08347c4-42f3-4199-973f-4f401b1fdcec",
  "content": "Chim gap anh chich choe chao anh",
  "url": null,
  "creatorId": 4603,
  "endUserId": 249442343927676928,
  "createdAt": "2023-06-22T08:28:31.057Z",
  "updatedAt": "2023-06-22T08:28:31.057Z",
  "deletedAt": null,
  "creator": {
    "id": "249442343927676928",
    "username": "summertime",
    "displayName": "Jonas Brother",
    "password": null,
    "newPassword": null,
    "phoneNumber": "+84354246220",
    "email": null,
    "token": null,
    "refreshToken": null,
    "deviceName": null,
    "ownedProfileId": "0",
    "sexId": null,
    "verificationTypeId": 6,
    "verificationStatusId": 1,
    "uid": null,
    "tuyaUid": null,
    "tuyaUsername": null,
    "tuyaUsernameTypeId": null,
    "tuyaPassword": null,
    "ownedProfile": null,
    "sex": null,
    "verificationType": null,
    "endUserProfiles": null,
    "birthday": null,
    "createdAt": "2023-06-20T07:54:49.207Z",
    "updatedAt": "2023-06-20T07:54:49.433Z"
  },
  "commentAttachments": [
    {
      "id": 1,
      "commentId": 10245,
      "attachmentTypeId": 1,
      "url": "https://gandalf.truesight.asia/rpc/utils/file/download/discussion/20230717/3db0d5cf-2ce4-4342-8775-508d329fa648/cainit.jpg",
      "thumbnail": null,
      "size": null,
      "name": "3018885b-d0e9-4f3b-be91-02536f6c1db0.png",
      "checksum": null,
      "type": null,
      "attachmentType": {
        "id": 1,
        "code": "Image",
        "name": "Image",
        "informations": null,
        "warnings": null,
        "errors": null,
        "disabled": null,
        "generalInformations": [],
        "generalWarnings": [],
        "generalErrors": []
      },
      "informations": null,
      "warnings": null,
      "errors": null,
      "disabled": null,
      "generalInformations": [],
      "generalWarnings": [],
      "generalErrors": []
    }
  ],
  "informations": null,
  "warnings": null,
  "errors": null,
  "disabled": null,
  "generalInformations": [],
  "generalWarnings": [],
  "generalErrors": []
}

Upload ở bình luận

File upload trong phần bình luận sẽ dùng api sau (1 file) :

  Method: HttpPost
  Header: Token
  Body: file

  Url: {BASE_URL}/rpc/iot-ebe/discussion/save-file

Response

{
  "id": 861415,
  "name": "fe408661-82f8-4fdc-be3c-945d016a1a55.png",
  "mimeType": "image/png",
  "isFile": false,
  "path": "https://gandalf.truesight.asia/rpc/utils/file/download/issue/20230622/fe408661-82f8-4fdc-be3c-945d016a1a55.png",
  "level": 0,
  "content": null,
  "endUser": null,
  "informations": null,
  "warnings": null,
  "errors": null,
  "disabled": null,
  "generalInformations": [],
  "generalWarnings": [],
  "generalErrors": []
}