You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
2. (Optional) If you are using [Defang BYOC](https://docs.defang.io/docs/concepts/defang-byoc) authenticate with your cloud provider account
11
+
3. (Optional for local development) [Docker CLI](https://docs.docker.com/engine/install/)
12
+
10
13
11
14
### Slack API Token
12
15
@@ -19,28 +22,55 @@ Make sure to:
19
22
- Copy the Bot User OAuth Access Token
20
23
- Invite your bot to the channel you want it to post to using the `@botname` command in the channel (this will allow you to invite it)
21
24
22
-
## Configure
23
25
24
-
Before deploying the Slackbot, you need to set up some config values. These config values are environment variables that the Slackbot needs to function correctly. The values are:
26
+
## Development
27
+
28
+
To run the application locally, you can use the following command:
25
29
26
-
-`SLACK_TOKEN`: This is the token you copied previously for the Slack API.
27
-
-`SLACK_CHANNEL_ID`: This is the ID of the Slack channel where the bot will post messages.
30
+
```bash
31
+
docker compose up --build
32
+
```
28
33
29
-
You can set these config parameters using the `defang config set` command. Here's how:
34
+
## Configuration
30
35
31
-
```sh
32
-
defang config set --name SLACK_TOKEN --value your_slack_token
33
-
defang config set --name SLACK_CHANNEL_ID --value your_slack_channel_id
36
+
For this sample, you will need to provide the following [configuration](https://docs.defang.io/docs/concepts/configuration):
37
+
38
+
> Note that if you are using the 1-click deploy option, you can set these values as secrets in your GitHub repository and the action will automatically deploy them for you.
39
+
40
+
### `SLACK_TOKEN`
41
+
This is the token you've copied previously for the Slack API.
42
+
```bash
43
+
defang config set SLACK_TOKEN
44
+
```
45
+
46
+
### `SLACK_CHANNEL_ID`
47
+
This is the ID of the Slack channel where the bot will post messages.
48
+
```bash
49
+
defang config set SLACK_CHANNEL_ID
34
50
```
35
51
36
-
## Deploy
52
+
## Deployment
37
53
38
-
If you have environment variables configured for your [own cloud account](https://docs.defang.io/docs/concepts/defang-byoc), this will deploy the application to your cloud account, otherwise it will deploy to the Defang playground.
Deploy your application to the Defang Playground by opening up your terminal and typing:
60
+
```bash
41
61
defang compose up
42
62
```
43
63
64
+
### BYOC (AWS)
65
+
66
+
If you want to deploy to your own cloud account, you can use Defang BYOC:
67
+
68
+
1.[Authenticate your AWS account](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html), and check that you have properly set your environment variables like `AWS_PROFILE`, `AWS_REGION`, `AWS_ACCESS_KEY_ID`, and `AWS_SECRET_ACCESS_KEY`.
69
+
2. Run in a terminal that has access to your AWS environment variables:
70
+
```bash
71
+
defang --provider=aws compose up
72
+
73
+
44
74
## Usage
45
75
46
76
Once the Slackbot is deployed, you can send a POST request to the `/` endpoint with a JSON body containing the message you want to post to the Slack channel. Here's an example:
0 commit comments