messaging-api-slack
Advanced tools
Comparing version 0.3.3 to 0.3.4
{ | ||
"name": "messaging-api-slack", | ||
"description": "Messaging API client for Slack", | ||
"version": "0.3.3", | ||
"version": "0.3.4", | ||
"engines": { | ||
@@ -6,0 +6,0 @@ "node": ">=6" |
@@ -59,11 +59,8 @@ # messaging-api-slack | ||
###### method | ||
Param | Type | Description | ||
------ | -------- | ----------- | ||
method | `String` | One of <code>`chat.postMessage` | `channels.info` | `channels.list` | `users.info` | `users.list`</code> | ||
body | `Object` | Body that the method needs. | ||
Type: `String` | ||
Value: One of `chat.postMessage | 'channels.info' | 'channels.list' | 'users.info' | 'users.list` | ||
###### body | ||
Type: `Object` | ||
Example: | ||
```js | ||
@@ -77,22 +74,13 @@ client.callMethod('chat.postMessage', { channel: 'C8763', text: 'Hello!' }); | ||
## `postMessage(channel, text, options?)` - [Official docs](https://api.slack.com/methods/chat.postMessage) | ||
## `postMessage(channel, text [, options])` - [Official docs](https://api.slack.com/methods/chat.postMessage) | ||
Sends a message to a channel. | ||
###### channel | ||
Param | Type | Description | ||
------- | -------- | ----------- | ||
channel | `String` | Channel, private group, or IM channel to send message to. Can be an encoded ID, or a name. | ||
text | `String` | Text of the message to be sent. | ||
options | `Object` | Other optional parameters. | ||
Type: `String` | ||
###### text | ||
Type: `String` | ||
###### options | ||
Type: `Object` | ||
###### options.as_user | ||
Type: `Boolean` | ||
Example: | ||
```js | ||
@@ -111,6 +99,7 @@ client.postMessage('C8763', 'Hello!'); | ||
###### cursor | ||
Param | Type | Description | ||
------ | -------- | ----------- | ||
cursor | `String` | Paginate through collections of data by setting the `cursor` parameter to a `next_cursor` attribute returned by a previous request's `response_metadata`. | ||
Type: `String` | ||
Example: | ||
```js | ||
@@ -135,2 +124,3 @@ client.getUserList(cursor).then(res => { | ||
Example: | ||
```js | ||
@@ -152,6 +142,7 @@ client.getAllUserList().then(res => { | ||
###### userId | ||
Param | Type | Description | ||
------ | -------- | ----------- | ||
userId | `String` | User to get info on. | ||
Type: `String` | ||
Example: | ||
```js | ||
@@ -176,2 +167,3 @@ client.getUserInfo(userId).then(res => { | ||
Example: | ||
```js | ||
@@ -191,6 +183,7 @@ client.getChannelList().then(res => { | ||
###### channelId | ||
Param | Type | Description | ||
--------- | -------- | ----------- | ||
channelId | `String` | Channel to get info on. | ||
Type: `String` | ||
Example: | ||
```js | ||
@@ -211,3 +204,3 @@ client.getChannelInfo(channelId).then(res => { | ||
### Usage | ||
## Usage | ||
@@ -228,3 +221,3 @@ Get your webhook url by adding a [Incoming Webhooks](https://api.slack.com/incoming-webhooks) integreation to your team or setup Incoming Webhooks function to your app. | ||
### API Reference | ||
## API Reference | ||
@@ -235,10 +228,11 @@ All methods return a Promise. | ||
#### Send API - [Official docs](https://api.slack.com/docs/messages) | ||
### Send API - [Official docs](https://api.slack.com/docs/messages) | ||
## `sendRawBody(body)` | ||
###### body | ||
Param | Type | Description | ||
----- | -------- | ----------- | ||
body | `Object` | Raw data to be sent. | ||
Type: `Object` | ||
Example: | ||
```js | ||
@@ -252,6 +246,7 @@ client.sendRawBody({ text: 'Hello!' }); | ||
###### text | ||
Param | Type | Description | ||
----- | -------- | ----------- | ||
text | `String` | Text of the message to be sent. | ||
Type: `String` | ||
Example: | ||
```js | ||
@@ -265,6 +260,9 @@ client.sendText('Hello!'); | ||
###### attachments | ||
Send multiple attachments which let you add more context to a message. | ||
Type: `Array<Object>` | ||
Param | Type | Description | ||
----------- | --------------- | ----------- | ||
attachments | `Array<Object>` | Messages are attachments, defined as an array. Each object contains the parameters to customize the appearance of a message attachment. | ||
Example: | ||
```js | ||
@@ -303,6 +301,9 @@ client.sendAttachments([ | ||
###### attachment | ||
Send only one attachment. | ||
Type: `Object` | ||
Param | Type | Description | ||
----------- | -------- | ----------- | ||
attachments | `Object` | Message is an attachment. The object contains the parameters to customize the appearance of a message attachment. | ||
Example: | ||
```js | ||
@@ -309,0 +310,0 @@ client.sendAttachment({ |
38000
310