Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dizys/lark-js-sdk
Third-party JavaScript Lark (Feishu, 飞书) SDK written in TypeScript
https://github.com/dizys/lark-js-sdk
client feishu javascript lark sdk typescript
Last synced: about 2 months ago
JSON representation
Third-party JavaScript Lark (Feishu, 飞书) SDK written in TypeScript
- Host: GitHub
- URL: https://github.com/dizys/lark-js-sdk
- Owner: dizys
- License: mit
- Created: 2020-07-24T15:00:03.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-04-21T03:58:33.000Z (over 1 year ago)
- Last Synced: 2024-10-30T21:37:56.488Z (about 2 months ago)
- Topics: client, feishu, javascript, lark, sdk, typescript
- Language: TypeScript
- Homepage:
- Size: 57.6 KB
- Stars: 6
- Watchers: 1
- Forks: 4
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![npm](https://img.shields.io/npm/v/lark-js-sdk?style=flat)](https://www.npmjs.com/package/lark-js-sdk)
# lark-js-sdk
Third-party JavaScript Lark (Feishu, 飞书) SDK written in TypeScript
## Installation
```bash
npm install --save lark-js-sdk
```## Quick Start
Send message to groups that the bot is in:
```js
import {Lark} from 'lark-js-sdk';async function sendMessage() {
let lark = new Lark('', '');let {groups} = await lark.bot.group.getList();
let chatIds = groups.map(group => group.chat_id);
for (let chatId of chatIds) {
let {message_id} = await lark.message.send({
chat_id: chatId,
msg_type: 'text',
content: {text: 'Hello, Lark!'},
});console.log(`Message (${message_id}) sent!`);
}
}sendMessage();
```Add user
```js
import {Lark} from 'lark-js-sdk';let lark = new Lark('', '');
lark.contact.user
.add({
name: 'Dizy',
mobile: '18900000000',
department_ids: ['od-234355343342acdbef33'],
need_send_notification: true,
})
.then(data => {
let {user_info} = data;console.log('User added:', user_info);
});
```Use Feishu API Endpoint instead:
```js
import {Feishu, Lark} from 'lark-js-sdk';let feishu = new Feishu('', '');
// or
let feishu = new Lark(
'',
'',
'https://open.feishu.cn/open-apis/',
);// Feishu has the same apis as Lark...
```## License
MIT, see the [LICENSE](/LICENSE) file for details.