title | sidebarTitle | description |
---|---|---|
Sample application |
Sample app |
Learn how to integrate Nango using our sample application. |
The sample app is a practical demonstration of integrating Nango in your codebase. It contains:
- A frontend: lets users connect an integration using the Nango frontend SDK.
- A backend: listens to Nango webhooks and consumes the Nango API to read & write data.
The sample app uses Slack as an example integration and is showcased in this demo video.
NangoHQ/sample-app
- Go to [nango.dev](https://app.nango.dev?source=sample-app) and create an account (free).
- Go to [Integrations](https://app.nango.dev/dev/integrations?source=sample-app) ans create a Slack integration.
- Go to [Slack Dev Center](https://api.slack.com/apps) and create a Slack OAuth app with **Bot Token Scopes**:
- `users:read`
- `chat:write`
- Go back to Nango. In the "Authorization" tab, add credentials in the Slack integration in the `Authorization` tab. In the "Endpoints" tab, activate endpoint `GET /users` and `POST /send-message`.
- Install: `NodeJS`, `Docker`. Then run:
```sh
git clone https://github.com/NangoHQ/sample-app.git
cd sample-app
nvm use
npm i
```
- Copy your Nango Secret Key, found in [Environment Settings](https://app.nango.dev/dev/environment-settings?source=sample-app).
- Create a file to store environment variables and fill in the Nango Secret Key:
```sh
cp .env.example .env
```
```sh
npm run webhooks-proxy
```
- Copy the URL the command gave you and go to [Environment Settings](https://app.nango.dev/dev/environment-settings?source=sample-app). Set Webhook URL to `${URL}/webhooks-from-nango`, e.g: `https://tame-socks-warn.loca.lt/webhooks-from-nango`.
- Set up the Nango CLI:
```sh
npm install -g nango
cd nango-integrations/
nango init
```
- Add your Nango Secret Key in NANGO_SECRET_KEY_PROD in `./nango-integrations/.env`.
- Optionalyl customize the integration using this [guide](/guides/customize/create-a-custom-integration).
- Deploy the custom integration:
```sh
nango deploy prod
```