tulir / whatsmeow

Go library for the WhatsApp web multidevice API
https://go.mau.fi/whatsmeow
Mozilla Public License 2.0
2.18k stars 406 forks source link

TemplateMessage is not appearing at iphone reciever #307

Closed hajsf closed 1 year ago

hajsf commented 1 year ago

I've the below code, that is sending a TemplateMessage with URL button:

package locations

import (
    "context"
    "wa/api"
    "wa/global"
    "wa/utils"

    waProto "go.mau.fi/whatsmeow/binary/proto"
    "google.golang.org/protobuf/proto"
)

func MapLink(sender string) {
    targetJID, ok := utils.ParseJID(sender)
    if !ok {
        return
    }

    // Creating template message
    msg := &waProto.TemplateMessage{
        HydratedTemplate: &waProto.TemplateMessage_HydratedFourRowTemplate{

            Title: &waProto.TemplateMessage_HydratedFourRowTemplate_HydratedTitleText{
                HydratedTitleText: "مواقع الكليات",
            },
            TemplateId:          proto.String("template-id"),
            HydratedContentText: proto.String("يمكن التعرف عليها من خلال زيارة الخريطة التفاعلية التالية"),
            HydratedButtons: []*waProto.HydratedTemplateButton{

                // This for URL button
                {
                    Index: proto.Uint32(1),
                    HydratedButton: &waProto.HydratedTemplateButton_UrlButton{
                        UrlButton: &waProto.HydratedTemplateButton_HydratedURLButton{
                            DisplayText: proto.String("👉 أنقر هنا"),
                            Url:         proto.String("https://www.google.com/maps/d/viewer?mid=1WEMnsCfckhX33_740nHuwF44NTE&hl=ar&ll=18.249015000000007%2C42.559155999999994&z=8"),
                        },
                    },
                },
            },
        },
    }

    send, err := api.Client.SendMessage(context.Background(), targetJID, "", &waProto.Message{
        ViewOnceMessage: &waProto.FutureProofMessage{
            Message: &waProto.Message{
                TemplateMessage: msg,
            },
        }})
    if err != nil {
        global.Log.Errorf("Error sending message: %v", err)
    } else {
        global.Log.Infof("Message sent (server timestamp: %s)", send)
    }
}

This message is appearing correctlt at both Android and Web, but NOTHING is displayed at iOS!

Android: image

Web: image

tulir commented 1 year ago

All message proto issues belong in GitHub discussions since they're not issues with whatsmeow itself

codespearhead commented 1 year ago

Also, this problem is not WhatsMeow-specific. [1][2]

Since you can't send messages with buttons via WhatsApp Web, it's pretty much a dead end.

The best you can do for now is to switch your Standard WhatsApp account to a Business WhatsApp account, if you haven't already, and hope WhatsApp make it so that WhatsApp Web supports it eventually.

[1] https://github.com/adiwajshing/Baileys/issues/2006 [2] https://github.com/pedroslopez/whatsapp-web.js/issues/1707