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

TemplateMessage is not appearing at iphone reciever #307

Closed
hajsf opened this issue Dec 23, 2022 · 2 comments
Closed

TemplateMessage is not appearing at iphone reciever #307

hajsf opened this issue Dec 23, 2022 · 2 comments

Comments

@hajsf
Copy link

hajsf commented Dec 23, 2022

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
Copy link
Owner

tulir commented Dec 23, 2022

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

@tulir tulir closed this as not planned Won't fix, can't repro, duplicate, stale Dec 23, 2022
@codespearhead
Copy link

codespearhead commented Dec 24, 2022

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] pedroslopez/whatsapp-web.js#1707

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants