> ## Documentation Index
> Fetch the complete documentation index at: https://docs.booper.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Daily standup in Discord

> Set up a daily standup prompt on weekdays in Discord

### Overview

We can set up a daily standup alert in 2 easy steps:

1. Get a [Discord webhook URL](https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks).
2. Use a [cron expression](https://crontab.guru/) to schedule a standup prompt to be sent to Discord every morning at 9am, Monday through Friday.

<Accordion title="Just show me the code">
  <CodeGroup>
    ```bash cURL theme={null}
    # This assumes your API key and webhook URL are set in the current env:
    # BOOPER_API_KEY=sk_...
    # DISCORD_WEBHOOK_URL=https://discord.com/api/webhooks/...

    curl --location --request POST 'https://scheduler.booper.dev/api/jobs' \
    --header "Content-Type: application/x-www-form-urlencoded" \
    --header "Authorization: Bearer $BOOPER_API_KEY" \
    --data-raw "method=post" \
    --data-raw "url=$DISCORD_WEBHOOK_URL" \
    --data-raw "body[content]=Time for standup! What are you working on today?" \
    --data-raw "cron=0 9 * * 1-5"
    ```

    ```bash CLI theme={null}
    # Assumes your webhook URL is set in the current env:
    # DISCORD_WEBHOOK_URL=https://discord.com/api/webhooks/...

    npx @booper/cli run \
      POST $DISCORD_WEBHOOK_URL \
      --data 'content=Time for standup! What are you working on today?' \
      --cron '0 9 * * 1-5'
    ```
  </CodeGroup>
</Accordion>

### Getting a Discord webhook URL

If you want to try this out but you don't have a [Discord](https://discord.com/) server, you can [set one up](https://support.discord.com/hc/en-us/articles/204849977-How-do-I-create-a-server-) easily for free.

If you already have a Discord server, [follow these instructions](https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks) to get your webhook URL.

If you want to test this out quickly using the [Booper public Discord server](https://discord.gg/pD7pnd2bUH), you can use this webhook URL:

```
https://discord.com/api/webhooks/1147917553176412232/A6_FKaVh2Bxme7uj5wDnh40k-cOedEswWaWve0PJZKzAnjzUoa-2PYyBKm9D7SXq1Cyk
```

To see it in action, run this in your terminal and then check the [#standup](https://discord.com/channels/1107053251498627222/1147917515075375144) channel.

```bash theme={null}
curl -X POST \
'https://discord.com/api/webhooks/1147917553176412232/A6_FKaVh2Bxme7uj5wDnh40k-cOedEswWaWve0PJZKzAnjzUoa-2PYyBKm9D7SXq1Cyk' \
--header "Content-Type: application/json" \
--data-raw '{"content": "Hello from the example page!"}'
```

### Scheduling your job

To set up your standup alert job on a recurring schedule, we're going to use the `cron` option. The `cron` field allows us to set a job on a schedule using a [cron expression](https://crontab.guru/).

For example, if we wanted the alert to occur every weekday (Monday through Friday) at 9am, we would use the following cron expression: [`0 9 * * 1-5`](https://crontab.guru/#0_9_*_*_1-5)

This expression says to run at the `0th minute` of the `9th hour` (i.e. `9:00am`) every `1st to 5th day of the week (Monday through Friday)`.

<Info>Note that cron expressions are set in the UTC timezone by default.</Info>

Assuming you have your `BOOPER_API_KEY` and `DISCORD_WEBHOOK_URL` set in your environment, you can run the script below in your terminal.

(Get your personal API key [here](https://www.booper.dev/api-keys), or use our [public API key](https://www.booper.dev/g/home) if you just want to test it out quickly.)

<CodeGroup>
  ```bash cURL theme={null}
  # This assumes your API key and webhook URL are set in the current env
  # BOOPER_API_KEY=sk_...
  # DISCORD_WEBHOOK_URL=https://discord.com/api/webhooks/...

  curl --location --request POST 'https://scheduler.booper.dev/api/jobs' \
  --header "Content-Type: application/x-www-form-urlencoded" \
  --header "Authorization: Bearer $BOOPER_API_KEY" \
  --data-raw "method=post" \
  --data-raw "url=$DISCORD_WEBHOOK_URL" \
  --data-raw "body[content]=Time for standup! What are you working on today?" \
  --data-raw "cron=0 9 * * 1-5"
  ```

  ```bash CLI theme={null}
  # Assumes your webhook URL is set in the current env:
  # DISCORD_WEBHOOK_URL=https://discord.com/api/webhooks/...

  npx @booper/cli run \
    POST $DISCORD_WEBHOOK_URL \
    --data 'content=Time for standup! What are you working on today?' \
    --cron '0 9 * * 1-5'
  ```
</CodeGroup>

If you're not using environment variables, you can run this script using the public API key and public Discord webhook URL from above:

<CodeGroup>
  ```bash cURL theme={null}
  curl --location --request POST 'https://scheduler.booper.dev/api/jobs' \
  --header "Content-Type: application/json" \
  --header "Authorization: Bearer sk_public_20230921" \
  --data-raw '{
      "method": "post",
      "url": "https://discord.com/api/webhooks/1147917553176412232/A6_FKaVh2Bxme7uj5wDnh40k-cOedEswWaWve0PJZKzAnjzUoa-2PYyBKm9D7SXq1Cyk",
      "body": {"content": "Time for standup! What are you working on today?"},
      "cron": "0 9 * * 1-5"
  }'
  ```

  ```bash CLI theme={null}
  npx @booper/cli run \
    POST https://discord.com/api/webhooks/1147917553176412232/A6_FKaVh2Bxme7uj5wDnh40k-cOedEswWaWve0PJZKzAnjzUoa-2PYyBKm9D7SXq1Cyk \
    --data 'content=Time for standup! What are you working on today?' \
    --cron '0 9 * * 1-5'
  ```
</CodeGroup>

(If you run the script above, you can check that it scheduled something on the [jobs page](https://www.booper.dev/g/jobs?q=2PYyBKm9D7SXq1Cyk) of the public dashboard.)

Feel free to adjust the `cron` expression to run more frequently (e.g. `*/5 * * * *` to run every 5 minutes) if you want to test that it's working without waiting until the next morning!
