Filtering Messages

Through message filtering, we can obtain messages that only match specific criteria:

  • the tags and excludingTags parameters let you filter messages based on the tags set (or not set) in each message

  • the parentId parameter lets you filter messages by their relationship:

    • when no parentId is passed, any message will match.

    • when null parentId, true filterByParentId are passed, query for all messages without a parent.

    • when non-null parentId, true filterByParentId are passed: query for all messages with the parentId as parent.

import { MessageRepository } from '@amityco/js-sdk';

const liveCollection = MessageRepository.queryMessages({
  channelId: 'channelId',
  parentId: parentIdValue,
  filterByParentId: true,
  tags: ['summer2021']
  excludeTags: ['awful_hotel']
});

Last updated