Retrieve Slack Team Authorization Tokens via API
Flow XO provides an HTTP API endpoint that you can use to retrieve information about team authorizations for your slack bots.
Authorization
You must authorize all calls to the Flow XO API using an Authorization header in your HTTP request. The Flow XO API uses 'bearer token' authorization, so you will need to precede your API key with the word 'Bearer', like so:
Authorization: Bearer yOuRApIKeyGoEsHeRe
Note that if you are using Postman, and you use the Bearer Token feature, you will not need to manually add the word 'Bearer' as postman will do that for you: https://learning.postman.com/docs/sending-requests/authorization/#bearer-token
API Url
To use the Flow XO API, you will need to send HTTP requests to the following endpoint. The last part of the URL will depend on the method you are calling, but the base address is:
https://flowxo.com/api/slack
Teams
Listing teams
You can retrieve a list of teams who have authorized your bot
GET https://flowxo.com/api/slack/teamsThe result will look like this:
[ { "_id": "xxxx", "name": "Bot", "account": "T014ARZTBQS" }, { "_id": "yyy", "name": "Another Bot", "account": "T019ARRTBQS" }, { "_id": "zzz", "name": "Another Bot", "account": "T020ZRZRBQM" } ]Here's what the request would be using cURL:
curl --location --request GET 'https://flowxo.com/api/slack/teams' \ --header 'Authorization: Bearer YOURAPIKEY'
Retrieving metadata about a team (including the authorization token you can use to access the Slack API on behalf of the team)
Once you have the "account" code of the team you want to get more information on, you can get full information about the authorization for that team.
API Url:PUT https://api.flowxo.com/api/teams/{teamId}
Getting team data using cURL
curl --location --request GET 'https://flowxo.com/api/slack/teams/T019ARRTBQS' \ --header 'Authorization: Bearer YOURAPIKEY'
This will return a result that looks like this
{ "id": "xxx", "name": "My Bot Name", "account": "T019ARRTBQS", "credentials": { "is_enterprise_install": false, "enterprise": null, "team": { "name": "SlackTeamName", "id": "T019ARRTBQS" }, "bot_user_id": "U01ZRHAD32", "access_token": "xoxb-23423423-23423423-ghasdfasdafdYDFWYLI", "token_type": "bot", "scope": "channels:history,channels:read,chat:write,commands,groups:history,groups:read,im:history,im:read,im:write,mpim:history,mpim:read,mpim:write,pins:write,reactions:read,reactions:write,remote_files:read,team:read,users:read,users:read.email,users:write", "authed_user": { "id": "U01ZRHAD32" }, "app_id": "A0145SDA32Z", "ok": true } }