1.0.0 • Published 6 years ago

dingding-lib v1.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
6 years ago

Related

钉钉机器人文档

Install

yarn add dingding-lib
or 
npm i dingding-lib

Usage

1, robot message

import { message, api } from 'dingding-lib';

// 1, text message
api.sendRobotMsg(
    yourAccessToken,
    new message.Text({ text: 'text' })
).then().catch()

// 2, link message
api.sendRobotMsg(
    yourAccessToken,
    new message.Link({ 
        title: 'title', 
        text: 'text', 
        messageUrl: 'http://z.cn', 
        picUrl: 'http://z.cn'
    })
).then().catch()

// 3, markdown message
api.sendRobotMsg(
    yourAccessToken,
    new message.Markdown({ 
        title: 'markdown', 
        text: '# markdown'
    })
).then().catch()

// 4, actionCard message
api.sendRobotMsg(
    yourAccessToken,
    new message.ActionCard({
        title: 'action',
        text: 'action',
        btns: [{ title: 'read more', actionUrl: 'http://z.cn' }] 
    })
).then().catch()

// 5, feedCard message
api.sendRobotMsg(
    yourAccessToken,
    new message.FeedCard({
        items: [
            {
                title: 'feed1',
                messageUrl: 'http://z.cn',
                picUrl: 'http://z.cn'
            }
        ]
    })
).then().catch()