Skip to content
This repository was archived by the owner on Dec 29, 2022. It is now read-only.
This repository was archived by the owner on Dec 29, 2022. It is now read-only.

setMessage is not a function #28

@sudiptachatterjee

Description

@sudiptachatterjee

I have the following code:

var chatbase = require('@google/chatbase')
	.setApiKey(CHATBASE_KEY)
  .setPlatform('Actions');

module.exports = {
   userMessage: function (conv) {
     let userID = conv._userid;
     let conversationID = conv.id;
     let message = conv.query;
     console.log("USER MESSAGE: "+message);
     return chatbase
      .setAsTypeUser()
      .setUserId(userID)
      .setCustomSessionId(conversationID)
      .setMessage(message)
      .send();
   },
   agentMessage: function (message, conv) {
     let conversationID = conv.id;
     console.log("AGENT MESSAGE: "+message);
     return chatbase
      .setAsTypeAgent()
      .setMessage(message)
      .setCustomSessionId(conversationID)
      .send();
   }
 }

However, when I call agentMessage("Hello", conv) my console.log shows the Hello message but I get an error that says:

TypeError: chatbase.setAsTypeAgent(...).setMessage is not a function at agentMessage

Am I doing something wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions