🎉 1Flow is proudly backed by Y Combinator.
logo
Frontend callback feature is released on May 26, 2022.

Introduction

Our SDK provides a callback after closing or submitting the survey by the user. For that you just need to add listener for oneFlowSurveyFinishNotification event which will get triggered as soon a user will submit the survey. In the below code, you will see how to implement a 1Flow survey callback in Flutter.
dart
void main() { runApp(MyApp()); // Add this line to configure 1Flow OneFlow.configure('<1flow_project_key>',true); // true if want to enable surveys otherwise false. /* Adding 'oneFlowSurveyFinishNotificationHandler' event listener. This event will be triggered as soon as user will submit the survey. */ OneFlow.methodchannel.setMethodCallHandler(oneFlowSurveyFinishNotificationHandler); } /* Event listener function which will be called as soon as 'oneFlowSurveyFinishNotification' will be triggered. */ Future<void> oneFlowSurveyFinishNotificationHandler(MethodCall call) async { final String method = call.method; dynamic argument = call.arguments; switch (method) { case "oneFlowSurveyFinishNotification": { print("oneFlowSurveyFinishNotification: $argument"); } break; default: { print("Invalid choice"); } break; } }

Demo data structure 1flow callback:

json
Example:- { "survey_id": "XXXXXXXXXXXXX", "survey_name": "Rating Survey", "trigger_name": "fileSaved", "status": "finished", "screens": [ { "question_title": "How it worked", "question_type": "checkbox", "screen_id": "XXXXXXXXXXXXX", "question_ans": [ { "answer_value": "Option 1" }, { "answer_value": "Option 2" }, { "answer_value": "Other", "other_value": "Checkbox Other" } ] }, { "question_title": "Your valuable feedback", "question_type": "text", "screen_id": "XXXXXXXXXXXXX", "question_ans": [ { "answer_value": "This is user's feedback" } ] } ] }

Fields in 1flow callback:

survey_id: string
survey_name: string
trigger_event_name: string
status: string
screens: Array