Summary

Mini Program operators can instantly authorize third-party platforms and complete operations through them. Development conducted through third-party platforms on Mini Programs' front and back ends differs from development directly done. For their various APIs and details on them, please see Act as Agent for Mini Programs. For the rest of the information, please continue reading this document.

Developing Mini Programs using third-party platforms is fairly complicated. You need to understand 3 concepts first:

  • open3rd: Third-party platform, a developer that is officially certified by Mini Programs Details
  • 3rdMiniProgramAppid: Mini Program requested by third-party platform and bound to it, used for developing Mini Program templates
  • extAppid: Mini Program authorized to a third-party platform

Special processes required by Mini Program development related to a third-party platform:

  • Mini Program template development
  • Development debugging by Mini Program template combined with "extAppid"
  • Use directCommit to directly submit to the pending review list Details

The latest development tool supports third-party platform Mini Program development and preview.

Create Project

Just like developing ordinary Mini Programs, third-party platform developers will fill in the relevant "3rdMiniProgramAppid", set project name and select project directory to create a project.

For third-party Mini Programs, the relevant "open3rd" information and the current third-party "3rdMiniProgramAppid" can be viewed on the project card. If the project is configured with related "extAppid", then related information will also be available on the project card.

extext

Mini Program template development

Just like developing a general Mini Program, after the developer completes related business logic on the development tool, submit for preview in the project tab to see what's really happening with your Mini Program in WeChat.

The difference is that the submission uploads of a third-party platform Mini Program are directed to the template draft box under "open" accounts of the third-party platform. The platform's administrator needs to proactively carry out the corresponding settings on the template. For more information, please consult Open Platform Document.

"extAppid" development debugging

To facilitate third-party platform developers in ingesting development debugging for "extAppid", the concept ext.json is introduced.

ext.json is a configuration file placed in the root directory of the Mini Program project.

Below is a ext.json that contains all configuration options:

{
  "extEnable": true,
  "extAppid": "wxf9c4501a76931b33",
  "directCommit": false,
  "ext": {
    "name": "wechat",
    "attr": {
      "host": "open.weixin.qq.com",
      "users": [
        "user_1",
        "user_2"
      ]
    }
  },
  "extPages": {
    "pages/logs/logs": {
      "navigationBarTitleText": "logs"
    }
  },
  "window":{
    "backgroundTextStyle":"light",
    "navigationBarBackgroundColor": "#fff",
    "navigationBarTitleText": "Demo",
    "navigationBarTextStyle":"black"
  },
  "tabBar": {
    "list": [{
      "pagePath": "pages/index/index",
      "text": "Home"
    }, {
      "pagePath": "pages/logs/logs",
      "text": "Log"
    }]
  },
  "networkTimeout": {
    "request": 10000,
    "downloadFile": 10000
  }
}

There are 2 types of configuration fields in ext.json

  • Special Fields
  • Fields that are the same as app.json

Special Fields

Attributes Type Required Description
extEnable Boolean Yes Whether "ext.json" configuration is in effect
extAppid String Yes Configure extAppid
ext Object No Custom data field defined by the developer
extPages String Array No json should be set solely for each page
directCommit Boolean No Whether to submit directly to the pending review list

extEnable

extEnable is a Boolean type field, used to rule if the current ext.json file is in effect. The developer can change this field to enable or disable combined development of "extAppid".

extAppid

extAppid is AppID authorized to debug, e.g. when the developer fills in wxf9c4501a76931b33 here, then when extEnable is true, subsequent development logic will be run based on wxf9c4501a76931b33.

ext

The ext field is a custom data field defined by the developer. wx.getExtConfigSync or wx.getExtConfig can be used in the Mini Program to retrieve the configuration information.

As in the above example, wx.getExtConfigSync can be used to get all configurations of the ext field

{
  "name": "wechat",
  "attr": {
    "host": "open.weixin.qq.com",
    "users": [
      "user_1",
      "user_2"
    ]
  }
}

extPages

extPages is an object. Every key in the object should be a page defined in a Mini Program template app.json. Every value corresponding to key refers to various configurations set in page.json.

After the developer sets this configuration, the Mini Program framework will make corresponding changes to the configuration information of the corresponding page.

directCommit

directCommit is a Boolean type field, used to rule if the current upload operation is to directly upload into the "extAppid" review list.

When directCommit is true, the developer upload operation in the tool is directly uploaded to the review list of the corresponding "extAppid". For a third-party platform, it only needs to call https://api.weixin.qq.com/wxa/submit_audit?access_token=TOKEN to submit for review. For more information, please refer to Third-party platform documentation

When directCommit is false or undefined, the developer's upload operations on the tool will go directly to the corresponding draft box.

Tips: The tool's command line interface or http interface can be used to automate code submission for review

Fields that are the same as app.json

When the field in ext.json is consistent with that of app.json, the field of ext.json will override the corresponding field in app.json, e.g. the following ext.json

{
  ········
  "window":{
    "backgroundTextStyle":"light",
    "navigationBarBackgroundColor": "#fff",
    "navigationBarTitleText": "ext navigationBarTitleText",
    "navigationBarTextStyle":"black"
  }
}

Then the final navigationBarTitleText of the Mini Program should be ext navigationBarTitleText.