This automation script is to sync our users between two platforms (i.e. Slack and Okta) by consuming thier REST API.
When someone new joins our slack channel we would like them to be also added into Okta to get access to our hashicorp vault and other platforms.
To perform test on individual services files to see what response we expect from the API. You can run the following command
pnpm install
- For requesting users from Slack
pnpm run fetchSlackUsers
- For requesting users from Okta
pnpm run fetchOktaUsers
Since
ts-node
is giving out too much of issue 1, 2 while trying to run it, we will be using tsx.
We need to consume 3 API's from okta to achieve our goals.
-
List all users https://developer.okta.com/docs/api/openapi/okta-management/management/tag/User/#tag/User/operation/listUsers
-
Create a user https://developer.okta.com/docs/api/openapi/okta-management/management/tag/User/#tag/User/operation/createUser
-
Delete a user https://developer.okta.com/docs/api/openapi/okta-management/management/tag/User/#tag/User/operation/deleteUser
Consume API users.list
- Since slack does not provide with only active users list, we have to filter out the result (bot users, deactived/deleted users)