Skip to content

A full implementation example of Nango

Notifications You must be signed in to change notification settings

NangoHQ/sample-app

Repository files navigation

Nango Sample App

This repository provides a practical demonstration of integrating Nango into your codebase. It includes Syncs scripts, a backend API for managing Nango's webhooks, and a straightforward frontend for user interaction and data retrieval.

Example App

Highlights

  • Folder back-end To integrate with Nango you need a backend that will listen to Nango’s webhooks and interact with our API.

  • Folder front-end Finally to let your user connect to your integration you need a frontend and call to our auth library.

  • Folder nango-integrations Optional To use Nango you need some scripts to manipulate the data. We provide templates for most providers but you can also use custom scripts. This folder, setup with our CLI, contains the scripts that will fetch your users’ data.


Launching locally

To use this demo you will need:

Step 1: Create an account

  • Go to nango.dev
  • Create an account, it's free!

Step 2: Create a Slack integration

  • Go to Integrations Page
  • Create an integration > Slack
  • Then go to Slack Dev Center
  • Create a Slack OAuth app with Bot Token Scopes
    • users:read
    • chat:write
  • Go back to Nango:
    • Add credentials in the integration
    • Activate endpoint GET /users
    • Activate endpoint POST /send-message

Step 3: Prepare your env

Install: NodeJS, Docker

git clone https://github.com/NangoHQ/sample-app.git

cd sample-app

nvm use
npm i

Step 4: Copy secrets

cp .env.example .env

Step 5: Transfer Webhooks locally

  • This command should be running at all time
npm run webhooks-proxy
  • Copy the URL the command gave you
  • Go to Environment Settings
  • Set Webhook URL to
    • ${URL}/webhooks-from-nango, e.g: https://tame-socks-warn.loca.lt/webhooks-from-nango

Note

If that doesn't work, you can use ngrok

Step 6: Launch

npm run start

Go to: https://localhost:3000


Step Bonus: Deploy custom scripts

This demo use templates by default, but you can also use custom scripts

# Setup nango
npm install -g nango
cd nango-integrations/
nango init

# Add your Nango Secret Key in NANGO_SECRET_KEY_PROD
code .env

# Change and deploy
nango deploy prod