Use from a CTA in a story

If you want to add deep link logic from a story, you can implement the onContentLinkClick method from JOINStoriesListener.

This event tells you that a user has clicked on a CTA in the player. It indicates the CTA link in parameters and you can customize the behaviour based on this link (deeplink, path, https, etc...).
By default, it will open the web browser. To prevent this and open a deeplink instead, call event.preventDefault(), like this:

useEffect(() => {
    const playerSubscription = JoinStories.addPlayerListener((event) => {
      if (event.type === 'ContentLinkClick') {
          event.preventDefault();
          router.push(event.link);
      }
    });

    return () => {
      playerSubscription.remove();
    };
}, []);

Opening a widget from a deep link

If you want to open an story from an external deep link (like notification, in-app event, ...), you can use the standalone player to display it.
The deep link must include the alias corresponding to the widget in order to display the story.

Example:

// get your deeplink url
const deeplink = "app://myView/0/story/story-alias" 
// implement your method to parse the widget alias from your deeplink
const widgetAlias = getAlias(deeplink)

JoinStories.startStandAlonePlayer({
      alias: widgetAlias
});