DEV Community

Cover image for Okta Workflows How-To: Retrieve Slack user status and other info using Custom API cards
Bryan Barrows for Okta Workflows

Posted on • Updated on

Okta Workflows How-To: Retrieve Slack user status and other info using Custom API cards

Okta Workflows includes an ever-growing library of connectable applications with pre-built actions and events that allow you to quickly automate business processes with ease.

However, there are times when we might know that an API that we're leveraging has a different endpoint or some other method by which we could extract additional necessary information.

These situations are what the Custom API Action cards included with each app connector are made for.


In this example, I've leveraged Slack - Custom API Cards to retrieve the full user profile as well as their status (active/away).

Flow Design - Get Slack User Status and Details

To accomplish this, we'll reference Slack's API docs to learn more about the /users.info and /users.getPresence methods.

A simple GET to those Relative URLs should do the trick...

  1. Use a Slack - Read User to get the Slack User ID.
  2. Use an Object - Construct with a key of user and input the Slack ID from the previous step. We'll use this query object in both of our Slack - Custom API cards to specify which user we want information about.
  3. Use two Slack - Custom API cards with a method of GET and the following Relative URLs:
    • /users.info
    • /users.getPresence
  4. Drag the object output from Step 2 into the "Query" input of each Custom API card.

And that's all there is to it! Looks like it worked:

Successful Flow Execution - Get Slack User Details and Status

Now you can use a pair of Object - Get Multiple cards to parse data out of each response body.

Notes

  • I've used Okta - User Added to Group for sake of example. You can substitute this to meet your needs. Just make sure to use the Slack - Read User to get the Slack User ID needed for the query object.
  • If you zoom in on my flow, you'll also notice that I built some error handling into my flow by putting my Custom API calls within an "If Error" card and building outputs in the case of a success as well as a failure. It's never a bad idea to build some error handling into your flows to make them more robust.

Feel free to download this example and import it to your environment:

Download steps:
  • right click "view raw" in the panel above on the right
  • click "Save Link As"
  • be sure the filename ends in .flow

Hope this helps! Find me on LinkedIn or shoot me an email if you have any questions.

You can also join us at a Community Office Hours session to work through problems and ask questions - I'd love to see you there.

Top comments (0)