Messages

You can use the methods from the TapCoreMessageManager class to manage chat messages.

Method Name
Description

Send a new text message to the selected chat room.

Send a new image message to the selected chat room.

Send a new video message to the selected chat room.

Send a new file message to the selected chat room.

Send a new message with location to the selected chat room.

Send a new voice message to the selected chat room.

Send a new link message to the selected chat room.

Forward an existing message to the selected chat room.

Construct a customized TapTalk.io message model.

Send a new custom message to the room defined in the message model.

Edit the contents of the selected message

Call this method to search messages from the device's local storage with a keyword

Set message as starred or remove star from message for the active user.

Retrieve list of messages marked as starred in a chat room.

Set message as pinned or remove pin from message for all room participants.

Retrieve list of pinned messages in a chat room.

Retrieve image, video, file, and link messages from a chat room.

Start a file download from the selected file, image, or video message.

Mark message as read by the active user.

Mark message as delivered by the active user.

Retrieve messages that are older than the provided timestamp from the server to the selected chat room.

Retrieve newer messages from the server to the selected chat room

Retrieve existing media messages from a chat room

DeleteMessage

tapCoreMessageManager.markMessageAsDeleted(
    ROOM_ID, 
    MESSAGE_IDs, 
    FOR_EVERYONE
);

SendTextMessage

tapCoreMessageManager.sendTextMessage(
    MESSAGE_BODY, 
    ROOM, 
    (message) => {
        // do action here
    },
    QUOTED_MESSAGE, 
    FORWARD_MESSAGE, 
    FORWARD_ONLY, 
    QUOTE_TITLE
);

SendImageMessage

tapCoreMessageManager.sendImageMessage(
    FILE, 
    CAPTION, 
    ROOM, 
    {
      onStart: (message) => {
          // Message model was generated
      },
      onProgress: (localID, percentage, bytes) => {
          // File upload progress
      },
      onSuccess: (message) => {
          // do action here
      },
      onError: (errorCode, errorMessage) => {
          // do action here
      }
    }, 
    QUOTED_MESSAGE, 
    FORWARD_MESSAGE,
    FORWARD_ONLY,
    QUOTE_TITLE
);

SendVideoMessage

tapCoreMessageManager.sendVideoMessage(
    FILE, 
    CAPTION, 
    ROOM, 
    {
      onStart: (message) => {
          // Message model was generated
      },
      onProgress: (localID, percentage, bytes) => {
          // File upload progress
      },
      onSuccess: (message) => {
          // do action here
      },
      onError: (errorCode, errorMessage) => {
          // do action here
      }
    }, 
    QUOTED_MESSAGE, 
    FORWARD_MESSAGE,
    FORWARD_ONLY,
    QUOTE_TITLE
);

SendFileMessage

tapCoreMessageManager.sendFileMessage(
    FILE, 
    ROOM, 
    {
      onStart: (message) => {
          // Message model was generated
      },
      onProgress: (localID, percentage, bytes) => {
          // File upload progress
      },
      onSuccess: (message) => {
          // do action here
      },
      onError: (errorCode, errorMessage) => {
          // do action here
      }
    }, 
    QUOTED_MESSAGE, 
    FORWARD_MESSAGE,
    FORWARD_ONLY,
    QUOTE_TITLE
);

SendLocationMessage

tapCoreMessageManager.sendLocationMessage(
    LATITUDE,
    LONGITUDE,
    ADDRESS, 
    ROOM, 
    (message) => {
        // do action here
    },
    QUOTED_MESSAGE, 
    FORWARD_MESSAGE, 
    FORWARD_ONLY, 
    QUOTE_TITLE
);

SendVoiceMessage

tapCoreMessageManager.sendVoiceMessage(
    FILE, 
    DURATION, 
    ROOM, 
    {
      onStart: (message) => {
          // Message model was generated
      },
      onProgress: (localID, percentage, bytes) => {
          // File upload progress
      },
      onSuccess: (message) => {
          // do action here
      },
      onError: (errorCode, errorMessage) => {
          // do action here
      }
    }, 
    QUOTED_MESSAGE, 
    FORWARD_MESSAGE,
    FORWARD_ONLY,
    QUOTE_TITLE
);

