Last Updated on : 2025-07-17 01:54:13download
The integration of the WeChat ecosystem is rather complex. Developers need to be familiar with the corresponding technologies and have relevant integration experience. Therefore, it’s suggested to contact Tuya for consultation and assessment before deciding whether to start the SDK development.
The @ray-js/wechat-ms-member
SDK integrates capabilities that enable users to create, query, update, delete, and bind unlocking methods.
yarn add @ray-js/wechat-ms-member
// or
npm install @ray-js/wechat-ms-member
getFamilyMember
Request parameters
Parameter | Type | Description | Required |
---|---|---|---|
device_id | string | The device ID. | true |
offset | number | The number of entries starting from which entries are returned. Default value: 0 . |
false |
limit | number | The number of entries to be returned per page. Default value: 200 . |
false |
keyword | string | The keyword. | false |
dp_codes | string | The data points (DPs) for standard unlocking methods. Valid values:
|
false |
Response parameters
Parameter | Type | Description |
---|---|---|
hasNext | bool | Specifies whether there is a next page. |
user | UserItem[] | The common member. |
admin | UserItem[] | The administrator. |
Description of UserItem
Parameter | Type | Description |
---|---|---|
userId | string | The user ID in a home. |
lockUserId | number | The user ID that is associated with the lock. |
userContact | string | The contact method. |
avatarUrl | string | The URL address of the specified avatar. |
nickName | string | The nickname. |
userType | number | The user list type. Valid values:
|
userListType | string | The user list type. Valid values:
|
backHomeNotifyAttr | number | Specifies whether to set notifications of member arrival at home. Valid values:
|
effectiveFlag | number | Specifies whether the unlocking method is valid. Valid values:
|
timeScheduleInfo | ITimeScheduleInfo | The schedule information for the specified unlocking method to take effect. |
unlockDetail | IUnlockDetail[] |
The details of the specified unlocking method. |
Description of ITimeScheduleInfo
Parameter | Type | Description |
---|---|---|
permanent | bool | Specifies whether the specified unlocking method is always valid. |
effectiveTime | number | The effective time. |
expiredTime | number | The expiration time. |
operate | string | The type of operation, including ADD , MODIFY , and DELETE . Currently, only MODIFY is available. |
deliveryStatus | string | The response from the device. Valid values:
|
Description of IScheduleDetails
Parameter | Type | Description |
---|---|---|
allDay | bool | Specifies whether the unlocking method is valid all day long. |
effectiveTime | number | The effective time. |
invalidTime | number | The expiration time. |
workingDay | string | The day of the week when the unlocking method is valid. |
Description of IUnlockDetail
Parameter | Type | Description |
---|---|---|
dpCode | number | The DP code of the specified unlocking method. |
count | number | The number of the current unlocking methods. |
unlockList | IUnlockList | The list of unlocking methods. |
Description of IUnlockList
Parameter | Type | Description |
---|---|---|
unlockSn | string | The SN of the specified unlocking method. |
dpCode | string | The DP code of the specified unlocking method. Valid values:
|
unlockName | string | The name of the specified unlocking method. |
unlockAttr | number | The attribute of the specified unlocking method. Valid values:
|
allocateFlag | number | Indicates whether the specified unlocking method has never been allocated to a user before. Valid values:
|
Sample request
import MsMemberApi from '@ray-js/wechat-ms-member';
MsMemberApi.getFamilyMember({
device_id: 'vdevo172164201350692',
})
.then(response => {
console.log(response);
})
.catch(error => console.log(error));
Sample response
{
hasNext: false
admin: [
{
avatarUrl: "https://images.tuyacn.com/xxxxxx.png",
backHomeNotifyAttr: 0,
effectiveFlag: 1,
lockUserId: 1,
nickName: "Alice",
userContact: "*******@tuya.com",
userId: "5958862",
userType: 50,
uid: "xxxxxxxx",
timeScheduleInfo: {
permanent: true,
userTimeSet: "386cd30072bc9b7f000000000000000000",
},
unlockDetail:[
{
count: 0,
dpCode: "unlock_fingerprint",
unlockList: []
}]
}],
}
getListUsers
Request parameters
Parameter | Type | Description | Required |
---|---|---|---|
device_id | string | The device ID. | true |
page_no | number | The page number. The default value is 1. | false |
page_size | number | The number of records to return per page. The default value is 200. | false |
target_standard_dp_codes | string | The data point (DP) code of a standard unlocking method. Valid values:
|
false |
Response parameters
Parameter | Type | Description |
---|---|---|
has_more | bool | Indicates whether the next page exists. |
total | number | The total number of records. |
total_pages | number | The total number of pages. |
records | GetListUserItem[] | The details of all users in the list. |
Description of GetListUserItem
Parameter | Type | Description |
---|---|---|
user_id | string | The ID of the user of a home. |
lock_user_id | number | The ID of the user of a lock. |
user_contact | string | The contact information. |
avatar_url | string | The avatar URL. |
nick_name | string | The nickname. |
user_type | number | The user type. Valid values:
|
back_home_notify_attr | number | Indicates whether to send notifications when family members arrive home. Valid values:
|
effective_flag | number | Indicates whether the unlocking method is valid. Valid values:
|
time_schedule_info | ITimeScheduleInfo | The schedule information for when the unlocking method becomes valid. |
unlock_detail | IUnlockDetail[] |
The details of the unlocking method. |
Description of ITimeScheduleInfo
Parameter | Type | Description |
---|---|---|
permanent | bool | Indicates whether the unlocking method is valid permanently. |
effective_time | number | The effective time. |
expired_time | number | The expiration time. |
operate | string | The operation type. Valid values: ADD , MODIFY , and DELETE . Currently, only MODIFY is available. |
delivery_status | string | The response of the device to the operation. Valid values:
|
Description of IScheduleDetails
Parameter | Type | Description |
---|---|---|
all_day | bool | Indicates whether the unlocking method is valid all day. |
effective_time | number | The effective time. |
invalid_time | number | The expiration time. |
working_day | string | The day of the week the unlocking method is valid. |
Description of IUnlockDetail
Parameter | Type | Description |
---|---|---|
dp_code | number | The DP code of the unlocking method. |
count | number | The number of the current unlocking methods. |
unlock_list | IUnlockList | The list of the unlocking methods. |
Description of IUnlockList
Parameter | Type | Description |
---|---|---|
unlock_sn | string | The SN of the unlocking method. |
dp_code | string | The DP code of the unlocking method. Valid values:
|
unlock_name | string | The name of the unlocking method. |
unlock_attr | number | The attribute of the unlocking method. Valid values:
|
allocate_flag | number | Indicates whether an unallocated unlocking method is allocated to the user. Valid values:
|
Sample request
import MsMemberApi from '@ray-js/wechat-ms-member';
MsMemberApi.getListUsers({
device_id: 'vdevo172164201350692',
})
.then(response => {
console.log(response);
})
.catch(error => console.log(error));
Sample response
{
has_more: false,
records: [
{
avatar_url: "https://images.tuyacn.com/xxxxxx.png",
back_home_notify_attr: 0,
effective_flag: 1,
lock_user_id: 1,
nick_name: "Alice",
user_contact: "*******@tuya.com",
user_id: "5958862",
user_type: 50,
uid: "xxxxxxxx",
time_schedule_info: {
permanent: true,
user_time_set: "386cd30072bc9b7f000000000000000000",
},
unlock_detail:[
{
count: 0,
dp_code: "unlock_fingerprint",
unlock_list: []
}]
}],
total: 1,
total_pages: 1
}
getListPanelUsers
Request parameters
Parameter | Type | Description | Required |
---|---|---|---|
device_id | string | The device ID. | true |
page_no | number | The page number. The default value is 1. | false |
page_size | number | The number of records to return per page. The default value is 200. | false |
dp_codes | string | The DP code of a standard unlocking method. Valid values:
|
false |
Response parameters
Parameter | Type | Description |
---|---|---|
has_more | bool | Indicates whether the next page exists. |
total | number | The total number of records. |
total_pages | number | The total number of pages. |
records | GetListUserItem[] |
The details of all users in the list. |
Description of GetListUserItem
Parameter | Type | Description |
---|---|---|
user_id | string | The ID of the user of a home. |
lock_user_id | number | The ID of the user of a lock. |
user_contact | string | The contact information. |
avatar_url | string | The avatar URL. |
nick_name | string | The nickname. |
user_type | number | The user type. Valid values:
|
back_home_notify_attr | number | Indicates whether to send notifications when family members arrive home. Valid values:
|
effective_flag | number | Indicates whether the unlocking method is valid. Valid values:
|
time_schedule_info | ITimeScheduleInfo | The schedule information for when the unlocking method becomes valid. |
unlock_detail | IUnlockDetail[] |
The details of the unlocking method. |
Description of ITimeScheduleInfo
Parameter | Type | Description |
---|---|---|
permanent | bool | Indicates whether the unlocking method is valid permanently. |
effective_time | number | The effective time. |
expired_time | number | The expiration time. |
operate | string | The operation type. Valid values: ADD , MODIFY , and DELETE . Currently, only MODIFY is available. |
delivery_status | string | The response of the device to the operation. Valid values:
|
Description of IScheduleDetails
Parameter | Type | Description |
---|---|---|
all_day | bool | Indicates whether the unlocking method is valid all day. |
effective_time | number | The effective time. |
invalid_time | number | The expiration time. |
working_day | string | The day of the week the unlocking method is valid. |
Description of IUnlockDetail
Parameter | Type | Description |
---|---|---|
dp_code | number | The DP code of the unlocking method. |
count | number | The number of the current unlocking methods. |
unlock_list | IUnlockList | The list of the unlocking methods. |
Description of IUnlockList
Parameter | Type | Description |
---|---|---|
unlock_sn | string | The SN of the unlocking method. |
dp_code | string | The DP code of the unlocking method. Valid values:
|
unlock_name | string | The name of the unlocking method. |
unlock_attr | number | The attribute of the unlocking method. Valid values:
|
allocate_flag | number | Indicates whether an unallocated unlocking method is allocated to the user. Valid values:
|
Sample request
import MsMemberApi from '@ray-js/wechat-ms-member';
MsMemberApi.getListPanelUsers({
device_id: 'vdevo172164201350692',
})
.then(response => {
console.log(response);
})
.catch(error => console.log(error));
Sample response
{
has_more: false,
records: [],
total: 0,
total_pages: 0,
}
addPanelUsers
Request parameters
Parameter | Type | Description | Required |
---|---|---|---|
device_id | string | The device ID. | true |
nick_name | string | The nickname. | true |
Response parameters
Parameter | Type | Description |
---|---|---|
result | string | The user ID. |
Sample request
import MsMemberApi from '@ray-js/wechat-ms-member';
MsMemberApi.addPanelUsers({
device_id: 'vdevo172164201350692',
nick_name: 'Ming',
})
.then(response => {
console.log(response);
})
.catch(error => console.log(error));
Sample response
'7wmqnc';
deletePanelUsers
Request parameters
Parameter | Type | Description | Required |
---|---|---|---|
device_id | string | The device ID. | true |
user_id | string | The user ID. | true |
Response parameters
Return a boolean value to indicate whether the user is deleted.
Sample request
import MsMemberApi from '@ray-js/wechat-ms-member';
MsMemberApi.deletePanelUsers({
device_id: 'vdevo172164201350692',
user_id: '7wmqnc',
})
.then(response => {
console.log(response);
})
.catch(error => console.log(error));
Sample response
true;
Get the list of unbound unlocking methods, or determine whether any unlocking method is not bound.
listUnallocatedOpModes
Request parameters
Parameter | Type | Description | Required |
---|---|---|---|
device_id | string | The device ID. | true |
page_no | number | The page number. The default value is 1. | false |
page_size | number | The number of records to return per page. The default value is 200. | false |
Response parameters
Parameter | Type | Description |
---|---|---|
has_more | bool | Indicates whether the next page exists. |
total | number | The total number of records in the list. |
total_pages | number | The total number of pages in the list. |
records | IUnAllocatedItem[] |
The details of all users in the list. |
Description of IUnAllocatedItem
Parameter | Type | Description |
---|---|---|
standard_dp | string | The DP code of the unlocking method. Valid values:
|
unlock_info | IUnlockInfo | The details of the unlocking method. |
Description of IUnlockInfo
Parameter | Type | Description |
---|---|---|
dp_code | string | The DP code of the unlocking method. Valid values:
|
opmode_id | number | The ID of the unlocking method. |
unlock_name | string | The name of the unlocking method. |
unlock_sn | number | The SN of the unlocking method. |
Sample request
import MsMemberApi from '@ray-js/wechat-ms-member';
MsMemberApi.listUnallocatedOpModes({
device_id: 'vdevo172164201350692',
})
.then(response => {
console.log(response);
})
.catch(error => console.log(error));
Sample response
{
has_more: false,
records: [
{
standard_dp: 'unlock_fingerprint',
unlock_info: [
{
dp_code: 'unlock_fingerprint',
opmode_id: '4065562',
unlock_name: 'fingerprint',
unlock_sn: 2
}
]
}
],
total: 1,
total_pages: 1,
}
listUserOpModes
Request parameters
Parameter | Type | Description | Required |
---|---|---|---|
device_id | string | The device ID. | true |
user_id | string | The user ID. | true |
target_unlock_standard_dp_codes | string | The DP code of the unlocking method. Valid values:
|
false |
page_no | number | The page number. The default value is 1. | false |
page_size | number | The number of records to return per page. The default value is 200. | false |
Response parameters
Parameter | Type | Description |
---|---|---|
has_more | bool | Indicates whether the next page exists. |
total | number | The total number of records in the list. |
total_pages | number | The total number of pages in the list. |
records | listUserOpmodeItem[] | The details of all users in the list. |
Description of listUserOpmodeItem
Parameter | Type | Description |
---|---|---|
unlock_sn | string | The SN of the unlocking method. |
dp_code | string | The DP code of the unlocking method. Valid values:
|
unlock_name | string | The name of the unlocking method. |
unlock_attr | number | The attribute of the unlocking method. 1 represents duress unlocking. |
allocate_flag | number | Indicates whether an unallocated unlocking method is allocated to the user. Valid values:
|
lock_user_id | number | The ID of the user of a lock. |
phase | number | The phase. Valid values:
|
user_name | string | The nickname of the user. |
user_id | string | The ID of the user of a home. |
user_type | number | The user type. Valid values:
|
photo_unlock | number | Indicates whether photo-based duress alert is enabled. Valid values:
|
Sample request
import MsMemberApi from '@ray-js/wechat-ms-member';
MsMemberApi.listUserOpModes({
device_id: 'vdevo172164201350692',
user_id: '7wmqnc',
})
.then(response => {
console.log(response);
})
.catch(error => console.log(error));
Sample response
{
has_more: false,
records: [
{
allocate_flag: 1,
channel_id: -1,
dp_code: 'unlock_password',
lock_user_id: 8,
phase: 1,
photo_unlock: 0,
unlock_attr: 1,
unlock_name: 'password',
unlock_sn: 5,
user_id: '5958862',
user_name: 'Ling',
user_type: 10,
voice_attr: 0
}
],
total: 1,
total_pages: 1,
}
deleteOpMode
Request parameters
Parameter | Type | Description | Required |
---|---|---|---|
device_id | string | The device ID. | true |
dp_code | string | The DP code of the unlocking method. Valid values:
|
true |
unlock_sn | string or number | The SN of the unlocking method. | true |
Response parameters
Return a boolean value to indicate whether the unlocking method is deleted.
Sample request
import MsMemberApi from '@ray-js/wechat-ms-member';
MsMemberApi.deleteOpMode({
device_id: 'vdevo172164201350***',
dp_code: 'unlock_fingerprint',
unlock_sn: 10,
})
.then(response => {
console.log(response);
})
.catch(error => console.log(error));
Sample response
true;
createOpMode
Request parameters
Parameter | Type | Description | Required |
---|---|---|---|
device_id | string | The device ID. | true |
user_id | string | The user ID. | true |
standard_dp_code | string | The DP code of the unlocking method. Valid values:
|
true |
unlock_no | number or string | The SN of the unlocking DP. | true |
unlock_attr | number | The attribute of the unlocking method. Valid values:
|
true |
unlock_name | string | The name of the unlocking method. | false |
notify_info | number | Specifies whether to enable the app to send notifications (app_send ). Valid values:
|
false |
Response parameters
Return a boolean value to indicate whether the unlocking method is added.
Sample request
import MsMemberApi from '@ray-js/wechat-ms-member';
MsMemberApi.createOpMode({
device_id: 'vdevo172164201350692',
standard_dp_code: 'unlock_fingerprint',
unlock_no: 10,
user_id: '5958862',
unlock_attr: 0,
unlock_name: '',
notify_info: { app_send: 1 },
})
.then(response => {
console.log(response);
})
.catch(error => console.log(error));
Sample response
true;
updateOpMode
Request parameters
Parameter | Type | Description | Required |
---|---|---|---|
device_id | string | The device ID. | true |
dp_code | string | The DP code of the unlocking method. Valid values:
|
true |
unlock_sn | string | The SN of the unlocking method. | true |
unlock_attr | 0 or 1 | The attribute of the unlocking method. Valid values:
|
true |
unlock_name | string | The name of the unlocking method. It is empty by default. | false |
photo_unlock | number | Specifies whether to enable photo-based duress alert. Valid values:
|
false |
notify_info | number | Specifies whether to enable the app to send notifications (app_send ). Valid values:
|
false |
Response parameters
Return a boolean value to indicate whether the unlocking method is updated.
Sample request
import MsMemberApi from '@ray-js/wechat-ms-member';
MsMemberApi.updateOpMode({
device_id: 'vdevo172164201350692',
photo_unlock: 0,
dp_code: 'unlock_fingerprint',
unlock_attr: 0,
unlock_name: 'fingerprint',
unlock_sn: 10,
notify_info: {
app_send: 1,
},
})
.then(response => {
console.log(response);
})
.catch(error => console.log(error));
Sample response
true;
Multiple unlocking methods can be bound at once.
allocateOpMode
Request parameters
Parameter | Type | Description | Required |
---|---|---|---|
device_id | string | The device ID. | true |
user_id | string | The user ID. | true |
unlock_list | UnlockListItem[] |
The list of unlocking methods to bind. | true |
Description of UnlockListItem
Parameter | Type | Description | Required |
---|---|---|---|
dp_code | string | The DP code of the unlocking method. Valid values:
|
true |
unlock_sn | string | The SN of the unlocking method. | true |
Response parameters
Return a boolean value to indicate whether the unlocking methods are bound.
Sample request
import MsMemberApi from '@ray-js/wechat-ms-member';
MsMemberApi.allocateOpMode({
device_id: 'vdevo172164201350692',
user_id: '5958862',
unlock_list: [
{
dp_code: 'unlock_fingerprint',
unlock_sn: 2,
},
],
})
.then(response => {
console.log(response);
})
.catch(error => console.log(error));
Sample response
true;
getSn
Request parameters
Parameter | Type | Description | Required |
---|---|---|---|
device_id | string | The device ID. | true |
dp_id | string | The DP ID. | true |
Response parameters
Return a number, which is the SN used for creating an unlocking method.
Sample request
import MsMemberApi from '@ray-js/wechat-ms-member';
MsMemberApi.getSn({
device_id: 'vdevo172164201350692',
dp_id: '63',
})
.then(response => {
console.log(response);
})
.catch(error => console.log(error));
Sample response
1;
Get the developer platform settings used for creating a password, including base, length range, and whether to hide zeros.
getPwdInfo
Request parameters
Parameter | Type | Description | Required |
---|---|---|---|
device_id | string | The device ID. | true |
Response parameters
Parameter | Type | Description |
---|---|---|
digit | number | The base. |
hasZero | bool | Indicates whether passwords can contain zeros. |
pwdLenMax | number | The maximum length of passwords created through the member management SDK. |
pwdLenMin | number | The minimum length of passwords created through the member management SDK. |
tempPwdLenMax | number | The maximum length of passwords created through the temporary password management SDK. |
tempPwdLenMin | number | The minimum length of passwords created through the temporary password management SDK. |
Sample request
import MsMemberApi from '@ray-js/wechat-ms-member';
MsMemberApi.getPwdInfo({
device_id: 'vdevo172164201350692',
})
.then(response => {
console.log(response);
})
.catch(error => console.log(error));
Sample response
{
digit: 10,
hasZero: true,
pwdLenMax: 10,
pwdLenMin: 10,
tempPwdLenMax: 7,
tempPwdLenMax: 7,
}
dealLocateOpMode
Request parameters
Parameter | Type | Description | Required |
---|---|---|---|
device_id | string | The device ID. | true |
user_id | string | The user ID. | true |
dp_code | string | The DP code of the unlocking method. Valid values:
|
true |
unlock_sn | string | The SN of the unlocking method. | true |
Response parameters
Return a boolean value to indicate whether the unlocking method is unbound from the member.
Sample request
import MsMemberApi from '@ray-js/wechat-ms-member';
MsMemberApi.dealLocateOpMode({
device_id: 'vdevo172164201350692',
user_id: '5958862',
unlock_sn: 2,
dp_code: 'unlock_fingerprint',
})
.then(response => {
console.log(response);
})
.catch(error => console.log(error));
Sample response
true;
setHijack
Request parameters
Parameter | Type | Description | Required |
---|---|---|---|
device_id | string | The device ID. | true |
unlock_type | string | The DP code of the unlocking method. Valid values:
|
true |
unlock_sn | string | The SN of the unlocking method. | true |
Response parameters
Return a boolean value to indicate whether duress alerts are enabled.
Sample request
import MsMemberApi from '@ray-js/wechat-ms-member';
MsMemberApi.setHijack({
device_id: 'vdevo172164201350692',
unlock_no: 10,
unlock_type: 'fingerprint',
})
.then(response => {
console.log(response);
})
.catch(error => console.log(error));
Sample response
true;
removeHijack
Request parameters
Parameter | Type | Description | Required |
---|---|---|---|
device_id | string | The device ID. | true |
unlock_type | string | The DP code of the unlocking method. Valid values:
|
true |
unlock_sn | string | The SN of the unlocking method. | true |
Response parameters
Return a boolean value to indicate whether duress alerts are disabled.
Sample request
import MsMemberApi from '@ray-js/wechat-ms-member';
MsMemberApi.removeHijack({
device_id: 'vdevo172164201350692',
unlock_no: 10,
unlock_type: 'unlock_fingerprint',
})
.then(response => {
console.log(response);
})
.catch(error => console.log(error));
Sample response
true;
getSyncableOpModeTypes
Request parameters
Parameter | Type | Description | Required |
---|---|---|---|
device_id | string | The device ID. | true |
Response parameters
Parameter | Type | Description |
---|---|---|
dp_id | number | The DP ID. |
distributed | bool | Indicates whether unlocking methods are allowed to be sent from the cloud. |
ins | string | The content to be sent. |
Sample request
import MsMemberApi from '@ray-js/wechat-ms-member';
MsMemberApi.getSyncableOpModeTypes('vdevo172164201350692')
.then(response => {
console.log(response);
})
.catch(error => console.log(error));
Sample response
{
distributed: true,
dp_id: 54,
ins: "04f0080506030102"
}
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback