HowTo: Using flow designer to check feature flags and user profiles – Part 4

flow designer slack launchdarkly muleosft

This blog is the fourth and final part in a 4-part series on how to use a Slack bot to extract LaunchDarkly data. If you haven’t already, check out part one, part two, and part three of the series before pursuing the final steps of this demo.

In the final blog of the series, we will create flow designer custom types to easily manipulate data. When everything is in place, we will promote the application to a production environment.

Creating flow designer custom types

1. Go back to flow designer, open the Launch Darkly REST API card, and go to the output tab. You should see theLaunchDarkly (LD) response body as the image below.

launchdarky mulesoft 1

2. Click the Add button in the card header, this will open a modal to create a custom type. Name it LaunchDarklyResponse.

launchdarky mulesoft 2

3. Save it and close the card.

4. Add a Transform card at the end, after the Launch Darkly REST API card.

5. Click on the Create new data type button.

launchdarky mulesoft 3

This will open the modal to create a new custom type.

6. Name it BotResponseMessage and copy and paste the following JSON in the JSON example field.

At the end, it should look like the image below:

7. Save it.

8. Go to the script tab, then copy and paste the following script:

Slack formatting needs to create a JSON object with an attachment property containing a list of fields with the titles and values.

There are a number of functions available within DataWeave to support more complex mapping requirements like the pluck function used. See DataWeave documentation for more information.

9. Run the application.

10. Go back to Slack and trigger the integration by writing: /demo user-one

11. We will get the response with a nicer format like the image below.

launchdarky mulesoft 5

Note that also the command will be displayed.

Deploy your application to production

When we are done designing our project in flow designer, the next step is to deploy the application to a production environment.

1. In flow designer, click the Deploy button in the top navbar.

launchdarky mulesoft 6

2. Select Production as the target environment

3. Click Next and in the next screen click Deploy.

4. Check the new public URL after deploying. In order to point to that new environment, we must update the slash Request URL in Slack to point to this new permanent URL. Check part three step three.

5. Done! We have deployed our application to a production environment.

Conclusion

As mentioned in my earlier blog post, software development processes always involve ensuring that users have the correct permissions and visibility. This often requires constantly and, sometimes, manually, checking a user’s profile, including their flags and permissions.

This demo has demonstrated how you can use flow designer, along with LaunchDarkly and a Slack bot to easily retrieve information regarding a user and the permissions that they have. Why use flow designer instead of another tool? Flow designer is a great tool for this use case because:

  • Flow designer is already running in the cloud, so it is much easier for Slack (or any other cloud tool) to communicate with it.  
  • Flow designer is powered by Anypoint Platform, which enables you to have a unified experience when integrating data sources––from using API designer to write the RAML to use Anypoint Exchange to publish the asset.
  • Flow designer also allows you to implement the above integration use case, as well as others, in a quick manner. For example, this integration only takes about 30-60 minutes to complete.

Excited about flow designer? Learn more about it today and tell us what you think about the demo in the comments!


 


We'd love to hear your opinion on this post