Cloud Functions

Last Updated on : 2023-10-09 01:57:18download

This topic describes the APIs provided by IoT WeChat Mini Program SDK.

Make API requests

You can integrate Tuya’s cloud functions into your project to call Tuya IoT WeChat Mini Program APIs. The following example shows how to make the API requests.

import { request } from '../../utils/request';
const params = {
    data: {
    // action: the interface name. For more information, see the API reference documentation.
        action: "hello",
    // params: the parameters.
        params: {
            hello: 'world'

// Use request encapsulated in the demo to make the API request.
// Use the Promise object or async and await keywords to make the API request.

request(params).then(res =>{
    console.log('res', res);
}).catch(err => console.log('err', err))

Platform APIs

Capability Description
User management Integrate the user system of an IoT WeChat mini program with that of an app.
Device management Manage all devices based on details of each device.
Status synchronization Sync status of devices.
Data service Manage information about device activation.
Statistics service Manage statistics of energy metering and sleep status.
Country code service Manage the data of country codes.
Scheduled tasks Add, modify, query, and delete scheduled tasks of devices.
Smart home management Manage rooms, homes, and other elements in smart home scenarios.
Home sharing Add members to share homes based on the sharing system provided by WeChat.
Scene management Add, modify, query, and delete smart scenes.
Automation management Add, modify, query, and delete automation tasks.
Weather service Get data of weather conditions.
Generic services Query device logs, restore factory defaults, and run over-the-air (OTA) updates.
Device user management Add, modify, query, and delete users of a device.
Message center Manage messages in the Message Center.
Manage channel names of a device Manage different channels configured for a device.

Dedicated service APIs

Capability Description
IR remote control Manage IR remote controls.
Set-top box remote control Manage set-top box remote controls.
Air conditioner remote control Manage air conditioner remote controls.
IR learning capabilities Manage IR learning capabilities.
Smart locks Manage business about smart locks.
Sleep band Manage business about sleep bands.