Nhảy tới nội dung

requestSendNotification

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

  • SDK: 2.27.1

Yêu cầu người dùng cho phép ứng dụng gửi thông báo qua OA Mini App

request send notification

Parameters​

Object object​

PropertyTypeDefaultRequiredDescriptionMinimum Version
successfunctionCallback function khi gọi api thành công
failfunctionCallback function khi gọi api thất bại

Sample Code​

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

requestSendNotification({
success: () => {
// xử lý khi gọi api thành công
},
fail: (error) => {
// xử lý khi gọi api thất bại
console.log(error);
}
});

Hoặc

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

const sendNotification = async () => {
try {
await requestSendNotification({});
} catch (error) {
// xử lý khi gọi api thất bại
console.log(error);
}
};

Errors​

CodeMessageNote
-201User deny request permission!Người dùng từ chối cấp quyền
-202User deny request permission!Người dùng từ chối cấp quyền và không muốn hỏi lại
-2002User deniedNgười dùng đã từ chối cấp quyền trước đó và không muốn hỏi lại