logo

Start a Flow from Code

Introduction

Sometimes it can be handy to trigger a survey or announcement popup directly in code. You can trigger a flow manually to:
  • Test a live flow before launching to all users
  • Debug any issues
  • Trigger a persistent feedback form from a button/link in your app
This guide shows you how to do this easily.

Get Flow ID

The flow_id can be copied from the URL of your survey page, e.g. f29a3ee75b33208ccb86abae in the below image.
Image without caption

Start Flow Method

You can manually start any active flow (published, currently turned on) in your project by calling the startFlow method. This wouldn’t work if you turn off the flow or haven’t published it yet.
💡
Calling this manually would ignore any target audience filters you set for the survey or announcement flow. As long as the flow is found in your current project and is in active status, it will show immediately.

JavaScript

There are two ways to invoke this method:
javascript
_1flow.start("flow_id");
javascript
window._1flow("start", "flow_id");

iOS

swift
OneFlow.startFlow("flow_id");

Android

kotlin
OneFlow.startFlow("flow_id");

React Native

javascript
await OneFlow.startFlow("flow_id");

Flutter

dart
import 'package:flutter_1flow_sdk/flutter_1flow_sdk.dart'; try { OneFlow.startFlow("flow_id"); } on PlatformException { print('startFlow: error occured'); }