0ahz / msgkit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

msgkit 🚧

WIP

Install

pnpm i msgkit

Usage

Pushover

https://pushover.net/api

import { Pushover } from 'msgkit'
// or
import { Pushover } from 'msgkit/pushover'

await Pushover.send({
  user: 'xxx',
  token: 'xxx',
  title: 'Here is the message title',
  message: 'Here is the message content, which can be a bit long.',
  // other options
})

// or

const po = new Pushover({ user: 'xxx', token: 'xxx' })

await po.send({
  message: 'Here is the message content, which can be a bit long.',
  title: 'Here is the message title',
  // other options
})

Bark

https://bark.day.app/#/tutorial

import { Bark } from 'msgkit'
// or
import { Bark } from 'msgkit/bark'

// token=xxx
// or url
// token=https://api.day.app/xxx

await Bark.send({
  token: 'xxx',
  title: 'Here is the message title',
  body: 'Here is the message content, which can be a bit long.',
  // other options
})

// or

const bark = new Bark({ token: 'xxx' })

await bark.send({
  title: 'Here is the message title',
  body: 'Here is the message content, which can be a bit long.',
  // other options
})

Wecom webhook

https://developer.work.weixin.qq.com/document/path/91770

import { WecomWebhook } from 'msgkit'
// or
import { WecomWebhook } from 'msgkit/wecom'

// token=xxx
// or url
// token=https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=xxx

await WecomWebhook.send({
  token: 'xxx',
  type: 'text',
  message: {
    content: 'Here is the message content, which can be a bit long.',
  },
})

// or

const hook = new WecomWebhook({ token: 'xxx' })

await hook.send({
  type: 'text',
  message: {
    content: 'Here is the message content, which can be a bit long.',
  },
})

Feishu webhook

https://open.feishu.cn/document/client-docs/bot-v3/add-custom-bot

import { FeishuWebhook } from 'msgkit'
// or
import { FeishuWebhook } from 'msgkit/feishu'

// token=xxx
// or url
// token=https://open.feishu.cn/open-apis/bot/v2/hook/xxx

await FeishuWebhook.send({
  token: 'xxx',
  type: 'text',
  message: {
    text: 'Here is the message content, which can be a bit long.',
  },
})

// or

const hook = new FeishuWebhook({ token: 'xxx' })

await hook.send({
  type: 'text',
  message: {
    text: 'Here is the message content, which can be a bit long.',
  },
})

Dingtalk webhook

https://open.dingtalk.com/document/robots/custom-robot-access

import { DingWebhook } from 'msgkit'
// or
import { DingWebhook } from 'msgkit/ding'

// token=xxx
// or url
// token=https://oapi.dingtalk.com/robot/send?access_token=xxx

await DingWebhook.send({
  token: 'xxx',
  type: 'text',
  message: {
    content: 'Here is the message content, which can be a bit long.',
  },
})

// or

const hook = new DingWebhook({ token: 'xxx' })

await hook.send({
  type: 'text',
  message: {
    content: 'Here is the message content, which can be a bit long.',
  },
})

License

MIT © 0ahz

About

License:MIT License


Languages

Language:TypeScript 95.8%Language:JavaScript 3.7%Language:Shell 0.5%