Skip to content

Bug: API /chat/archive - interface conversion: interface {} is *events.Archive, not map[string]interface {} (v0.7.2) #101

Description

@tuGusz

Welcome!

  • Yes, I have searched for similar issues on GitHub and found none.

What did you do?

Tentei arquivar um chat utilizando o endpoint /chat/archive através de um pedido POST.

const response = await fetch(`http://<O_MEU_URL_DA_API>/chat/archive`, {
    method: 'POST',
    headers: { 'Content-Type': 'application/json', 'apikey': '<A_MINHA_API_KEY>' },
    body: JSON.stringify({ "chat": "5511999999999@s.whatsapp.net" }) 
});

What did you expect?

Esperava que o chat fosse arquivado com sucesso e que o evento fosse processado sem causar a interrupção (crash) das goroutines internas.

What did you observe instead of what you expected?

O chat não é arquivado. A resposta da API não mostra um erro explícito imediatamente, mas ao verificar os logs do contentor Docker, o event handler interno entra em Panic.
É lançado um erro de interface conversion especificamente no ficheiro whatsmeow.go ao tentar processar o evento *events.Archive, onde tenta, erradamente, converter o evento para map[string]interface{} em vez da sua estrutura correta.

O que ocorre é que o EvoGo espera que passamos o parâmetro no body "chat: JID". Mas na realidade se a gente colocar body: JSON.stringify({ "number": "5511999999999@s.whatsapp.net" }) o erro não ocorre, porém o chat não é arquivado

Screenshots/Videos

No response

Which version are you using?

v0.7.2 (Imagem Docker evoapicloud/evolution-go:0.7.2)

What is your environment?

Linux

If applicable, paste the log output

Note que a falha ocorre perto da linha whatsmeow.go:1820:

Plaintext
20:15:31.654 [Client ERROR] Event handler panicked while handling a *events.Archive: interface conversion: interface {} is *events.Archive, not map[string]interface {}
goroutine 3458 [running]:
runtime/debug.Stack()
        /usr/local/go/src/runtime/debug/stack.go:26 +0x5e
go.mau.fi/whatsmeow.(*Client).dispatchEvent.func1()
        /go/pkg/mod/go.mau.fi/whatsmeow@v0.0.0-20260630180629-b572e5bcb92b/client.go:929 +0x78
panic({0x16f3720?, 0xc0014ea2d0?})
        /usr/local/go/src/runtime/panic.go:783 +0x132
[github.com/evolution-foundation/evolution-go/pkg/whatsmeow/service.(*MyClient).myEventHandler](https://github.com/evolution-foundation/evolution-go/pkg/whatsmeow/service.(*MyClient).myEventHandler)(0xc000186780, {0x15dfb80, 0xc0013e2910})
        /build/pkg/whatsmeow/service/whatsmeow.go:1820 +0xf7b5
[github.com/evolution-foundation/evolution-go/pkg/whatsmeow/service.whatsmeowService.StartClient.(*Client).AddEventHandler.func1](https://github.com/evolution-foundation/evolution-go/pkg/whatsmeow/service.whatsmeowService.StartClient.(*Client).AddEventHandler.func1)({0x15dfb80?, 0xc0013e2910?})
        /go/pkg/mod/go.mau.fi/whatsmeow@v0.0.0-20260630180629-b572e5bcb92b/client.go:770 +0x22
go.mau.fi/whatsmeow.(*Client).dispatchEvent(0x540a3a?, {0x15dfb80, 0xc0013e2910})
2026/07/03 20:15:31 [INFO] [<INSTANCE_UUID>] App state event received timestamp:1783120530628 pinAction:{pinned:false}
        /go/pkg/mod/go.mau.fi/whatsmeow@v0.0.0-20260630180629-b572e5bcb92b/client.go:933 +0xdd
go.mau.fi/whatsmeow.(*Client).sendAppState.func2()
        /go/pkg/mod/go.mau.fi/whatsmeow@v0.0.0-20260630180629-b572e5bcb92b/appstate.go:598 +0x38
created by go.mau.fi/whatsmeow.(*Client).sendAppState in goroutine 2698
        /go/pkg/mod/go.mau.fi/whatsmeow@v0.0.0-20260630180629-b572e5bcb92b/appstate.go:596 +0xab8

2026/07/03 20:15:32 [INFO] [<INSTANCE_UUID>] App state event received timestamp:1783120531478 archiveChatAction:{archived:true messageRange:{lastMessageTimestamp:1783120501 messages:{key:{remoteJID:"<ANONYMIZED_LID>@lid" fromMe:false ID:"<MSG_ID_1>"} timestamp:1783120501} messages:{key:{remoteJID:"<ANONYMIZED_LID>@lid" fromMe:true ID:"<MSG_ID_2>"} timestamp:1783120522}}}
2026/07/03 20:15:32 [WARN] [<INSTANCE_UUID>] ===== WEBHOOK SKIPPED ===== doWebhook=false
20:15:32.477 [Client ERROR] Event handler panicked while handling a *events.Archive: interface conversion: interface {} is *events.Archive, not map[string]interface {}
goroutine 3437 [running]:
runtime/debug.Stack()
        /usr/local/go/src/runtime/debug/stack.go:26 +0x5e

Additional Notes

Na versão 0.7.1 o body com "chat", funciona bem não retorna erros.

const response = await fetch(`http://<O_MEU_URL_DA_API>/chat/archive`, {
    method: 'POST',
    headers: { 'Content-Type': 'application/json', 'apikey': '<A_MINHA_API_KEY>' },
    body: JSON.stringify({ "chat": "5511999999999@s.whatsapp.net" }) 
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions