Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug Report: Unable to Send Button and List Messages #3

Open
xiryuuGame opened this issue Dec 1, 2024 · 2 comments
Open

Bug Report: Unable to Send Button and List Messages #3

xiryuuGame opened this issue Dec 1, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@xiryuuGame
Copy link

xiryuuGame commented Dec 1, 2024

Bug Report: Unable to Send Button and List Messages

Description:
I am encountering an issue where button and list messages fail to send using venom-bot. Below are the details of the code I used and the logs generated during the operation.


Code Example

const venom = require("venom-bot");

async function start() {
  const client = await venom.create(
    "Xiryuu-Bot",
    undefined,
    (statusSession, session) => {
      console.log("Status Session:", statusSession);
      console.log("Session name:", session);
    },
    {
      multidevice: true,
      folderNameToken: "tokens",
      mkdirFolderToken: "",
    }
  );

  client.onMessage(async (message) => {
    const prefixs = [".", "!", "?", "\\", "/"];
    if (prefixs.some((prefix) => message.body.startsWith(prefix))) {
      const command = message.body.split(" ")[0].slice(1);
      switch (command) {
        case "button": {
          const buttons = [
            {
              buttonText: {
                displayText: "Google",
              },
            },
            {
              buttonText: {
                displayText: "Youtube",
              },
            },
          ];
          await client
            .sendButtons(message.from, "Contoh Button", "Silakan pilih:", buttons)
            .then((result) => console.log("Result: ", result))
            .catch((error) => console.error("Error:", error));
          break;
        }
        case "list": {
          const list = [
            {
              title: "Pasta",
              rows: [
                {
                  title: "Ravioli Lasagna",
                  description: "Made with layers of frozen cheese",
                },
              ],
            },
            {
              title: "Dessert",
              rows: [
                {
                  title: "Baked Ricotta Cake",
                  description: "Sweets pecan baklava rolls",
                },
                {
                  title: "Lemon Meringue Pie",
                  description: "Pastry filled with lemon and meringue.",
                },
              ],
            },
          ];
          await client
            .sendListMenu(
              message.from,
              "Menu List",
              "Select an item",
              "Available Items",
              "Select",
              list
            )
            .then((result) => console.log("Result: ", result))
            .catch((error) => console.error("Error when sending: ", error));
          break;
        }
      }
    }
  });
}

start();

Logs

List Message Log

{
  "Result": {
    "me": {
      "id": {
        "server": "c.us",
        "user": "6289650943134",
        "_serialized": "[email protected]"
      }
    },
    "to": {
      "fromMe": true,
      "remote": {
        "server": "c.us",
        "user": "62895622331910",
        "_serialized": "[email protected]"
      },
      "id": "1V4BC4KO81IKLJ4W",
      "_serialized": "[email protected]_1V4BC4KO81IKLJ4W"
    },
    "erro": false,
    "status": { "messageSendResult": "OK" }
  }
}

Button Message Log

{
  "Error": {
    "me": {
      "id": {
        "server": "c.us",
        "user": "6289650943134",
        "_serialized": "[email protected]"
      }
    },
    "to": {
      "fromMe": true,
      "remote": {
        "server": "c.us",
        "user": "62895622331910",
        "_serialized": "[email protected]"
      },
      "id": "ZT9U5OWLHHNFKJGU",
      "_serialized": "[email protected]_ZT9U5OWLHHNFKJGU"
    },
    "erro": true,
    "status": { "messageSendResult": "ERROR_UNKNOWN" }
  }
}

Expected Behavior

  • Button messages should send successfully with the provided buttonText and displayText.
  • List messages should send successfully with the provided menu structure.

Actual Behavior

  • List messages log are sent successfully but not appear in the chat.
  • Button messages return an error: ERROR_UNKNOWN.

Environment

  • venom-bot version: v5.3.0
  • Node.js version: v18.19.1
  • OS: linux mint

Steps to Reproduce

  1. Clone the provided code.
  2. Install venom-bot.
  3. Run the script and send a message with .button or .list commands.

Additional Notes

  • The issue only occurs for button messages.
  • I have enabled multidevice support.

Please let me know if additional details are required. Thank you!


@xiryuuGame xiryuuGame added the bug Something isn't working label Dec 1, 2024
@9cb14c1ec0
Copy link
Collaborator

Do you know if it makes a difference if the WhatsApp account is a WhatsApp business account or not?

@xiryuuGame
Copy link
Author

you know if it makes a difference if the WhatsApp account is a WhatsApp business account or not?

Umm... I set up the bot on WhatsApp, but I'm seeing the results on WhatsApp Business. I've tried to check it on WhatsApp, but it still hasn't appeared.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants