- 🚀 Quickstart
- 🧑💻 OAuth app setup
- 🔗 Useful links
- 🚨 API gotchas
Create an integration
In Nango (free signup), go to Integrations -> Configure New Integration -> Slack.
Authorize Slack
Go to Connections -> Add Test Connection -> Authorize, then log in to Slack. Later, you’ll let your users do the same directly from your app.
Call the Slack API
Let’s make your first request to the Slack API (fetch a list of channels in a Slack team). Replace the placeholders below with your secret key, integration ID, and connection ID:Or fetch credentials dynamically via the Node SDK or API.
- cURL
- Node
Copy
Ask AI
curl "https://api.nango.dev/proxy/conversations.list?limit=10" \
-H "Authorization: Bearer <NANGO-SECRET-KEY>" \
-H "Provider-Config-Key: <INTEGRATION-ID>" \
-H "Connection-Id: <CONNECTION-ID>"
Install Nango’s backend SDK with
npm i @nangohq/node. Then run:Copy
Ask AI
import { Nango } from '@nangohq/node';
const nango = new Nango({ secretKey: '<NANGO-SECRET-KEY>' });
const res = await nango.get({
endpoint: '/conversations.list',
params: { limit: 10 },
providerConfigKey: '<INTEGRATION-ID>',
connectionId: '<CONNECTION-ID>'
});
console.log(res.data);
Next step: Embed the auth flow in your app to let your users connect their Slack accounts.
Create a developer account
Go to Slack Developer Program signup page and click Join the Program.
Create & configure a Slack app
- Click on the Your Apps button then Create New App.
- Choose how you’d like to configure your app’s scopes and settings. You can use a manifest file or start from scratch; for a simpler flow, select From scratch.
- Add your App name and select a workspace to develop your app in, then click Create App.
- In the Basic Information tab, copy your app’s
Client IDandClient Secret, as you’ll need them when configuring your integration in Nango.
Set up the OAuth scopes
- In the left sidebar, select the OAuth & Permissions tab and configure the following Redirect URL:
https://api.nango.dev/oauth/callback. - Still in the OAuth & Permissions tab, under Scopes, add the scopes that are relevant to how you want to consume Slack’s API. There are 2 types of scopes, Bot Token Scopes and User Token Scopes.
- Bot tokens represent a bot associated with an app installed in a workspace. They govern what your app can access. They will be added to Nango when creating a Slack integration.
- User token Scopes access user data and act on behalf of users that authorize them. They will be added to Nango when creating a Slack connection.
Create a Slack Developer Sandbox (Optional)
If you don’t have a Slack Developer Sandbox already, head over to Slack’s Developer Program dashboard and provision one to test your integration.
Next
Follow the Quickstart.
Contribute useful links by editing this page
Bot Token vs User Token
Slack issues two separate access tokens during OAuth:- Bot Token (starts with
xoxb-): Used for actions performed by your app’s bot - User Token (starts with
xoxp-): Used for actions performed on behalf of the authorizing user
When You Need the User Token
Some Slack API endpoints require user-scoped permissions and will only accept user tokens (e.g., certain user profile operations). If you try to call these endpoints with the bot token, Slack will reject the request.How to Use the User Token
- Fetch the raw connection to get the user token:
Copy
Ask AI
import { Nango } from '@nangohq/node';
const nango = new Nango({ secretKey: '<NANGO-SECRET-KEY>' });
// Fetch the connection with raw credentials
const connection = await nango.getConnection(
'<INTEGRATION-ID>',
'<CONNECTION-ID>'
);
// The user token is in the raw response
const userToken = connection.credentials.raw.authed_user?.access_token;
- Override the authorization header when making proxy calls:
Copy
Ask AI
// Use the user token by overriding the auth header
const response = await nango.get({
endpoint: '/users.profile.get',
providerConfigKey: '<INTEGRATION-ID>',
connectionId: '<CONNECTION-ID>',
headers: {
'nango-proxy-authorization': `Bearer ${userToken}`
}
});
When Creating Connections in Nango
If you need user tokens for your integration, you can specify user scopes when creating a connect session:Copy
Ask AI
const { data } = await nango.createConnectSession({
end_user_id: '<END-USER-ID>',
integrations_config_defaults: {
"slack": {
user_scopes: "users.profile:read, chat:write"
}
}
});
Contribute API gotchas by editing this page
Questions? Join us in the Slack community.