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

issue with TemplateMessage when sending titleImage or titleVideo #227

Closed
bhavesh53 opened this issue Mar 15, 2023 · 16 comments
Closed

issue with TemplateMessage when sending titleImage or titleVideo #227

bhavesh53 opened this issue Mar 15, 2023 · 16 comments
Labels
bug Something isn't working

Comments

@bhavesh53
Copy link

Hello,
Auties .great work .
i have issue below cases with TemplateMessage .

1.) sending titleText --> Working fine in both web and phone
2.) sending titleImage -->No image received in phone(other part received). Received only thumbnail in web
3.) sending titleVideo -->No video received in phone. Received only thumbnail in web.

Mobile:
mobiletest (Phone)

Web:
chrome_JojZAJL5cC

@Auties00
Copy link
Owner

Can you show me the code you are using?

@Auties00 Auties00 added the waiting triage A maintainer acknowledged the issue, further discussion is needed label Mar 15, 2023
@bhavesh53
Copy link
Author

hello check below code

var media = Files.readAllBytes(Path.of("C:\\sampleimage.jpg"));
  var image = ImageMessage.simpleBuilder() // Create a new image message builder
                    .caption("")
                    .media(media) // Set the image of this message
                    .build(); // Create the message

            var urlButton = HydratedTemplateButton.of(HydratedURLButton.of("Search it", "https://google.com")); // Create an url button
            var urlButton2 = HydratedTemplateButton.of(HydratedURLButton.of("WA me", "http://google.com")); // Create an url button
            var callButton = HydratedTemplateButton.of(HydratedCallButton.of("Call me", "919999999999")); // Create a call button
            var fourRowTemplate = HydratedFourRowTemplate.builder() // Create a new template builder
                    //.titleText("A nice title") // Set the title
                    .titleImage(image)
                    .footer("")
                    .body("this is test with image") // Set the body
                    .buttons(List.of(urlButton2, urlButton, callButton)) // Set the buttons
                    .build(); // Create the template
            var templateMessage = TemplateMessage.of(fourRowTemplate); // Create a template message
       api.sendMessage(chat, templateMessage);

@Auties00
Copy link
Owner

hello check below code

var media = Files.readAllBytes(Path.of("C:\\sampleimage.jpg"));
  var image = ImageMessage.simpleBuilder() // Create a new image message builder
                    .caption("")
                    .media(media) // Set the image of this message
                    .build(); // Create the message

            var urlButton = HydratedTemplateButton.of(HydratedURLButton.of("Search it", "https://google.com")); // Create an url button
            var urlButton2 = HydratedTemplateButton.of(HydratedURLButton.of("WA me", "http://google.com")); // Create an url button
            var callButton = HydratedTemplateButton.of(HydratedCallButton.of("Call me", "919999999999")); // Create a call button
            var fourRowTemplate = HydratedFourRowTemplate.builder() // Create a new template builder
                    //.titleText("A nice title") // Set the title
                    .titleImage(image)
                    .footer("")
                    .body("this is test with image") // Set the body
                    .buttons(List.of(urlButton2, urlButton, callButton)) // Set the buttons
                    .build(); // Create the template
            var templateMessage = TemplateMessage.of(fourRowTemplate); // Create a template message
       api.sendMessage(chat, templateMessage);

Can you please try to remove the caption inside the image message?

@bhavesh53
Copy link
Author

hello check below code

var media = Files.readAllBytes(Path.of("C:\\sampleimage.jpg"));
  var image = ImageMessage.simpleBuilder() // Create a new image message builder
                    .caption("")
                    .media(media) // Set the image of this message
                    .build(); // Create the message

            var urlButton = HydratedTemplateButton.of(HydratedURLButton.of("Search it", "https://google.com")); // Create an url button
            var urlButton2 = HydratedTemplateButton.of(HydratedURLButton.of("WA me", "http://google.com")); // Create an url button
            var callButton = HydratedTemplateButton.of(HydratedCallButton.of("Call me", "919999999999")); // Create a call button
            var fourRowTemplate = HydratedFourRowTemplate.builder() // Create a new template builder
                    //.titleText("A nice title") // Set the title
                    .titleImage(image)
                    .footer("")
                    .body("this is test with image") // Set the body
                    .buttons(List.of(urlButton2, urlButton, callButton)) // Set the buttons
                    .build(); // Create the template
            var templateMessage = TemplateMessage.of(fourRowTemplate); // Create a template message
       api.sendMessage(chat, templateMessage);

Can you please try to remove the caption inside the image message?

yes i already tested it with out caption but same problem .

@Auties00
Copy link
Owner

Auties00 commented Mar 16, 2023

hello check below code

var media = Files.readAllBytes(Path.of("C:\\sampleimage.jpg"));
  var image = ImageMessage.simpleBuilder() // Create a new image message builder
                    .caption("")
                    .media(media) // Set the image of this message
                    .build(); // Create the message

            var urlButton = HydratedTemplateButton.of(HydratedURLButton.of("Search it", "https://google.com")); // Create an url button
            var urlButton2 = HydratedTemplateButton.of(HydratedURLButton.of("WA me", "http://google.com")); // Create an url button
            var callButton = HydratedTemplateButton.of(HydratedCallButton.of("Call me", "919999999999")); // Create a call button
            var fourRowTemplate = HydratedFourRowTemplate.builder() // Create a new template builder
                    //.titleText("A nice title") // Set the title
                    .titleImage(image)
                    .footer("")
                    .body("this is test with image") // Set the body
                    .buttons(List.of(urlButton2, urlButton, callButton)) // Set the buttons
                    .build(); // Create the template
            var templateMessage = TemplateMessage.of(fourRowTemplate); // Create a template message
       api.sendMessage(chat, templateMessage);

So i just checked your code and you are using the wrong builder. This is how your code should look like my ci test:
https://github.com/Auties00/Whatsapp4j/blob/b73a8beb385216b8a3aa81c82f45c451ffc6c792/src/test/java/it/auties/whatsapp/test/RunCITest.java#L603
I probably haven't updated the documentation and will do, you are using the wrong builder right now: use simpleBuilder

@bhavesh53
Copy link
Author

hello check below code

var media = Files.readAllBytes(Path.of("C:\\sampleimage.jpg"));
  var image = ImageMessage.simpleBuilder() // Create a new image message builder
                    .caption("")
                    .media(media) // Set the image of this message
                    .build(); // Create the message

            var urlButton = HydratedTemplateButton.of(HydratedURLButton.of("Search it", "https://google.com")); // Create an url button
            var urlButton2 = HydratedTemplateButton.of(HydratedURLButton.of("WA me", "http://google.com")); // Create an url button
            var callButton = HydratedTemplateButton.of(HydratedCallButton.of("Call me", "919999999999")); // Create a call button
            var fourRowTemplate = HydratedFourRowTemplate.builder() // Create a new template builder
                    //.titleText("A nice title") // Set the title
                    .titleImage(image)
                    .footer("")
                    .body("this is test with image") // Set the body
                    .buttons(List.of(urlButton2, urlButton, callButton)) // Set the buttons
                    .build(); // Create the template
            var templateMessage = TemplateMessage.of(fourRowTemplate); // Create a template message
       api.sendMessage(chat, templateMessage);

So i just checked your code and you are using the wrong builder. This is how your code should look like my ci test:

https://github.com/Auties00/Whatsapp4j/blob/b73a8beb385216b8a3aa81c82f45c451ffc6c792/src/test/java/it/auties/whatsapp/test/RunCITest.java#L603

I probably haven't updated the documentation and will do, you are using the wrong builder right now: use simpleBuilder

Hello for normal button its working . but looking for HydratedTemplateButton which can not be used with ButtonsMessage.simpleBuilder()

@Auties00
Copy link
Owner

https://github.com/Auties00/Whatsapp4j/blob/b73a8beb385216b8a3aa81c82f45c451ffc6c792/src/test/java/it/auties/whatsapp/test/RunCITest.java#L828
It does, it's been a while since I've pushed out a release then. I'll do it as soon as I get home

@Auties00
Copy link
Owner

I've pushed 3.2.0, you can test it @bhavesh53

@bhavesh53
Copy link
Author

Hello, still same problem .

    var image = ImageMessage.simpleBuilder() // Create a new image message builder
                    .media(media) // Set the image of this message
                    .build(); 

  var fourRowTemplate = HydratedFourRowTemplate.simpleBuilder() // Create a new template builder
                    .title(image)
                    .body("this is test with image") // Set the body
                    .buttons(List.of(urlButton2, urlButton, callButton)) // Set the buttons
                    .build();

@Auties00
Copy link
Owner

Hello, still same problem .

    var image = ImageMessage.simpleBuilder() // Create a new image message builder
                    .media(media) // Set the image of this message
                    .build(); 

  var fourRowTemplate = HydratedFourRowTemplate.simpleBuilder() // Create a new template builder
                    .title(image)
                    .body("this is test with image") // Set the body
                    .buttons(List.of(urlButton2, urlButton, callButton)) // Set the buttons
                    .build();

Can you try to add a footer?

@bhavesh53
Copy link
Author

Hello, still same problem .

    var image = ImageMessage.simpleBuilder() // Create a new image message builder
                    .media(media) // Set the image of this message
                    .build(); 

  var fourRowTemplate = HydratedFourRowTemplate.simpleBuilder() // Create a new template builder
                    .title(image)
                    .body("this is test with image") // Set the body
                    .buttons(List.of(urlButton2, urlButton, callButton)) // Set the buttons
                    .build();

