pedroslopez / whatsapp-web.js

A WhatsApp client library for NodeJS that connects through the WhatsApp Web browser app
https://wwebjs.dev
Apache License 2.0
15.42k stars 3.68k forks source link

Sending catalog products #1069

Closed tinyCoder32 closed 2 years ago

tinyCoder32 commented 2 years ago

Is your feature request related to a problem? Please describe. Yes, can not send catalog products. Catalog products are very useful for small businesses, we'd like to send products to our customers.

Describe the solution you'd like Adding support to send catalog products, just like vcards, locations and images.

Describe alternatives you've considered I've tried adding the product type to the message sending function with the required fields:

  let productOptions = {};
  if (options.product) {
    productOptions = {
      type: 'product',
      businessOwnerJid: options.product.catalogWid.toString({
        legacy: true
      }),
      productId: options.product.id.toString(),
      url: options.product.url,
      productImageCount: options.product.productImageCollection.length,
      title: options.product.name,
      description: options.product.description,
      currencyCode: options.product.currency,
      priceAmount1000: options.product.priceAmount1000,
      caption: options.product.description,
    };
    delete options.product;
  }

However, the message stays pending and never gets sent.

Additional context This is how catalog products look like when sent: image

Thanks for your efforts.

Darker935 commented 2 years ago

Bro, what is the:

 options.product.catalogWid.toString({
        legacy: true
  }),

Business Owner Jid needs to be: userid@s.whatsapp.net and a Business Account Like: 351919911991@s.whatsapp.net

and the following arguments are missing:

tinyCoder32 commented 2 years ago

I don't have enough information, I used the same object that some other WA projects using online.

codenameryuu commented 2 years ago

the previous update, MD version can send catalog using whatsapp business account. but in latest update, this function doesn't work well

image

anyone can help?

PurpShell commented 2 years ago

the previous update, MD version can send catalog using whatsapp business account. but in latest update, this function doesn't work well

image

anyone can help?

you meant a list message,

codenameryuu commented 2 years ago

Yeah i mean list feature

PurpShell commented 2 years ago

Yeah i mean list feature

this is catalog brother. You are using the business edition of whatsapp which physically blocks the sending of a list

codenameryuu commented 2 years ago

Yeah i mean list feature

this is catalog brother. You are using the business edition of whatsapp which physically blocks the sending of a list

oh i see. so the business whatsapp doesn't work for list. and i found another one when i tried to send button in MD version, it didn't work well (the message was stucked)

PurpShell commented 2 years ago

Bro, what is the:

 options.product.catalogWid.toString({
        legacy: true
  }),

Business Owner Jid needs to be: userid@s.whatsapp.net and a Business Account Like: 351919911991@s.whatsapp.net

and the following arguments are missing:

* deprecatedMms3Url

* directPath

* filehash

* encFilehash

* mimetype ("image/jpeg","image/png" ...)

* mediaKey

* mediaKeyTimestamp

you can simply get the product by id, no?

PurpShell commented 2 years ago

Yeah i mean list feature

this is catalog brother. You are using the business edition of whatsapp which physically blocks the sending of a list

oh i see. so the business whatsapp doesn't work for list. and i found another one when i tried to send button in MD version, it didn't work well (the message was stucked)

will fix, already known of for 3 months, thanks for reporting anyways

tinyCoder32 commented 2 years ago

you can simply get the product by id, no?

Yes of course, but I am unable to send it to a specific chat.

tinyCoder32 commented 2 years ago

Is there any chance to get this working?

PurpShell commented 2 years ago

Duplicate of #707