跳到主要内容

Puppet Provider: Lark

Wechaty Puppet Lark

Wechaty Puppet Lark

NPM Version npm (tag)

Features

  1. Send & Receive Messages (Text, Image, Video, File)
  2. Get Contact List

Usage

Run wechaty-puppet-lark:

npm install wechaty-puppet-lark
export WECHATY_PUPPET=wechaty-puppet-lark
npm start

Integration

Let's take up an example on how to integrate bot from starter templete to Lark. The step is similar for all other bots as well.

Prerequisite

  1. Offical Wechaty package: package/wechaty.
  2. Configure your system environment variables as below:
  • WECHATY_PUPPET_LARK_APPID: for the app ID of Feishu application.
  • WECHATY_PUPPET_LARK_APPSECRET: for the app secret of Feishu App.
  • WECHATY_PUPPET_LARK_TOKEN: for the verification token provided by Feishu Event Subscription Platform.

You can follow up the steps mentioned below:

  1. Initialize the project by creating a new folder my-bot:

    mkdir my-bot
    cd my-bot
  2. Install the dependencies using the following commands:

    npm install wechaty
  3. Add the dependencies for using the bot with Lark:

    npm install wechaty-puppet-lark
  4. Create a new folder src and add a file my-bot.js. Add any of the functions from add functionality to the bot section to the snippet below:

    import {
    Contact,
    Message,
    ScanStatus,
    Wechaty,
    log,
    } from 'wechaty'

    console.log(welcome)
    const bot = new Wechaty()

    /*
    *Your function goes here
    */
  5. Obtain your functional permissions on Feishu platform from Feishu Open Platform-Application Permission.

  6. After you are done with the file, you can run the bot using the following commands:

    export WECHATY_LOG=verbose
    export WECHATY_PUPPET=wechaty-puppet-lark
    node src/my-bot.js

Copy the generated code to Lark and you are ready to play with the bot!

Videos

Presentation

Live Coding

For more information on deploying in Lark, you can refer to this Pull Request

Maintainers