SendLinkMessage

tapCoreMessageManager.sendLinkMessage(
    MESSAGE_BODY, 
    ROOM, 
    (message) => {
        // do action here
    },
    URLS,
    TITLE,
    DESCRIPTION,
    IMAGE,
    SITE_NAME,
    TYPE,
    QUOTED_MESSAGE, 
    FORWARD_MESSAGE, 
    FORWARD_ONLY, 
    QUOTE_TITLE
);

Send Forwarded Messages

To send a forwarded message to a chat room, use the sendForwardMessage() method from the TapCoreMessageManager class.

tapCoreMessageManager.sendForwardMessage(ROOM_MODEL, (message) => {
   // do action here
}, FORWARD_MESSAGES)

Send Forwarded Messages to Multiple Rooms

To send multiple forwarded message to multiple chat room, use the sendForwardMessagesOnMultipleRooms() method from the TapCoreMessageManager class.

let DATA = [{
   room: {
      ...ROOM_MODEL
   },
   messages: [
      {
         ...MESSAGE_MODEL
      }
   ]
}]

tapCoreMessageManager.sendForwardMessagesOnMultipleRooms(DATA, (message) => {
   // do action here
})

ConstructTapTalkMessageModel

tapCoreMessageManager.constructTapTalkMessageModel(MESSAGE_BODY, ROOM, MESSAGE_TYPE, MESSAGE_DATA, LOCAL_ID = null, forwardMessage = false);

ConstructTapTalkMessageModelWithQuote

tapCoreMessageManager.constructTapTalkMessageModelWithQuote(MESSAGE_BODY, ROOM, MESSAGE_TYPE, MESSAGE_DATA, QUOTED_MESSAGE = false, LOCAL_ID = null, QUOTE_TITLE= false, QUOTE_CONTENT = false, QUOTED_IMAGE_URL = false);

SendCustomMessage

tapCoreMessageManager.sendCustomMessage(MESSAGE_MODEL, (message) => {
    // do action here
});

Edit Message

To edit amessage in a chat room, use the sendEmitWithEditedMessage() method from the TapCoreMessageManager class.

tapCoreMessageManager.sendEmitWithEditedMessage(MESSAGE, NEW_MESSAGE, (message) => {
   // do action here
})

SearchLocalRoomMessageWithKeyword

Call this method to search messages from the chat room with a keyword.

tapCoreMessageManager.searchLocalRoomMessageWithKeyword(KEYWORD, ROOM_ID, {
 onSuccess: (response) => {
   // do action here
 }, 
 onError: (message) => {
   // do action here
 }
});

SearchLocalMessageWithKeyword

Call this method to search messages from all chat room with a keyword.

tapCoreMessageManager.searchLocalMessageWithKeyword(KEYWORD, {
 onSuccess: (response) => {
   // do action here
 }, 
 onError: (message) => {
   // do action here
 }
});

StarMessage

You may use these methods to mark a message or multiple messages as starred.

