sendCatalogMessage method

Future<Message?> sendCatalogMessage({
  1. required String phone,
  2. required String catalogOwner,
  3. String? title,
  4. String? description,
  5. String? textMessage,
  6. String? jpegThumbnail,
})

Sends the WhatsApp Business catalog of catalogOwner (usually this account's own number) to phone -- a contact, a group id or a channel id. jpegThumbnail is a data:image/jpeg;base64,... preview.

Implementation

Future<Message?> sendCatalogMessage({
  required String phone,
  required String catalogOwner,
  String? title,
  String? description,
  String? textMessage,
  String? jpegThumbnail,
}) async {
  var result = await wpClient.evaluateJs(
    '''window.WPP.chat.sendCatalogMessage(${phone.sendTargetParse}, ${catalogOwner.phoneParse}, {
          title: ${title.jsParse} || undefined,
          description: ${description.jsParse} || undefined,
          textMessage: ${textMessage.jsParse} || undefined,
          jpegThumbnail: ${jpegThumbnail.jsParse} || undefined
        });''',
    methodName: "sendCatalogMessage",
  );
  return Message.parse(result).firstOrNull;
}