fixed bug in json-rpc webhook

* only post messages that were received via 'receive'

see #813
This commit is contained in:
Bernhard B 2026-03-14 15:54:49 +01:00
parent eeacb488ad
commit 07260c0811

View File

@ -233,13 +233,6 @@ func (r *JsonRpc2Client) ReceiveData(number string, receiveWebhookUrl string) {
}
log.Debug("json-rpc received data: ", str)
if receiveWebhookUrl != "" {
err = postMessageToWebhook(receiveWebhookUrl, []byte(str))
if err != nil {
log.Error("Couldn't post data to webhook: ", err)
}
}
var resp1 JsonRpc2ReceivedMessage
json.Unmarshal([]byte(str), &resp1)
if resp1.Method == "receive" {
@ -254,6 +247,13 @@ func (r *JsonRpc2Client) ReceiveData(number string, receiveWebhookUrl string) {
continue
}
r.receivedMessagesMutex.Unlock()
if receiveWebhookUrl != "" {
err = postMessageToWebhook(receiveWebhookUrl, []byte(str))
if err != nil {
log.Error("Couldn't post data to webhook: ", err)
}
}
}
var resp2 JsonRpc2MessageResponse