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

STTTrường dữ liệuDạngGhi chú
rpc/portal/service-profile/loginPOST
1CodeStringTên tài khoản: PORTAL_CODE
2PasswordStringMật khẩu: PORTAL_PASSWORD
3AliasUserIdLongUserId: 1 ( sẽ cập nhật lại khi BA tạo tài khoản dùng để tích hợp)
4AliasTypeIdLongTypeId: 1
5TokenStringResponse 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ảnMật khẩu
PORTAL_CODEPORTAL_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

STTTrường dữ liệuDạngGhi chú
1IdlongId của Khách hàng Ralli
2NameStringTên khách hàng
3PhoneStringSố điện thoại
4EmailstringEmail khách hàng
5StatusIdInt1: Hoạt động, 0: Không hoạt động

Response

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

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)
STTTrường dữ liệuDạngGhi chú
1IdIntId của vấn đề
2DescriptionStringNội dung vấn đề
3TitleStringTiêu đề vấn đề
4IssueStatusIdintTrạng thái của vấn đề
5RalliIdIntId của tài khoản Ralli tạo vấn đề
6CreatedAtDateNgày tạo vấn đề
7UpdatedAtDateNgày cập nhật lần cuối
8DeletedAtDateNgày xóa vấn đề
9IssueFileMappingsList<IssueFileMapping>Danh sách tệp đính kèm
10ResolveContentstringNội dung giải quyết vấn đề

IssueStatus

STTTrường dữ liệuDạngGhi chú
1IdIntId của trạng thái
2CodeStringMã trạng thái
3NameStringTên trạng thái
IDCodeName
1WAITINGChờ xử lý
2PROCESSINGĐang xử lý
3DONEHoàn thành

IssueFileMapping

STTTrường dữ liệuDạngGhi chú
1IdIntId của mapping
2IssueIdIntId vấn đề
3FileIdIntId file
4FileFileentity file

File

STTTrường dữ liệuDạngGhi chú
1IdIntId của mapping
2IssueIdIntId vấn đề
3FileIdIntId file
4FileFileentity file

File

STTTrường dữ liệuDạngGhi chú
1IdIntId ảnh
2NamestringTên file
3Pathstringurl 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

STTTrường dữ liệuDạngGhi chú
1IdIntId của phản hồi
2DiscussionIdGuid= RowId của vấn đề
3IsOwnerbool= true nếu người dùng hiện tại tạo phản hồi
4ContentstringNội dung phản hồi
5EndUserIdIntId của tài khoản Ralli tạo phản hồi
6Urlstring
7CreatorIdlongId người phản hồi
8CreatedAtDateNgày tạo phản hồi
9UpdatedAtDateNgày cập nhật lần cuối
10DeletedAtDateNgày xóa phản hồi
11CommentAttachmentsList<CommentAttachment>Danh sách đính kèm

CommentAttachment

STTTrường dữ liệuDạngGhi chú
1IdIntId của phản hồi
2CommentIdintId của bình luận
3AttachmentTypeIdintId của loại đính kèm
4UrlstringUrl ảnh
5BaseUrlstringBaseUrl của folder ảnh
6Sizestring?
7NamestringTên đính kèm
8Checksumstring
9Typestring
10Thumbnailstring

AttachmentType

IDCodeName
1ImageImage
2StickerSticker
3FileFile
4UrlUrl
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": []
}