Skip to main content

Puppet Provider: DIY

Wechaty Puppet DIY

Do It Yourself

You can make a Wechaty Puppet Provider easily.

You can build a Wechaty Puppet Service by yourself with any Wechaty Puppet Providers.

Development#

A Wechaty Puppet is a node package published on NPM that follow a defined convention.

How to implement a wechaty puppet#

related tutorial: How to implement a wechaty-puppet

Structure#

package.json#

The package.json is a manifest format for describing Node.js modules. Wechaty Puppets are built on top of Node modules. It declares dependencies, version, ownership, and other information required to run a plugin in Wechaty. This document describes the schema in detail.

A plugin manifest package.json can also contain details about the required configuration. The configuration schema is defined in the wechaty field of the package.json (This field follow the JSON-Schema guidelines):

{
"name": "wechaty-puppet-mytest",
"version": "0.0.1",
"description": "This is my first Wechaty Puppet",
"engines": {
"wechaty": ">=0.16.x"
},
"wechaty": {
"properties": {
"myConfigKey": {
"type": "string",
"default": "it's the default value",
"description": "It defines my awesome config!"
}
}
}
}

You can learn more about package.json from the NPM documentation.

The package name must begin with wechaty-puppet- and the package engines should contain wechaty.

mod.ts#

The mod.ts is the main entry point of your puppet implementation:

import { Puppet } from 'wechaty'
export class PuppetMyTest extends Puppet {
// ... implenmentation here ...
}
export default PuppetMyTest

Publish Your Puppet#

Wechaty Puppet can be published on NPM.

To publish a new Puppet, you need to create an account on npmjs.com then publish it from the command line:

npm publish

Blogs#

History#

Issues#

Support#

You can join our Gitter network if you aren’t already a member.

Last updated on by Souvik Biswas