Unblu Floating JS API
    Preparing search index...

    Type Alias NewConversationInterceptor

    NewConversationInterceptor: (
        conversationType: ConversationType,
        visitorData?: String,
        recipient?: ConversationRecipient,
    ) => 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]startConversation method will be used.
    • If the resolved value is set to null, any value passed into [startConversation]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]startConversation. Any values of NewConversationInterceptorResult that are null discard the corresponding values passed to [startConversation]startConversation.

    Type declaration