Can you try to add a footer?

not worked .

@bhavesh53
Copy link
Author

got problem . check below .
Template Button: (Not working)

"titleImage" : {
              "contextInfo" : { },
              "decodedMedia" : "...........",
              "mimetype" : "image/jpeg",
              "height" : 715,
              "width" : 1073,
              "mediaKeyTimestamp" : 1679137758,
              "thumbnail" : "......"
            }

Normal Button (Working)

"headerImage" : {
            "contextInfo" : { },
            "decodedMedia" : "....",
            "mediaUrl" : "https://mmg.whatsapp.net/v/t62.7118-24/29851626_945335799973777_8652843302592316314_n.enc?ccb=11-4&oh=01_AdSlBsw3JwW5136z_OhivH0_QGuel8zt_vt6Fd4boVUspw&oe=643D1FB7&mms3=true",
            "mimetype" : "image/jpeg",
            "mediaSha256" : "EhgyWqAvtFJHtWEWzOg/VPX0F3FYxO/0Dj9mBmgjD8U=",
            "mediaSize" : 56471,
            "height" : 715,
            "width" : 1073,
            "mediaKey" : "XJA19PHYugEC73Ui3DR+euRGolsOiSSMQQ715k8aa8Y=",
            "mediaEncryptedSha256" : "F2IG/bQOeDEea5iR0/PxelgcnqNr0mvkCjA4LpKoV4E=",
            "mediaDirectPath" : "/v/t62.7118-24/29851626_945335799973777_8652843302592316314_n.enc?ccb=11-4&oh=01_AdSlBsw3JwW5136z_OhivH0_QGuel8zt_vt6Fd4boVUspw&oe=643D1FB7",
            "mediaKeyTimestamp" : 1679138031,
            "thumbnail" : "...."
          },`

not encrypted while using template button

@Auties00
Copy link
Owner

got problem . check below . Template Button: (Not working)

"titleImage" : {
              "contextInfo" : { },
              "decodedMedia" : "...........",
              "mimetype" : "image/jpeg",
              "height" : 715,
              "width" : 1073,
              "mediaKeyTimestamp" : 1679137758,
              "thumbnail" : "......"
            }

Normal Button (Working)

"headerImage" : {
            "contextInfo" : { },
            "decodedMedia" : "....",
            "mediaUrl" : "https://mmg.whatsapp.net/v/t62.7118-24/29851626_945335799973777_8652843302592316314_n.enc?ccb=11-4&oh=01_AdSlBsw3JwW5136z_OhivH0_QGuel8zt_vt6Fd4boVUspw&oe=643D1FB7&mms3=true",
            "mimetype" : "image/jpeg",
            "mediaSha256" : "EhgyWqAvtFJHtWEWzOg/VPX0F3FYxO/0Dj9mBmgjD8U=",
            "mediaSize" : 56471,
            "height" : 715,
            "width" : 1073,
            "mediaKey" : "XJA19PHYugEC73Ui3DR+euRGolsOiSSMQQ715k8aa8Y=",
            "mediaEncryptedSha256" : "F2IG/bQOeDEea5iR0/PxelgcnqNr0mvkCjA4LpKoV4E=",
            "mediaDirectPath" : "/v/t62.7118-24/29851626_945335799973777_8652843302592316314_n.enc?ccb=11-4&oh=01_AdSlBsw3JwW5136z_OhivH0_QGuel8zt_vt6Fd4boVUspw&oe=643D1FB7",
            "mediaKeyTimestamp" : 1679138031,
            "thumbnail" : "...."
          },`

not encrypted while using template button

I'll fix it

@Auties00 Auties00 added bug Something isn't working and removed waiting triage A maintainer acknowledged the issue, further discussion is needed labels Mar 18, 2023
@Auties00
Copy link
Owner

Can you show me your full code though?

@bhavesh53
Copy link
Author

Can you show me your full code though?

With Template : (not working)

 var image = ImageMessage.simpleBuilder() // Create a new image message builder
                    .media(media) // Set the image of this message
                    .build(); 

  var fourRowTemplate = HydratedFourRowTemplate.simpleBuilder() // Create a new template builder
                    .title(image)
                    .body("this is test with image") // Set the body
                    .buttons(List.of(urlButton2, urlButton, callButton)) // Set the buttons
                    .build();
 api.sendMessage(chat, templateMessage);

With Button :(working )

  var imageButtons = ButtonsMessage.simpleBuilder()
                    .header(image)
                    .body("A nice body")
                    .footer("A nice footer")
                    .buttons(createButtons())
                    .build();

 api.sendMessage(chat, imageButtons );

private List<Button> createButtons() {
        return IntStream.range(0, 3).mapToObj("Button %s"::formatted).map(Button::of).toList();
    }

@Auties00
Copy link
Owner

tracking in #239

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