Invalid receiver type when user sends a message

Hello.

I was trying to implement this code from github: GitHub - cometchat-pro-tutorials/react-customer-support-live-widget: Chat Widget Demo Using React Express + CometChat , but I’ve come across a problem.

Now, when I try to send a message inside of a box my console outputs this:

  1. code: “INVALID_RECEIVER_TYPE”
  2. details: “Please check the value of receiverType.”
  3. message: “Receiver type can be user or group.”
  4. name: “INVALID_RECEIVER_TYPE”

But the problem is that I’m using receiver type inside of my code.

Here is the textMessage: let textMessage = new CometChat.TextMessage(
agentUID,
newMessage,
CometChat.MESSAGE_TYPE.TEXT,
CometChat.RECEIVER_TYPE.USER
);

Now why I’m getting this error in my console? Is this outdated code, so that’s why it’s not working?

Hello!

This tutorial is slightly outdated. But there are two solutions I can suggest-

  1. You can upgrade the code based on our guidelines-
  1. You can use our UI Kits instead-
1 Like

Thank you very much sir! Upgrading to v2 worked, now chat works! Thanks!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.