Multiple Journey Definitions for Customer Journey – GBG IDscan Documentation

Multiple Journey Definitions for Customer Journey

This allows selecting specific journeys on the mobile channel.

There are 3 ways how we can access specific journey select one best fitting your case:

1 – Provide journey GUID when creating a customer journey intent

Kotlin

val config = CustomerJourneyConfig.Builder(
                 baseUrl = baseUrl,
                 credentials = Credentials(username, password),
                 journeyDefinitionId = journeyDefinitionGUID // Add hardcoded or retrieved journeyDefinitionId
         ).build()
 // Call to open Customer Journey
         val customerJourney = Intent(this, CustomerJourneyActivity::class.java)
         customerJourney.putExtra(CustomerJourneyActivity.EXTRA_CONFIG, config)
         startActivity(customerJourney)

2 – Fetch possible journeys on the mobile channel and ask customer journey to use the selected one.

Kotlin

private val callback = object : OnJourneyDefinitionCallback {
         override fun onError(code: Int, message: String) {
             // Returns server error, check section: Web errors
         }
     override fun onSuccess(list: List<JourneyDefinition>) {         // Returns list of JourneyDefinitions     }
 }
 enterpriseService.getPossibleJourneyDefinitions(callback) 

Follow starting intent from 1 example.

3 – Select journey on the go from a listener if there is more that one choice it will return selection if not it will skip callback.

Kotlin

private val multipleJourneyDefinitionEventReceiver = object : MultipleJourneyDefinitionEventReceiver() {
         override fun onList(list: List): String {
             Toast.makeText(this@CustomerJourneySample, "Name: ${list.last().name}", LENGTH_LONG).show()
             // Parse list and select journey definition id you are interested in and return it.
             // For more information on JourneyDefinition check section:
             return list.last().journeyDefinitionId
         }
 }
 //Register for callbacks - this activates the server call
 MultipleJourneyDefinitionService.registerEventReceiver(this, multipleJourneyDefinitionEventReceiver)
 // Unregister from the callbacks when done
 MultipleJourneyDefinitionService.unregisterEventReceiver(this, multipleJourneyDefinitionEventReceiver)

Launch Customer Journey as normal

Was this page helpful?