-
Notifications
You must be signed in to change notification settings - Fork 657
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rtm-api: add support for custom webClient #1696
Changes from 4 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -644,6 +644,30 @@ const rtm = new RTMClient(token, options); | |||||
|
||||||
--- | ||||||
|
||||||
### Custom WebClient | ||||||
|
||||||
In some cases, you might want flexibility with the WebClient construction beyond the provided RTMClient options | ||||||
|
||||||
```javascript | ||||||
const { RTMClient } = require('@slack/rtm-api'); | ||||||
const { WebClient, WebClientOptions } = require('@slack/web-api'); | ||||||
const token = process.env.SLACK_BOT_TOKEN; | ||||||
|
||||||
// Configure the client to have custom headers | ||||||
const options = { | ||||||
headers: { | ||||||
'Cookie': 'myCookie=cookieValue;' | ||||||
} | ||||||
} as WebClientOptions; | ||||||
|
||||||
const webClient = new WebClient(token, options); | ||||||
|
||||||
// Initialize a client using the configuration | ||||||
const rtm = new RTMClient(token, {webClient}); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
``` | ||||||
|
||||||
--- | ||||||
|
||||||
### Workspace state snapshot | ||||||
|
||||||
The client can receive a snapshot of a portion of the workspace's state while its connecting. This can be useful if your | ||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -15,6 +15,7 @@ slug: rtm-api | |||||
<th align="center">Name</th> | ||||||
<th align="center">Type</th> | ||||||
<th align="center">Required</th> | ||||||
<th align="center">Description</th> | ||||||
<th></th> | ||||||
</tr> | ||||||
</thead> | ||||||
|
@@ -31,6 +32,13 @@ slug: rtm-api | |||||
<td align="center">✗</td> | ||||||
<td></td> | ||||||
</tr> | ||||||
<tr> | ||||||
<td align="center">webClient</td> | ||||||
<td align="center"><code><a href="https://github.com/slackapi/node-slack-sdk/blob/main/docs/_reference/web-api.md#webclient" title="">WebClient</a></code></td> | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Link to hosted docs instead of github |
||||||
<td align="center">✗</td> | ||||||
<td align="center">An optional parameter to provide a customized <a href="https://github.com/slackapi/node-slack-sdk/blob/main/docs/_reference/web-api.md#webclient">WebClient</a>. Any desired options for the custom client must be set in this parameter (<code>webClient</code>) as they will take precedence over other arguments passed into <code>RTMClient</code>.</td> | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Link to hosted docs instead of github |
||||||
<td></td> | ||||||
</tr> | ||||||
</tbody> | ||||||
</table> | ||||||
<strong>Options:</strong> | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.