• Home
  • Integrations
  • SDKs
  • Guides
  • API docs
    No results for ""
    EXPAND ALL

    EDIT ON GITHUB

    Subscribing to notifications

    Read time: 3 minutes
    Last edited: Feb 09, 2023

    Overview

    This topic explains how to subscribe to notifications in Slack channels. You can receive notifications when resources are created, updated, deleted, or are ready for removal.

    It can be useful to let an entire channel know when a flag changes or is ready to remove. You can receive notifications when someone toggles a flag on or off, when someone creates new resources in a certain environment, and when flags are ready for removal from your codebase.

    Subscribing to notifications

    You can subscribe to updates for flags, segments, metrics, projects, or environments. When someone updates a resource, either directly in LaunchDarkly or through the Slack app, LaunchDarkly sends a notification of the change to all channels subscribed to updates for that resource. Subscriptions must have a project, and can optionally include parameters like a specific environment, flag name, status, or tag that will filter the notifications you receive.

    There are two ways to create a subscription to flag notifications: the Slack modal workflow or the /launchdarkly subscribe command. Subscriptions created through the modal must specify a project and environment.

    Subscribing using the modal

    To subscribe using the modal:

    1. Open the Slack channel you want notifications in.
    2. Type /launchdarkly subscribe in your Slack client's text bar and press Enter. The "Create subscription" dialog appears.
    The create subscription dialog.
    The create subscription dialog.
    1. Select the project and environment you'd like to receive notifications for.
    2. (Optional) You can further refine your subscription defining specific flag, status, action, or tag. You can use * as a wildcard in your flag key. You'll only receive updates for flags that match these parameters.
    The modal to select subscription parameters.
    The modal to select subscription parameters.

    1. Click Preview to view the list of flags that your parameters include.
    2. Click Create subscription to subscribe the channel to flag notifications. A confirmation message appears in the channel after you close the dialog.

    Subscribing using the command

    There are two ways to subscribe to updates using the command: with keyword arguments (recommended), or with positional arguments. To view more information and examples of the subscribe command, run /launchdarkly help subscribe in a channel or direct message that the LaunchDarkly bot is in.

    Subscribing with keyword arguments


    You can use keyword arguments to create a subscription with any combination of parameters. At least one parameter is required.

    Here's how:

    1. Open the Slack channel you want notifications in.
    2. Run /launchdarkly subscribe and pass in any combination of the following arguments:
      • -p or --project=
      • -e or --environment=
      • -f or --flag_key=
      • -s or --status=
      • -a or --action=
      • -t or --tag=
    3. Press Enter.

    For example, the following command creates a subscription for all flags in the qa environment of the chatbot project, with status active and tag production:

    /launchdarkly subscribe -p chatbot -e qa -s active -t production
    

    Subscribing with positional arguments


    You can use positional arguments to create a subscription for a single flag. You must provide all three arguments.

    Here's how:

    1. Open the Slack channel you want notifications in.
    2. Run /launchdarkly subscribe and provide in order the project, environment, and flag key of the flag you would like to subscribe to.
    3. Press Enter.

    For example, the following command creates a subscription for the chat-response flag in the qa environment of the chatbot project:

    /launchdarkly subscribe chatbot qa chat-response
    

    Managing subscriptions

    You can view and remove subscriptions in a Slack channel using the /launchdarkly list command:

    1. Open the Slack channel where you would like to remove notifications.
    2. Type /launchdarkly list and press Enter. A list of subscriptions for the channel appears.
    3. Locate the subscription you wish to remove from the channel.
    4. Click Remove.
    The output of the `/launchdarkly list` command.
    The output of the `/launchdarkly list` command.

    Notification information

    Flag notifications include the following information:

    • The name of the person who made the change
    • The name of the flag
    • The environment, project, and key of the flag
    • A comment about the change, if applicable

    To display additional information about the flag change, click View details.

    The table below explains the different subscription parameters:

    Subscription parametersRequiredDescription
    ProjectRequiredAll subscriptions must include a project and environment to get flag notifications for.
    EnvironmentOptional, but required in modal creationAll subscriptions must include a project and environment to get flag notifications for.
    Flag keyOptionalA flag key to get notifications for, which can begin or end with a wildcard * to include all matching flag keys.
    StatusOptionalFilter by flag status. Available statuses are:
    • Any
    • Active
    • Inactive
    • Archived
    • Launched
    • New
    ActionOptionalFilter by action. Available actions are:
    • Any
    • Created
    • Updated
    • Deleted
    • Ready for removal
    • New
    Flag tagOptionalFilter by a list of all flag tags. Does not include other types of tags, such as segment tags.

    Receiving alerts when flags are ready to remove

    You can subscribe to notifications when it’s time to remove flags from code. Removing from code is a necessary step before archiving flags. To learn more, read about Archiving and deleting flags.

    You will be served a “ready to remove” notification when any flags that you subscribe to become “inactive” or “launched” in status code.

    To set up a "ready to remove" flag alert, create a subscription that includes the flag you want to receive the alert for. To learn how to create a subscription, read Subscribing to flag notifications.

    Receiving approval request notifications

    Approvals is a Pro and Enterprise feature

    Approvals is available to customers on a Pro or Enterprise plan. To learn more, read about our pricing. To upgrade your plan, contact Sales.

    If your organization uses feature workflows and the Slack app, you receive a direct message in Slack when someone requests an approval from you, or when an approval request you made is approved, denied, or receives a comment.

    You cannot interact with an approval from these notifications. They are indicators that you should log into LaunchDarkly and review your approval requests.

    To learn more about approval requests, read Approvals.