# Integrate with a collaboration tool

Free Commit sends emails when a build fails, but you might want to send notifications on discord?

{% code title="cleanup.sh" lineNumbers="true" %}

```bash
#!/bin/bash

curl \
-X POST \
-H "Content-Type: application/json" \
-Ss "$(printenv DISCORD_WEBHOOK_URL)" \
--data "{\"content\": \":no_entry: Build $1 exit with code 143 (Deployment aborted by user)\"}"
```

{% endcode %}

{% code title="notify.sh" lineNumbers="true" %}

```bash
#!/bin/bash

handle_exit() {
    EXIT_CODE="$?"

    echo "Receiving EXIT..."

    if [ "$EXIT_CODE" = "0"  ]; then
        curl \
            -X POST \
            -H "Content-Type: application/json" \
            -Ss "$(printenv DISCORD_WEBHOOK_URL)" \
            --data "{\"content\": \":ok: Build $1 exit with code $EXIT_CODE\"}"
    else
        curl \
            -X POST \
            -H "Content-Type: application/json" \
            -Ss "$(printenv DISCORD_WEBHOOK_URL)" \
            --data "{\"content\": \":no_entry: Build $1 exit with code $EXIT_CODE\"}"
    fi

    exit $EXIT_CODE
}

trap "handle_exit $1" EXIT
```

{% endcode %}

{% code title="deploy.yaml" lineNumbers="true" %}

```yaml
version: '1.0'
from: 'romainlavabrefairfair/deploy-react'

steps:
    -   name: "@cleanup"
        script: cleanup.sh gui-dev

    -   name: '@notify'
        script: notify.sh gui-dev

    -   name: '@init-wrangler'
        script: init-wrangler.sh DEV

    -   name: '@install'
        script: npm-ci.sh

    -   name: '@build-dev1'
        script: build.sh dev

    -   name: '@push-dev1'
        script: push.sh dev

```

{% endcode %}

And that's it, now send you the exit codes on discord. Do you also want to send the logs?

This time you must use chaining and retrieve the result of your last build
