Skip to main content

Launching announcements

Overview

Announcements can be incredibly useful for presenting contextual content to your users. Use cases like calling out new features, showcasing a changelog, or promoting content and events. They can come in many forms such as a modal that is shown when a user logs in or a persistent banner at the top of the page.

In this guide, we'll walk through how to use Dopt to build an in-app announcement that you can repeatedly reuse to display new content to your users.

Setup

We'll assume that you already have a flow created that encapsulates your announcement. If you're looking for more info on how to create and design flows, check out our designing flows guide.

The first thing you'll need to do is intialize your announcement flow with the "latest" version tag.

<DoptProvider
userId={$USER_ID}
apiKey={$BLOCKS_API_KEY}
flows={{
'feature-announcement': 'latest',
}}
>
...
</DoptProvider>

The "latest" version tag allows Dopt to grab the latest numbered version of your flow. This enables you to commit new changes to your flow without having to update your code to increment the version tag used.

caution

Be careful when using the "latest" tag to access flows in your code because changes made in Dopt will directly propagate to your users without changes in your code.

Updating content

There are two scenarios where you would update content for an announcement:

  1. You need to edit the content of the current announcement (e.g., fix a typo)
  2. You want to launch a completely new announcement with different content (e.g., a new feature for this sprint)

For the current announcement

To update content for the current running announcement, switch to the most recent version and update the necessary fields. Then, click the Deploy changes button to push your changes live.

This will only update the content for the announcement and will not cause users who have already finished or stopped the flow to see the announcement again.

For a new announcement

To launch a completely new announcement, switch to the uncommitted version of the flow and update the necessary fields. We're editing the uncommitted version because we want to push a new announcement rather than edit an existing announcement.

Next, commit a new version of the flow by clicking the Commit changes button and set the version transition to Restart all users. This will update the content of the announcement by commiting a new version of the flow and reset all users to the beginning of the flow so all users who meet the flow's targeting rules will see the announcement again.