Connectors / Service / LaunchDarkly

LaunchDarkly (updated: 1657717872466)

LaunchDarkly

LaunchDarkly provides simple, scalable feature flag & toggle management (feature management) for the modern enterprise.

Overview

LaunchDarkly enables development and operations teams to deploy code at any time, even if a feature isn't ready to be released to users. Wrapping code with feature flags gives you the safety to test new features and infrastructure in your production environments, without impacting the wrong end users.

Authentication

When using the LaunchDarkly connector, the first thing you will need to do is go to your Tray.io account page, and select the workflow you wish to work on. Once in the workflow builder itself, search and drag the LaunchDarkly connector from the connectors panel (on the left hand side) onto your workflow.

With the new LaunchDarkly connector step highlighted, in the properties panel on the right, click on the Authenticate tab and 'Add new authentication' (located under the 'Authentication' field).

launchdarkly-auth

This will result in a Tray.io authentication popup window. The first page will ask you to name your authentication, and state which type of authentication you wish to create ('Personal' or 'Organisational').

launchdarkly-popup-first

As you can see, the next page asks you for your 'Personal access token'.

launchdarkly-popup-second

In order to get these fields, head to your LaunchDarkly dashboard. Navigate to "Account settings" > "Authorization". Here, you will find a section of the page called "Access Tokens". To create a new token to use with Tray.io, click on the "+ Token" button highlighted in the screenshot below.

launchdarkly-auth-step-1

A sidebar menu will appear that will allow you to set up some options for your token. Suggestions for how to populate these fields can be found below:

  • Name: Any value (Suggestion: tray-io)

  • Role: "Reader" or "Writer" (Whatever is required for your integration)

  • API Version: Must be "20191212" (This is the version used by the current LaunchDarkly connector on Tray.io)

When you are ready to create your token, click on the "Save Token" button.

launchdarkly-auth-step-2

You will then be redirected back to the authorizations page where you will be presented with an opportunity to copy your newly generated token from the section highlighted in the screenshot below.

IMPORTANT!: The generated token will only be displayed once, so you must copy the token before navigating away from this page.

launchdarkly-auth-step-3

After you have copied the token, you can return to the Tray.io authentication popup window and fill in the "Personal access token" field.

Once you have added this field to your Tray.io authentication popup window, click on the 'Create authentication' button. Go back to your settings authentication field (within the workflow builder properties panel), and select the recently added authentication from the dropdown options now available.

launchdarkly-popup-third

Your connector authentication setup should now be complete.

Available Operations

The examples below show one or two of the available connector operations in use.

Please see the Full Operations Reference at the end of this page for details on all available operations for this connector.

REMOVE 'Note on Operations usage' if not applicable.

Using the Raw HTTP Request ('Universal Operation')

As of version 1.0, you can effectively create your own operations.

This is a very powerful feature which you can put to use when there is an endpoint in LaunchDarkly which is not used by any of our operations.

To use this you will first of all need to research the endpoint in the LaunchDarkly API documentation v2.0 , to find the exact format that LaunchDarkly will be expecting the endpoint to be passed in.

Note that you will only need to add the suffix to the endpoint, as the base URL will be automatically set (the base URL is picked up from the value you entered when you created your authentication).

The base URL for LaunchDarkly is: https://app.launchdarkly.com/api/v2

For example, say that the 'Get project' operation did not exist in our LaunchDarkly connector, and you wanted to use this endpoint, you would use the LaunchDarkly API docs to find the relevant endpoint - which in this case (for example, a project with a project key of 123456) is a GET request called: /projects/123456.

More details can be found here.

launchdarkly-api-docs

As you can see, the endpoint that we need to call in this case is the project key that we wish to retrieve data for. So if you know what your method and endpoint, you can get the project information with the following settings:

Method: GET

Endpoint: projects/[YOUR PROJECT KEY]

Body Type: None

Final Example outcome being: https://app.launchdarkly.com/api/v2/projects/[YOUR PROJECT KEY]

launchdarkly-raw-http

Example Usage

