Skip to content

Commit

Permalink
Creating a manifest.json file to install the bot (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcieltorres authored Feb 20, 2024
1 parent 5e089a4 commit d273f9c
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 19 deletions.
Binary file removed .docs/print_bot_working.png
Binary file not shown.
Binary file added .docs/print_bot_working_in_en_language.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .docs/print_bot_working_in_pt_br_language.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 25 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,32 @@

The SafeChat is a simple slack bot that analyzes messages sent on channels and warns about possible sensitive data from someone, such as a social security number, for example.

## How bot works on slack workspace
## How SafeChat works

![Bot working](.docs/print_bot_working.png)
*The SafeChat must be a member to receive messages from a channel or dm.*

### Portuguese version (pt-br)
![Bot working pt-br](.docs/print_bot_working_in_pt_br_language.png)

### English version
![Bot working en](.docs/print_bot_working_in_en_language.png)

## Installing on workspace

### Create a Slack App using manifest.json file

1. Open https://api.slack.com/apps/new and choose "From an app manifest"
2. Choose the workspace you want to install the application to
3. Copy the contents of manifest.json into the text box that says *Paste your manifest code here* (within the JSON tab) and click Next
4. Review the configuration and click Create
5. Click Install to Workspace and Allow on the screen that follows. You'll then be redirected to the App Configuration dashboard.

### SLACK_BOT_TOKEN and SLACK_APP_TOKEN variables

Before you can run the app, you'll need to store some environment variables.

1. Open your apps configuration page from this list, click OAuth & Permissions in the left hand menu, then copy the Bot User OAuth Token. You will store this in your environment as SLACK_BOT_TOKEN.
2. Click *Basic Information from the left hand menu and follow the steps in the App-Level Tokens section to create an app-level token with the connections:write scope. Copy this token. You will store this in your environment as SLACK_APP_TOKEN.

## Technology and Resources

Expand All @@ -16,25 +39,8 @@ The SafeChat is a simple slack bot that analyzes messages sent on channels and w
- [Slack Bolt](https://pypi.org/project/slack-bolt/)
- [i18n](https://docs.python.org/3/library/i18n.html)


*Please pay attention on **pre-requisites** resources that you must install/configure.*

## How to create and configure a new Slack Bot

You can find the official docs [here](https://api.slack.com/start/building/bolt-python).

This bot needs to have the following User Token Scopes added:
```
app_mentions:read
channels:history
channels:read
chat:write
im:history
im:read
```

Follow this [guide](https://api.slack.com/tutorials/tracks/getting-a-token) to generate the tokens.

## How to install, run and test

### Environment variables
Expand Down
48 changes: 48 additions & 0 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"_metadata": {
"major_version": 1,
"minor_version": 1
},
"display_information": {
"name": "SafeChat Slack Bot"
},
"features": {
"app_home": {
"home_tab_enabled": true,
"messages_tab_enabled": false,
"messages_tab_read_only_enabled": true
},
"bot_user": {
"display_name": "SafeChat",
"always_online": false
}
},
"oauth_config": {
"scopes": {
"bot": [
"app_mentions:read",
"channels:history",
"channels:read",
"chat:write",
"im:history",
"mpim:history",
"groups:history"
]
}
},
"settings": {
"event_subscriptions": {
"bot_events": [
"app_mention",
"message.channels",
"message.im"
]
},
"interactivity": {
"is_enabled": true
},
"org_deploy_enabled": false,
"socket_mode_enabled": true,
"token_rotation_enabled": false
}
}

0 comments on commit d273f9c

Please sign in to comment.