TapTalk.io Documentation
  • Introduction
  • OneTalk Omnichannel Documentation
    • Getting Started with OneTalk
      • Team Members
      • Add Topic
      • Assign Agent to Topic
      • Paid Proactive Chat
    • Channel Integration
      • Telegram Integration
      • WhatsApp SME Integration
      • Instagram DM Integration
      • Facebook Messenger Integration
      • Live Chat Integration (iOS, Android, Web)
        • OneTalk Live Chat for Android
          • Get Started
          • Event Listener
          • Authentication
          • Case & Topic
          • Navigate Live Chat UI
          • Customize UI Appearance
        • OneTalk Live Chat for iOS
          • Get Started
          • Background Process in TapTalk.io Omnichannel iOS
          • Event Delegate
          • Authentication
          • Case & Topic
          • Navigate Live Chat UI
          • Customize UI Appearance
        • OneTalk Live Chat for Web
          • Get Started
          • Callback
          • Method
        • OneTalk Live Chat for React Native
          • Get Started - Android
          • Authentication - Android
          • Get Started - iOS
          • Authentication - iOS
        • OneTalk Live Chat for Flutter
          • Get Started - Android
          • Get Started - iOS
      • Google Business Messages Integration
      • Google Business Profile Integration
      • Tokopedia Integration
    • Integration API
      • Inbox API
      • User/Contact API
    • Live Chat Widget Callback Function
    • Social Channel Button
    • Custom Chatbot Integration
      • Get Started
      • Edit or Delete Chatbot
      • Development
    • QnA via API
    • Webhook
  • PowerTalk Chat SDK Documentation
    • Getting Started with PowerTalk
    • PowerTalk Android
      • Get Started
      • Enable Chat Features
      • Authentication
      • TapUI and TapCore
      • Background Process in TapTalk.io
      • Connection
      • Event Listener
      • Push Notification
      • General
      • User
      • Room List
        • Room List - TapUI
        • Room List - TapCore
      • Chat Room and Messages
        • Chat Room and Messages - TapUI
        • Chat Room and Messages - TapCore
      • Contact
      • Message Type
      • Customize UI Appearance
      • Customize Chat Features
      • Customize Chat Message Bubble
      • Customize Navigation Bar
      • Deep Linking
      • Error Codes
    • PowerTalk iOS
      • Get Started
      • TapUI and TapCore
      • Background Process in TapTalk.io
      • Implement Application Delegate
      • Authentication
      • Connection
      • Event Delegate
      • Push Notification
      • General
      • User
      • Room List
        • Room List - TapUI
        • Room List - TapCore
      • Chat Room and Messages
        • Chat Room and Messages - TapUI
        • Chat Room and Messages - TapCore
      • Contact
      • Message Type
      • Customize UI Appearance
      • Customize Chat Features
      • Customize Chat Message Bubble
      • Customize Navigation Bar
      • Deep Linking
      • Error Codes
    • PowerTalk React Native
      • Get Started - Android
      • Get Started - iOS
    • PowerTalk Flutter
      • Get Started - Android
      • Get Started - iOS
    • Javascript SDK
      • Get Started
      • Authentication
      • Connection
      • General
      • Event Listener
      • User
      • Room List
      • Chat Room
      • Messages
      • Contact
      • Message Type
    • Server API
      • Get Started
      • Base URL
      • Authentication
      • User
      • Contact
      • Message
      • Room
    • Webhook
      • Get Started
      • Webhook Payload
  • MeetTalk SDK Documentation
    • Getting Started with MeetTalk
    • MeetTalk Android
      • Get Started
      • Event Listener
    • MeetTalk iOS
      • Get Started
      • Implement Application Delegate
      • Event Delegate
  • SendTalk API Documentation
    • Introduction
    • Whatsapp Verification
Powered by GitBook
On this page
  • TapListener
  • TapCoreMessageListener
  • TapCoreRoomListListener
  • TapCoreChatRoomListener
  • TapCoreContactListener

Was this helpful?

  1. PowerTalk Chat SDK Documentation
  2. Javascript SDK

Event Listener

The Javascript SDK provides interfaces to listen to various events on the client app. Through these interfaces, TapTalk.io notifies the client app of events that happen on your app.

TapTalk.io provides event listeners to notify events to the client app. You will need to register the listener objects to receive event callbacks from TapTalk.io.

Event Listener

Description

Listens to general event changes in the application

Listens to events when a new/updated message is received by the application

Listens to changes to chat room's state in the room list

Listens to room status events such as typing events and online status

Listens to contact related events such as block or unblock contact

TapListener

General events such as notifications will be notified through TapListener. A TapListener instance is required when initializing TapTalk.

taptalk.addTapListener({
      onTapTalkRefreshTokenExpired: () => {
        setIsModalRefreshReconnectShow(true);
      }
})

TapListener listens to changes in the following methods:

Method Name

Invoked When

onTapTalkRefreshTokenExpired()

User's refresh token has expired. An authentication with a new auth ticket is required.

TapCoreMessageListener

TapCoreMessageListener listens to message-related events, such as receiving new or updated message. TapCoreMessageListener can be registered through the TapCoreMessageManager class.

tapCoreChatRoomManager.addMessageListener({
        onReceiveNewMessage: (messageModel) => {
          // do action here
        },

        onReceiveUpdateMessage: (messageModel) => {
          // do action here
        }
})

Method Name

Invoked When

onReceiveNewMessage()

A new message is received. Returns the newly received message.

onReceiveUpdatedMessage()

An updated message is received. Returns the updated message.

TapCoreRoomListListener

Changes to a chat room's state, such as pin and mute events are notified through TapCoreRoomListListener. An instance of TapCoreRoomListListener can be registered from the TapCoreRoomListManager class.

tapCoreRoomListManager.addRoomListListener({
    onChatRoomDeleted: (roomID) => {
        // do action here
    }
});
Method Name
Invoked When

onChatRoomDeleted()

The active user deleted a chat room. Returns the room ID of the deleted room.

TapCoreChatRoomListener

Room status events such as typing events and online status are notified through TapCoreChatRoomListener. An instance of TapCoreChatRoomListener can be registered from the TapCoreChatRoomManager class.

tapCoreChatRoomManager.addRoomStatusListener( {
        onReceiveStartTyping: (roomID, userModel) => {
          // do action here
        },

        onReceiveStopTyping: (roomID, userModel) => {
          // do action here
        },

        onReceiveOnlineStatus: (userModel, isOnline, lastActive) => {
          // do action here
        }
 })

Method Name

Invoked When

onReceiveStartTyping()

Another user starts typing a message in a chat room. Returns the room ID and typing user.

onReceiveStopTyping()

Another user stops typing a message in a chat room. Returns the room ID and typing user.

onReceiveOnlineStatus()

Another user comes online or offline. Returns the updated user, online status, and the updated user's last active time stamp.

TapCoreContactListener

Contact related events such as block/unblock are notified through TapCoreContactListener. An instance of TapCoreContactListener can be registered from the TapCoreContactManager class.

tapCoreContactManager.addContactListener({
    onContactBlocked: (user) => {
    
    },
    onContactUnblocked: (user) => {
    
    }
});

Method Name

Invoked When

onContactBlocked()

Active user blocks another user. Returns the blocked user.

onContactUnblocked()

Active user unblocks another user. Returns the unblocked user.

PreviousGeneralNextUser

Last updated 2 years ago

Was this helpful?

TapListener
TapCoreMessageListener
TapCoreRoomListListener
TapCoreChatRoomListener
TapCoreContactListener