B Bubbl Docs

Surveys (Optional)

Bubbl notifications can contain survey questions. Your app can render these in a modal.

What this adds

  • A dynamic survey UI built from Bubbl’s question schema.
  • Answer collection and submission to Bubbl.

Implementation outline

  • Parse survey questions from the notification payload.
  • Build UI components dynamically based on question type.
  • Submit answers through the SDK.

Key idea

You do not need to copy any specific UI implementation. You only need to:

  1. Read questions from NotificationRouter.DomainNotification.
  2. Collect answers into SurveyAnswer objects.
  3. Call the SDK to submit.

Sample submission flow (simplified)

val answers = mutableListOf<SurveyAnswer>()
// Build answers by reading your custom UI fields

BubblSdk.submitSurvey(
    notificationId = notification.id.toString(),
    locationId = notification.locationId,
    answers = answers
) { success ->
    if (success) {
        Toast.makeText(context, "Thanks!", Toast.LENGTH_SHORT).show()
    }
}

Tooltip

If you don’t need surveys, you can skip all survey code and simply render media or CTAs.