BotsEventListener

public protocol BotsEventListener : AnyObject

Classes which conform to this protocol will have access to a set of important callback methods on specific events.

  • A callback method triggered when a message is received from bot.

    Declaration

    Swift

    func onReceiveMessage(message: BotsMessage)

    Parameters

    message

    an object of a class which conforms to BotsMessage protocol like BotsTextMessage, BotsAttachmentMessage, BotsCardMessage.

  • A callback method triggered when an attachment is successfully uploaded.

    Declaration

    Swift

    func onUploadAttachment(message: BotsAttachmentMessage, error: Error?)

    Parameters

    message

    an object of the BotsAttachmentMessage class initialized with the attached file which was uploaded to the bot.

  • A callback method triggered when there is a change in the network connection state.

    Declaration

    Swift

    func onStatusChange(connectionStatus: ConnectionStatus)

    Parameters

    connectionStatus

    a ConnectionStatus object among .connecting, .connected, .disconnected.

  • A callback method triggered when destroy() method is called.

    Declaration

    Swift

    func onDestroy()
  • A callback method triggered when initialize() method is called.

    Declaration

    Swift

    func onInitialize()
  • A callback method triggered when chat language is changed.

    Declaration

    Swift

    func onChatLanguageChange(newLanguage: SupportedLanguage)

    Parameters

    newLanguage

    The newly set language as an instance of SupportedLanguage.

  • A callback method triggered after conversation has ended succesfully.

    Declaration

    Swift

    func chatEnd()