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

Requesting historical messages fail #654

Open
jambazishvili opened this issue Sep 5, 2024 · 2 comments
Open

Requesting historical messages fail #654

jambazishvili opened this issue Sep 5, 2024 · 2 comments

Comments

@jambazishvili
Copy link

jambazishvili commented Sep 5, 2024

I try to retrieve messages from the group but no response is returned or event handler does not receive anything. The setup looks like this:

  1. Retrieve the device from store.
  2. Connect.
  3. Add event listeners (I am not sure if it is required, but using for other stuff)
  4. Build history sync request.
  5. Nothing happens

Below is the code:

WAClient := whatsmeow.NewClient(WADevice, logger)
WAClient.AddEventHandler(...)
if err = WAClient.Connect(); err != nil {
  logger.Errorf("failed to resume device %s", WADevice)
}

// ---

messageInfo := types.MessageInfo{
MessageSource: types.MessageSource{
	Chat:     groupJID,  // [email protected]
	IsGroup:  true,
	IsFromMe: false,
},
ID:        "xxx",
Timestamp: time.Now(),
}
histRequest := WAClient.BuildHistorySyncRequest(&messageInfo, 10)
extra := whatsmeow.SendRequestExtra{Peer: true}
res, err := WAClient.SendMessage(context.Background(), groupJID, histRequest, extra)

Once the message is sent, it logs this:

10:20:20.265 [wa WARN] Failed to fetch prekey for xxx:[email protected]: invalid prekey in prekey response: prekey node doesn't contain ID tag
10:20:20.265 [wa WARN] Failed to fetch prekey for xxx:[email protected]: invalid prekey in prekey response: prekey node doesn't contain ID tag

In the event listener, I do not get anything, res also does not contain messages, just timing information. Can you please suggest how to debug or if visible what I am doing wrong?

@DavidsonGomes
Copy link

I have the same problem

@ichabod-mo
Copy link

same question

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