TRAY POTENTIAL: Tray.io is extremely flexible. By design there is no fixed way of working with it - you can pull whatever data you need from other services and work with it using our core and helper connectors. This demo which follows shows only one possible way of working with Tray.io and the LaunchDarkly connector. Once you've finished working through this example please see our Introduction to working with data and jsonpaths page and Data Guide for more details.

Below is an example of a way in which you could potentially use the LaunchDarkly connector to export the name and keys of the feature flags associated with an environment, directly into a Google Sheets spreadsheet.

EXTRA AUTHS: In order to complete this workflow, you will also need to be authenticated with the Google Sheets connector.

The steps will be as follows:

  1. Setup using a manual trigger and configure a LaunchDarkly step to use the 'List feature flags' operation.

  2. Iterate through the results using the 'Loop' helper connector.

  3. Create and set up a Google Sheets spreadsheet to export your information to.

  4. Run the workflow and check the results.

The final outcome should look like this:

launchdarkly-wf-complete

1 - Setup Trigger & List Feature Flags

Once you have clicked 'Create new workflow' from your main Tray.io dashboard named it, select the Manual trigger from the trigger options available:

launchdarkly-manual-trigger

After you have been redirected to the Tray.io workflow dashboard, from the connectors panel on the left, add a Launch Darkly connector to your second step. Set the operation to 'List feature flags'.

launchdarkly-step-1a

Feel free to re-name your steps as you go along to make things clearer for yourself and other users.

The next step is to configure the input properties panel so that this operation is able to retrieve the information that we are specifically looking for.

For this use case, we are going to configure two properties, 'Project Key' and 'Environment Key'.

There are additional options that can be applied to this operation if you wish, but we will leave them as their defaults for the purpose of this example. You should now have an input panel that looks like the one illustrated below.

launchdarkly-step-1b

This step has now been configured to return a list of all of the feature flags associated with the project and environment specified.

2 - Loop through List

Next, search for the 'Loop collection' connector within your connector panel, and drag it into your workflow as your next step. Set your operations to 'Loop list'.

The Loop Collection connector allows you to iterate through a list of results. In this example, we will use it to iterate through the data found within the previous LaunchDarkly connector 'List feature flags' step.

In order to specify the list you want to loop through, start by using the 'List' mapping icon (found next to the list input field within the properties panel) to generate the connector-snake.

While hovering over the 'List feature flags' step (with the tail end of the connector-snake), select items from the list of output properties displayed. This will auto-populate a jsonpath within your 'List' input field, and update the type selector to jsonpath.

For more clarification on the pathways you have available, open the Debug panel to view your step's Input and Output.

JSONPATHS: For more information on what jsonpaths are and how to use jsonpaths with Tray.io, please see our Intro page and Data Guide for more details.

CONNECTOR-SNAKE: The simplest and easiest way to generate your jsonpaths is to use our feature called the Connector-snake. Please see the main page for more details.

launchdarkly-step-2

The loop step has now been configured to iterate through each feature flag found in the list returned by the previous step.

3 - Create & Populate Spreadsheet

Now that we are iterating through each of the feature flags within our feature flags list, we can use the Google Sheets connector to export the details of each feature flag as a new row within our Google Sheets spreadsheet.

In order to export our feature flags to Google Sheets, we need to ensure that we already have a spreadsheet created within our Google Drive account. Below is a screenshot of the spreadsheet set up for this example. Note that the sheet itself is named 'Feature Flags'.

launchdarkly-step-3a

As illustrated, make sure the headers of our columns ('Name' and 'Key') are already present and on the first row of the spreadsheet. These column headers allow us to specify which column to export the details to.

Within your builder once more, search for the 'Google sheets' connector within your connector panel, and drag it into your workflow as your next step (making sure that it is placed WITHIN the loop step itself). Set your operations to 'Create row'.

The first mandatory field is 'Spreadsheet ID'. This can be obtained by copying the hash section of the URL associated with this sheet.

