Unblu Branch Client App Component API
    Preparing search index...

    Type Alias NewConversationInterceptor

    NewConversationInterceptor: (
        conversationType: ConversationType,
        visitorData?: String,
        recipient?: NewConversationRecipient,
    ) => Promise<String | NewConversationInterceptorResult>

    Interceptor function which is called every time a new conversation is started from the UI or JS API.

    Starting the conversation is deferred until the Promise returned by this interceptor resolves:

    • If the interceptor rejects the Promise, starting the conversation will be cancelled.
    • If the interceptor resolves the Promise with a String, the value of the String will be used and set as "visitorData" for the conversation created.
    • If the interceptor resolves the Promise with a NewConversationInterceptorResult, the values from it will be used for the "visitorData" and the "recipient" for the conversation created.
    • If the resolved value is undefined, the value passed into the startConversation method will be used.
    • If the resolved value is set to null, any value passed into startConversation will be discarded.
    • If the resolved value is neither a NewConversationInterceptorResult, nor a String, nor undefined, the conversation is started without any visitorData.
    • If the interceptor resolves the Promise with something other than a NewConversationInterceptorResult or a String, the conversation is started without any visitorData.

    Any values of NewConversationInterceptorResult that are undefined are replaced by the corresponding values passed to startConversation. Any values of NewConversationInterceptorResult that are null discard the corresponding values passed to startConversation.

    Type declaration

      • (
            conversationType: ConversationType,
            visitorData?: String,
            recipient?: NewConversationRecipient,
        ): Promise<String | NewConversationInterceptorResult>
      • Parameters

        • conversationType: ConversationType

          The type of the conversation being started.

        • OptionalvisitorData: String

          Optional visitorData. It's only present if passed to the startConversation method.

        • Optionalrecipient: NewConversationRecipient

          Optional recipient. It's only present if passed to the startConversation method.

        Returns Promise<String | NewConversationInterceptorResult>

        A Promise deferring the start of the conversation until it resolves.