Nhảy tới nội dung

Bắt đầu hỗ trợ ở phiên bản:

  • SDK: 2.5.3
Lưu ý

Cần xin cấp quyền tại trang Quản lý ứng dụng

Cho phép ứng dụng mở cửa số chat với User hoặc Official Account.

Parameters​

Object object​

PropertyTypeDefaultRequiredDescriptionMinimum Version
typestringtrueNhận các giá trị sau:
  • 'user': Mở cửa sổ chat với User
  • 'oa': Mở của sổ chat với OA
idstringtrueId của User hoặc OA
messagestringNội dung sẽ được tự động điền vào ô tin nhắnAPI: 2.20.0
successfunctionCallback function khi gọi api thành công
failfunctionCallback function khi gọi api thất bại

Sample Code​

import {openChat} from 'zmp-sdk/apis';

const openChatScreen =()=> {
openChat({
type: 'user',
id: 'user-id',
message: 'Xin Chào'
success: () => {},
fail: (err) => {}
});
}

Hoặc

import { openChat } from "zmp-sdk/apis";

const openChatScreen = async () => {
try {
await openChat({
type: "user",
id: "user-id",
message: "Xin Chào",
});
} catch (error) {
// xử lý khi gọi api thất bại
console.log(error);
}
};