Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
jordotech committed Jul 12, 2023
1 parent 699fa0d commit bacc2e8
Showing 1 changed file with 30 additions and 7 deletions.
37 changes: 30 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,41 @@
# FastAPI + Slack
# FastAPI + Slack + Docker

Super simple docker image you can use to send messages from all your apps to your slack.
Dead simple docker image you can use to send messages from all your apps to your slack.

## Docker
## Demo

You can pull and run the docker image, just supply your `SLACK_BOT_TOKEN` as an env var
#### 1. Join the sandbox slack workspace

I've created a sandbox slack workspace (`slackbot-sandbox-e0f8`) for anyone to test, click or copy/paste this invite link to join the workspace:
[https://join.slack.com/t/newworkspace-yfo6489/shared_invite/zt-1zctp22u8-biUNZJvgGPLFBraJRP8v2A](https://join.slack.com/t/newworkspace-yfo6489/shared_invite/zt-1zctp22u8-biUNZJvgGPLFBraJRP8v2A)

Then view the `#testing` channel: [https://app.slack.com/client/T05HDNQB99N/C05GSFEN2N8](https://app.slack.com/client/T05HDNQB99N/C05GSFEN2N8)

#### 2. Start the docker image with the provided token

(The token `xoxb-5591772383328-5565297345781-nJVVXl8frk6rV59yOHUkjyai` is available for testing purposes)

## Run locally

```shell
docker run --rm -e SLACK_BOT_TOKEN=<your_token> --name slackbot -p 7171:80 jordotech/fastapi-slackbot:latest
docker run --rm -e SLACK_BOT_TOKEN=xoxb-5591772383328-5565297345781-nJVVXl8frk6rV59yOHUkjyai --name slackbot -p 7171:80 jordotech/fastapi-slackbot:latest
```

#### 3. Send a notification

```
curl --location 'http://localhost:7171/send-message' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data '{
"channel": "#testing",
"text": "Hello, World!"
}'
```

## Local Docker Compose
Your message should appear in the `#testing` channel in slack.


## Run Locally with Docker Compose
1. Clone this repo
2. Create a `.env` file in the project root with `SLACK_BOT_TOKEN=<your_token>`
3. Run `docker compose up -d`
Expand Down

0 comments on commit bacc2e8

Please sign in to comment.