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).
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...
- Use a
Slack - Read User
to get the Slack User ID. - Use an
Object - Construct
with a key ofuser
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. - Use two
Slack - Custom API
cards with a method ofGET
and the following Relative URLs:/users.info
/users.getPresence
- 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:
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 theSlack - 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:
- 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)