Chat with the Operator

In this example we take you through how you can use the in-app chat feature of Marketplacer to chat directly with the Operator.

What you’ll learn

In this how to guide you’ll learn:

  • What is the in-app chat feature
  • Chat relationships & workflow
  • The queries and mutations you can use to work with in-app chat

What is in-app chat?

In-app chat is a text-based communication tool on the Marketplacer platform, facilitating near real-time, company-to-company conversations between Operators and Sellers. This streamlined communication enhances issue resolution for partners within the Marketplacer ecosystem.

If you’re an Operator looking leverage the Operator API to chat with Sellers, check out this article.

In-app chat is available in both the Operator or Seller portals, but can also be accessed via the Operator and Seller APIs. This guide focuses on how you can use the Seller API to chat with the Operator.

Chat Relationships & Workflow

Chat Relationships

A simplified view of the relationships between an Operator and Sellers using In-app Chat on a Marketplacer instance is shown below:

Operator and Seller Chat Relationships


The takeaways from this are:

  • An Operator can have multiple chat’s with different Sellers
  • A Seller only has 1 chat with the Operator
  • Sellers cannot chat with each other
  • Chat messages are a single continuous thread between the Operator and Seller
  • Irrespective of whether separate Operator API keys are used to generate chat messages on the same Marketplacer instance - those chat messages all appear in the same thread
  • Irrespective of whether separate Seller API keys are used to generate chat messages under the same Seller Account - those chat messages all appear in the same thread
  • Seller API keys use to generate chat messages under separate Seller Accounts will result in a separate chat thread for each

Chat Workflows

There are 3 basic workflows when using In-app chat:

  1. Send new message workflow
  2. Reply to a message workflow
  3. Read message workflow

Send New Message Workflow

Send Workflow

  • chatMessageCreate sends a message to the Operator

Reply to Message Workflow

Read Workflow

  • chatMessages fetch chat messages
  • chatMessageRead sets the readAt field on chat messages sent by the Operator
  • chatMessageCreate sends a reply message to the Operator

Read Message Workflow

Read Workflow

  • chatMessages fetch chat messages
  • chatMessageRead sets the readAt field on chat messages sent by the Operator

Examples of these queries and mutations can be found below, as well as in our API Collections.

Query & Mutation Examples


chatMessageSend

Create a chat message between operator and seller.

mutation SendMessgaeToOperator {
  chatMessageCreate(
    input: {
      message: "Can you check to see when my remittance will be paid?"
    }
  ) {
    chatMessage {
      id
    }
    errors {
      field
      messages
    }
  }
}

In this mutation we:

  • Provide a message we want to send to the Operator
  • Request the ID of the resulting Chat Message
  • Request any errors associated with the mutation call

chatMessages

Fetches chat messages between Operator and a Seller

query GetChatMessages {
  chatMessages(first: 10, after: null) {
    totalCount
    pageInfo {
      hasNextPage
      endCursor
    }
    nodes {
      id
      createdAt
      message
      readAt
      sentByType
    }
  }
}

In this example we fetch:

  • The first 10 Chat Messages (we are not passing an after cursor)
  • We also use pagination to determine if:
    • There is another page of data (hasNextPage)
    • If so, obtain the cursor we need to supply to our subsequent call (endCursor)

chatMessageRead

Mark a chat message as read

mutation ConfirmReadOfChatMessage {
  chatMessageRead(input: { sentBy: "Admin" }) {
    errors {
      messages
      field
    }
  }
}

In this mutation we:

  • Supply the user class (sentBy)
  • Request any errors associated with the mutation call