A slack app that can be used to munge slack profiles so they show up specific ways in our partner channels. For now "certain ways" means with the users' company names appended to their profile names.
- Slack workspaces can be set up to use "display names" or "full names" for members. The Partner workspace is set to use full names. This will need to be changed to "display name." This makes more sense: that we will be editing display names instead of messing with users' real names.
- Add more events (user join... others?)
-
Follow the steps for installing slacks apps, found here: https://api.slack.com/apps. You will need to use a "user token" for now. When slack stabilizes workspace tokens in the future they would be the way to go. The user who installs the app needs to be at a higher security level than the users they will be editing.
-
On "OAuth & Permissions", add the
users.profile:write
andusers:read.email
scopes. -
Enable event subscriptions, subscribe to the
user_change
event. Enter the base URL for this app as the Request URL (e.g., https://profile-monger.cfapps.io/). -
Edit the manifest to include your slack oauth and validation tokens
-
Build and push the app to a PCF that has a legit non-self-signed cert or slack will reject it (PWS is a good choice). Currently it is running here:
api endpoint: https://api.run.pivotal.io
api version: 2.116.0
user: jgordon@pivotal.io
org: platform-eng
space: jgordon
profile-monger started 1/1 1G 1G profile-monger.cfapps.io
Tests are ignored. To run them, add your tokens to the test application.properties file, and remove the @ignore tags on the tests.
Once deployed the app will watch for profile updates in the workplace where it is installed. If a profile is updated it will check the user's display name and update it as configured by the application.
browse to https://profile-monger.cfapps.io/suggestions?token=verifcation_token
- pull down and save the suggested names
curl 'https://profile-monger.cfapps.io/suggestions?token=verifcation_token' > names.json
-
review the names, looks good?
-
if so post the list
curl -d "@names.json" -H "Content-Type: application/json" -X POST 'https://profile-monger.cfapps.io/bulkUpdate?token=your-token&name_source=suggestedDisplayName' > results.json
-
review the results
-
no good? to rollback:
curl -d "@names.json" -H "Content-Type: application/json" -X POST 'https://profile-monger.cfapps.io/bulkUpdate?token=your-token&name_source=display_name' > results.json