• HOME
  • INTEGRATIONS
  • SDKS
  • GUIDES
  • API DOCS
No results for ""
EXPAND ALL
CLOSE
launchdarkly.com

EDIT ON GITHUB

Flag triggers

Read time: 4 minutes
Last edited: Oct 16, 2020

Overview

Flag triggers is an Enterprise feature

This feature is only available for customers on a LaunchDarkly Enterprise plan. To enable triggers on your account, contact Sales.

This topic explains how to use LaunchDarkly's flag triggers feature, which lets you make changes to flag targeting remotely from a third-party application, like an APM tool. You can use triggers to turn flag targeting on or off.

Understanding what flag triggers do

A trigger lets you initiate flag changes remotely using a unique webhook URL. Triggers integrate with your existing tools to let you enable or disable flags when you hit specific operational health thresholds or receive certain alerts. A flag can have multiple triggers attached to multiple tools or alerts.

Triggers work by creating unique URLs to connect feature flags to third-party tools. When the third-party tool generates a specific alert, the trigger sets the flag's targeting to On or Off.

Each URL controls one action, and the URLs are distinct from each other. Subsequent requests to the flag's On URL will not change the flag's state after the initial contact turns the flag On.

Triggers are environment-specific

Triggers are unique to each flag within a given environment. This means that you can add multiple tools and multiple triggers to every flag, but if you wish to use the same trigger in multiple environments, you must create a new trigger for each flag in each environment as flags do not share URLs across environments.

Understanding flag triggers' security

Although flag triggers use public URLs, they're still a very secure way to initiate changes to your feature flags. Here's why:

  • Triggers use unguessable URLs, and
  • Only some people in your LaunchDarkly project can create or modify triggers.

An unguessable URL is functionally similar to an access token in that it does not require an active connection between LaunchDarkly and other services to work.

To learn more about unguessable URLs, read Google's Unguessable URLs.

When you create a new trigger, its URL only displays once and prompts you to copy it locally. After the initial display, URLs are obscured so future viewers of the flag's Settings tab cannot see them.

If you lose a trigger's URL, you can reset it from the trigger's three-dot overflow menu.

To learn more, read Managing existing triggers.

Additionally, not all LaunchDarkly team members can interact with triggers. Team members must have the Writer role to modify existing triggers or create new ones.

If you use custom roles to manage your team, every team member who needs to manage triggers must be able to use the updateTriggers action.

To learn more, read Custom roles.

Integrations that use flag triggers

Triggers are available on the following tools. Read each tool's documentation to learn how to set up triggers for them.

The tools are:

LaunchDarkly also supports generic triggers that you can use with other tools. To learn more, read Creating a new trigger.

Generic triggers can connect to anything that fires a webhook. If a tool or service accepts an inbound connection from a webhook, you can use that service to turn a flag on or off. For example, if your company has an in-house monitoring application, you can use a generic trigger to turn flags on or off directly from your application.

Generic triggers work without any request body, but if you want to enhance the flag's audit log with more information, you can add different attributes. Any combination of properties will return information, and every attribute is optional.

To do this, send a JSON payload with the following shape:

1{
2 "eventName": "system CPU at 90%", // a name or description associated with the event
3 "url": "https://yourlinkhere.com" // put a link here to direct a user to more information
4}

Creating a new flag trigger

You can create triggers for individual feature flags from the flag's Settings page.

To create a trigger:

  1. Navigate to the feature flag for which you wish to create a trigger, and click into its Settings page.
  2. Find the "Triggers for [Environment Name]" section and click Add trigger. The "Create trigger" dialog box appears.

The "Create trigger" dialog box.
The "Create trigger" dialog box.

  1. Choose the tool you wish to use from the Type dropdown. You can also choose "Generic trigger" to create a trigger that is not associated with any specific tool.
  2. Choose an action you wish to perform with the trigger from the Action dropdown.
  3. Click Save trigger. A confirmation appears and the trigger appears in the flag's Settings page.
  4. Copy and save the unique trigger URL. You must do this now. After you leave this page, the trigger URL will be obscured and you will not be able to view it again.

A trigger with the URL obscured.
A trigger with the URL obscured.

You just created a new trigger for your flag. You can create more triggers if necessary by clicking Add trigger.

Managing existing flag triggers

You can modify existing triggers from the flag's Settings page. After you create a trigger, you can disable, reset, or delete it.

To modify an existing trigger:

  1. Navigate to the feature flag for which you wish to create a trigger, and click into its Settings page.
  2. Find the trigger you wish to modify and click the three-dot menu. The trigger options appear.

The three-dot menu, expanded.
The three-dot menu, expanded.
3. Choose the option you wish from the options dropdown:

  • Disable trigger: If you choose this option, the trigger configuration is saved but the trigger stops working. To re-enable the trigger, open the three-dot menu and choose Enable trigger.
  • Reset trigger URL: If you choose this option, LaunchDarkly generates a new URL for this trigger. Use this option if you lose a URL for an existing trigger. You must update any clients using this URL to use the new URL. Type the trigger's type and click Reset to confirm.
  • Delete trigger: If you choose this option, the trigger and its URL are deleted permanently. Type the trigger's type and click Delete to confirm.