For example, if the URL in the browser address bar when the spreadsheet is open is https://docs.google.com/spreadsheets/d/0123-4567-89ab-cdef/edit#gid=0, then your 'Spreadsheet ID' would be 0123-4567-89ab-cdef.

For more information about this connector please view our Google Sheets documentation.

Once this input field has been populated, the drop down options for the 'Worksheet Name' input field will allow us to select a sheet within our spreadsheet, aka 'Feature Flags'.

The next input field to populate is 'Row Data'. Here we will add to each column individually, first by clicking on the greyed out 'Add to Row Data' button.

launchdarkly-step-3b

Once clicked, we will notice two new input fields appear, 'Column heading' (which specifies the column we wish to target) and 'Value' (which specifies the data to export to this column).

launchdarkly-step-3c

The drop down options within the 'Column heading' input field, allow us to select our column headers from the sheet. In this case, 'Name'.

To populate the 'Value' input field, use the connector-snake as in Step 3. While hovering over the 'Loop collection' step (with the tail end of the connector-snake), select name from the list of output properties displayed.

This will auto-populate a jsonpath within your 'Value' input field, and update the type selector to jsonpath. The output should be similar to: $.steps.loop-1.value.name.

Repeat these steps to add to the 'Key' column, making sure to use the connector-snake to select key this time.

Once configured, your properties panel should look similar to below:

launchdarkly-step-3d

The Google Sheets step has now been configured to populate a row of our sheet with a feature flag name and key on every loop interation.

4 - Run Workflow

The workflow is now configured. As this workflow has been set up to use a manual trigger we simply need to click 'Run Workflow' button in the lower right hand section of the builder, in order to execute it.

We can observe the progress of the workflow execution using the 'Debug' panel.

Once the workflow has finished running, you will be able to see the data output:

launchdarkly-step-4a

When you go back to our spreadsheet in Google Sheets, you will be able to see the results live:

launchdarkly-step-4b

The workflow has successfully exported all feature flags associated with the project and environment, to the spreadsheet as intended.

BEST PRACTICES: Whenever you do decide to create your own workflow, please make sure you take a look at our managing data best practices guide.

All Operations

Latest version:

1.0

Delete environment

Delete an environment in a specified project.

Delete feature flag

Delete a feature flag in all environments.

Delete project

Delete a project by key.

Delete team member

Delete a team member by ID.

Delete user

Delete a user by key.

Copy environment flag settings

Copy the flag settings to another environment.

Create environment

Create a new environment in a specified project with a given name, key, swatch color, and default TTL.

Create feature flag

Creates a new feature flag.

Create project

Create a new project with the given key and name. Project keys must be unique within an account.

Create team members

Invite one or more new team members to join an account. Each member will each be sent an invitation.

Find users

Search users in LaunchDarkly based on their last active date, or a search query.

Get current team member

Get the current team member associated with the auth token.

Get environment

Get an environment given a project and key.

Get expiring user targets for feature flag

Get a list of user targets on a feature flag that are scheduled for removal.

Get feature flag

Get a single feature flag by key.

Get feature flag status

Get the status for a particular feature flag.

Get flag setting for user

Fetch a single flag setting for a user by key.

Get project

Fetch a single project by key.

Get team member

Get a single team member by ID.

Get user

Get a user by key.

List feature flag statuses

Get a list of statuses for all feature flags.

List feature flags

Get a list of all features in the given project.

List flag settings for user

Lists the current flag settings for a given user.

List projects

Returns a list of all projects in the account.

List team members

Return a list of team members.

List users

List all users in the environment.

Raw HTTP Request (Advanced)

Perform a raw HTTP request with some pre-configuration and processing by the connector, such as authentication.

Update environment

Update an environment in a given project.

Update expiring user targets on feature flags

Update the list of user targets on a feature flag that are scheduled for removal.

Update feature flag

Perform a partial update to a feature. The request body must be a valid JSON Patch or JSON Merge Patch document.

Update flag setting for user

Specifically enable or disable a feature flag for a user based on their key.

Update project

Update a project. Requires a JSON Patch representation of the desired changes to the project.

Update team member

Update a single team member.