tapCoreMessageManager.starMessage(ROOM_ID, MESSAGE_IDs, {
    onSuccess: (res) => {
        // do action here
    },
    onError: (errCode, errMessage) => {
        // do action here
    }
);

UnstarMessage

You may use these methods to remove messages from the starred list.

tapCoreMessageManager.unstarMessage(ROOM_ID, MESSAGE_IDs, {
    onSuccess: (res) => {
        // do action here
    },
    onError: (errCode, errMessage) => {
        // do action here
    }
);

GetStarredMessageIds

You can use the method below get a list of message IDs marked as starred by the user.

tapCoreMessageManager.getStarredMessageIds(roomID, {
    onSuccess: (res) => {
        // do action here
    },
    onError: (errCode, errMessage) => {
        // do action here
    }
});

FetchStarredMessages

You can use the method below get a list of message IDs marked as starred by the user.

tapCoreMessageManager.fetchStarredMessages(ROOM_ID, {
    onSuccess: (res) => {
        // do action here
    },
    onError: (errCode, errMessage) => {
        // do action here
    }
});

FetchSharedContentMessages

You may use this method to fetch shared content messages from the server. This currently includes image, video, file, and link messages.

tapCoreMessageManager.fetchSharedContentMessages(ROOM_ID MAX_CREATED, MIN_CREATED, SORT, {
    onSuccess: (mediasResponse, filesResponse, linksResponse) => {
        // do action here
    },
    onError: (errCode, errMessage) => {
        // do action here
    }
});

FetchPinnedMessages

You can fetch pinned messages list with this method below.

tapCoreChatRoomManager.fetchPinnedMessages(ROOM_ID, {
    onSuccess: (res) => {
        // do action here
    },
    onError: (errCode, errMessage) => {
        // do action here
    }
});

GetPinnedMessageIds

You can fetch all pinned messages ID list with this method below.

tapCoreChatRoomManager.getPinnedMessageIds(ROOM_ID, {
    onSuccess: (res) => {
        // do action here
    },
    onError: (errCode, errMessage) => {
        // do action here
    }
});

PinMessage

You can set pin messages with this method below.

tapCoreChatRoomManager.pinMessage(ROOM_ID, MESSAGES, {
    onSuccess: (res) => {
        // do action here
    },
    onError: (errCode, errMessage) => {
        // do action here
    }
});

UnpinMessage

You can set pin messages with this method below.

tapCoreChatRoomManager.unpinMessage(ROOM_ID, MESSAGES_IDs, IS_UNPIN_ALL, {
    onSuccess: (res) => {
        // do action here
    },
    onError: (errCode, errMessage) => {
        // do action here
    }
});

Download Message File

To start a file download from a File, Image, or Video message, you can use the downloadMessageFile() method.

tapCoreChatRoomManager.downloadMessageFile(messageModel, {
      onSuccess : (response) => {
         // do action here
      },
      onError: (errorCode, errorMessage) => {
         // do action here     
      }
})

Mark Message as Read

To manually mark a message as read, call the markMessageAsRead() method.

tapCoreMessageManager.markMessageAsRead(ARRAY_OF_MESSAGE_ID)

Mark Message as Delivered

To manually mark a message as delivered, call the markMessageAsDelivered() method.

tapCoreMessageManager.markMessageAsDelivered(ARRAY_OF_MESSAGE_ID)

Get Older Messages from Chat Room

To retrieve older messages in a chat room from the server, use the getOlderMessagesBeforeTimestamp() method.

tapCoreMessageManager.getOlderMessagesBeforeTimestamp(ROOM_ID, NUMBER_OF_ITEMS, {
   onSuccess: (messages, hasMore) => {
          // do action here
    },
    onError: (errorCode, errorMessage) => {
          // do action here
    }
})

Get Newer Messages from Chat Room

To retrieve newer messages in a chat room from the server, use the getNewerMessagesAfterTimestamp() method.

tapCoreMessageManager.getNewerMessagesAfterTimestamp(ROOM_ID, {
   onSuccess: (messages) => {
          // do action here
    },
    onError: (errorCode, errorMessage) => {
          // do action here
    }
})

Get Total Read Count

Get total read count of a message

tapCoreChatRoomManager.getTotalReadCount(MESSAGE_ID, {
      onSuccess : (response) => {
         // do action here
      },
      onError: (errorCode, errorMessage) => {
         // do action here     
      }
})

Fetch Message Info

Fetch message info (read by and delivere to).

tapCoreChatRoomManager.fetchMessageInfo(MESSAGE_ID, {
      onSuccess : (response) => {
         // do action here
      },
      onError: (errorCode, errorMessage) => {
         // do action here     
      }
})

Last updated

Was this helpful?