Skip to main content

Deploy in Lark

Lark provides highly-productive collaboration experience for optimal team efficiency and features like messenger, calendar, docs, mail, workplace, and more. In this how to guide, you will learn how to deploy the bot in Lark locally and integrate bot from the list of examples present in starter templete.

Deploy in Lark

Requirements#

  1. Your system must have Node.js installed (version >= 16).
  2. Your system must have Wechaty (version >= 0.40).
  3. You must be familiar with wechaty-puppet-lark.

Deployment#

Run wechaty-puppet-lark:

npm install wechaty-puppet-larkexport WECHATY_PUPPET=wechaty-puppet-larknpm 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-botcd my-bot
  1. Install the dependencies using the following commands:
npm install wechaty
  1. Add the dependencies for using the bot with Lark:
npm install wechaty-puppet-lark
  1. 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 */
  1. Obtain your functional permissions on Feishu platform from Feishu Open Platform-Application Permission.

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

export WECHATY_LOG=verboseexport WECHATY_PUPPET=wechaty-puppet-larknode src/my-bot.js

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

You can deploy the bot with popular container solutions as well such as:

References#

Blogs#