@nju33/slack
TypeScript icon, indicating that this package has built-in type declarations

1.7.5 • Public • Published

@nju33/slack

github npm:version ci:status document:typedoc license code style: prettier typescript

Install

yarn add @nju33/slack

Usage

import {useChat} from '@nju33/slack';

const {json, updateText, useAttachment} = useChat('postMessage', 'text');
updateText(text => `update-${text}`);
const {useTitle, useButton} = useAttachment('callback_id');
useTitle('title');
useButton('button name', 'button text', 'button value');

fetch(responseURL, {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json; charset=utf-8'
  },
  body: JSON.stringify(json()),
});
//
// {
//   title: 'update-text',
//   attachments: [
//     {
//       callback_id: 'callback_id',
//       title: 'title',
//       actions: [
//        {
//          type: 'button',
//          name: 'button name',
//          text: 'button text',
//          value: 'button value',
//        }
//      ],
//     },
//   ]
// }
//

Readme

Keywords

none

Package Sidebar

Install

npm i @nju33/slack

Weekly Downloads

2

Version

1.7.5

License

MIT

Unpacked Size

362 kB

Total Files

442

Last publish

Collaborators

  • nju33