Skip to content
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

Correct Socket Mode package README #1193

Merged
merged 1 commit into from
Mar 24, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 8 additions & 3 deletions packages/socket-mode/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ After your client establishes a connection, your app can send data to and receiv
const { SocketModeClient } = require('@slack/socket-mode');
const appToken = process.env.SLACK_APP_TOKEN;

const socketModeClient = new SocketModeClient(appToken);
const socketModeClient = new SocketModeClient({appToken});

(async () => {
// Connect to Slack
Expand All @@ -72,7 +72,7 @@ event](https://api.slack.com/events) it's registered for.
const { SocketModeClient } = require('@slack/socket-mode');
const appToken = process.env.SLACK_APP_TOKEN;

const socketModeClient = new SocketModeClient(appToken);
const socketModeClient = new SocketModeClient({appToken});

// Attach listeners to events by type. See: https://api.slack.com/events/message
socketModeClient.on('message', (event) => {
Expand Down Expand Up @@ -127,6 +127,10 @@ socketModeClient.on('member_joined_channel', async ({event, body, ack}) => {
console.log('An error occurred', error);
}
});

(async () => {
await socketModeClient.start();
})();
```
---

Expand Down Expand Up @@ -200,7 +204,8 @@ A very simple custom logger might ignore the name and level, and write all messa
const { createWriteStream } = require('fs');
const logWritable = createWriteStream('/var/my_log_file'); // Not shown: close this stream

const socketModeClient = new SocketModeClient(appToken, {
const socketModeClient = new SocketModeClient({
appToken,
// Creating a logger as a literal object. It's more likely that you'd create a class.
logger: {
debug(...msgs): { logWritable.write('debug: ' + JSON.stringify(msgs)); },
Expand Down