Open the Mini Program through the WeChat chat material

Features

The way to open the materials (files, pictures, videos, and webviews) in the WeChat chat adds the entrance to open using the applet. Users can process files, pictures, videos and webviews in the chat through the applet. For example, use a small program to store files to the network disk, add filters to pictures, edit videos, or save webviews to notes, etc. Currently, only images without a QR code are supported to be opened directly through the applet.

When a user opens a material in a WeChat chat, if the Mini Program is configured to support the opening of this type of material and has been approved, and the user has used the Mini Program before, an entry using the Mini Program will appear when opening this type of material

Instructions for use

Developers need to declare the supported file types in the applet global configuration (app.json), and only one processing method can be declared for a file type.

{
    "supportedMaterials": [
        {
            "materialType": "text/html",
            "name": "用${nickname}打开",
            "desc": "描述",
            "path": "pages/index/"
        },
    ]
}

The latest client version supports the MineType type: refer to https://developers.weixin.qq.com/miniprogram/dev/framework/material/support_material.html

Common types:

The startup parameters of the applet

The scene value in the startup parameters of the applet is 1173. In this scenario, there is an array forwardMaterials at the same level as the query, which represents the forwarded file information. Each object in the array contains attributes {type, name, path, size} respectively representing the file type , file name, file path or url, file size

release

When the mini program is reviewed, it will review whether the declared supportedMaterials are compliant. After the mini program is released and launched, the corresponding file type will open the entrance to the mini program.

If the function value of the Mini Program is low, it will not be approved, including but not limited to the following situations:

  1. The function after opening the applet has nothing to do with the corresponding material: it just opens its own applet through this entry without any processing on the material.

  1. The way to process materials after opening the applet is too simple: such as just playing videos or just viewing .docx files and other simple functions that can be realized through WeChat chat.

Developers are requested to adapt the functions of their own mini programs and user needs.

debugging

Trial Version

体验版小程序支持单独配置supportedMaterials,和正式版的小程序配置相互独立,上述相应的入口小程序列表也会单独 展示体验版小程序。

开发者工具

开发者可在自定义编译模式下通过场景值1173调试该功能。

Guess you like

Origin blog.csdn.net/jewels_w/article/details/129792553