Skip to content

Commit

Permalink
Local testing notes and start user join event handling
Browse files Browse the repository at this point in the history
  • Loading branch information
BenAlderfer committed May 29, 2020
1 parent 71e8cd5 commit 4410aad
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,6 @@ jspm_packages
.npmrc
.yarnrc

# local testing
.env
ngrok*
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,9 @@ Create a `.env` file and populate it with
SLACK_SIGNING_SECRET=<>
SLACK_BOT_TOKEN=<>
```

You'll want to create a personal slack workspace to do your testing in. In addition, install [ngrok](https://ngrok.com/) or something similar to send requests to your local environment.

[Local development with ngrok](https://api.slack.com/tutorials/tunneling-with-ngrok)

Start ngrok: `./ngrok http 3000`
6 changes: 6 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ const app = new App({
console.log(`SSEBot started at ${new Date().toUTCString()} (UTC)`);
})();

// when a new user joins
app.event('team_join', async ({ event, context }) => {
// @ts-ignore
console.log(`new person joined: ${event.user.id}`);
});

// for @bot messages
app.event('app_mention', async ({ event, context }) => {
try {
Expand Down

0 comments on commit 4410aad

Please sign in to comment.