Closed larryhjl closed 1 month ago
Hello! Thank you for filing an issue.
If this is a bug report, please include relevant logs to help us debug the problem.
Join slack 🤖 to connect and communicate with our developers.
从 open-im-server webhook模块源代码来看,你的路径需要配置为 /callbackExample/:command
并且你的配置不对,应该没有callback这个最外层的key, 从代码上来看 “https://docs.openim.io/zh-Hans/restapi/webhooks/example ” 文档已经过时了
Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑🤝🧑👫🧑🏿🤝🧑🏻👩🏾🤝👨🏿👬🏿
And your configuration is wrong. There should be no outermost key called callback. From the code point of view, the document "https://docs.openim.io/zh-Hans/restapi/webhooks/example" is out of date.
从 open-im-server webhook模块源代码来看,你的路径需要配置为 /callbackExample/:command
这个command是beforeSendSingleMsg或afterSendSingleMsg吗
是这样吗?
Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑🤝🧑👫🧑🏿🤝🧑🏻👩🏾🤝👨🏿👬🏿
is that so?
是这样吗?
应该不是,我记得前面有callback啥的。可以看看open-im-server原代码,不确定就弄成动态即可
Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑🤝🧑👫🧑🏿🤝🧑🏻👩🏾🤝👨🏿👬🏿
是这样吗! InR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250 ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjY2NDQ4MTksIm5iZiI6MTcyNjY0NDUxOSwic GF0aCI6Ii8xMjYzNjYxODYvMzY4NDYzODMwLThhZmRkMWE2LWRlMTAtNDdhYi05OGU4LTA3OTQ 2NjUzYjE0Mi5qcGc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZ GVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwOTE4JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDkxOFQwNzI4MzlaJlgtQW16LUV 4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0xY2Q1MWFjZDVjOWRhMGE0NGU0MGFlYTB kYjI5NDNjZmU4ODc5Y2E2M2I5MzM0NzQzMTQyMWVkZmZhYjI3MWIxJlgtQW16LVNpZ25 lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.kgkLwQcVFEnb9DCRCjbiPdLSceuVNEVdqxKe4teKWU)! [openim2](https://private-user-images.githubusercontent.com/126366186/368463841-a40378d8-781d-43fd-a6a5-7d208165b8aa.jpg?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ pc3MyOiJna YxODYvMzY4NDYzODQxLWE0MDM3OGQ4LTc4MWQtNDNmZC1hNmE1LTdkMjA4MTY1YjhhYS5qcGc _WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lB VkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwOTE4JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDkxOFQwNzI4MzlaJlgtQW16LUV4cGlyZXM9MzAwJ lgtQW16LVNpZ25hdHVyZT0zOWM3Zjk5OTJkYzFjY2NiODY3MDAwNjY0MTI3NTUyYWNiNjBlZjhkZGQ4ZTcxYzVkMDNiN2JkZWYzOTQ0MDhjJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9 zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.mjaGeDQVTOmQ4X643vbR6vXu7BCHp-AAb4GfQTwMcD4)
Contact us for more information about open-im-server
是这样吗?
应该不是,我记得前面有callback啥的。可以看看open-im-server原代码,不确定就弄成动态即可
你这里有webhooks.yaml配置正确的示例看看吗
Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑🤝🧑👫🧑🏿🤝🧑🏻👩🏾🤝👨🏿👬🏿
是这样吗? [OpenIM2] IISINR5CCI6IKPXVCj9.Eyjpc3MIIIJNAXRDWIY29TIIIWIYXVKIJOICMF3LMDDGH1 II6MTCYNJY0DUXOSWICOGF0ACI6I8XMJYZNJYXODYVMIZY4NDYZODQXLWE0MDM3O GHTPUFXUZQTSE1BQY1TSEYNTYMWC1BXOQQ3JLZVUDGLHBD1BS0LBKNPRFRFLMUMUMU0E1M1BRSZRAQSUYRJIWMHQWOTE4JTJGDXMTZWFZDCDC0XJTJGCMLMKHD3M0X 3jlcxvlc3qmwc1bxotrgf0ztttdi0mdkxofqwnzi4mzlajlgttw16luv4cgly 0mti3ntuyywninjblzjhkgggtcxyzvkmdnin2jkwyzotqqq0mdhjlgtttw16lvn .Mjageedqvtomq4x643vbr6vxu7bchp-ab4gfqtwmcd4)
Callback
你这里有webhooks.yaml配置正确的示例看看吗
Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑🤝🧑👫🧑🏿🤝🧑🏻👩🏾🤝👨🏿👬🏿
是这样吗? [OpenIM2] IISINR5CCI6IKPXVCj9.Eyjpc3MIIIJNAXRDWIY29TIIIWIYXVKIJOICMF3LMDDGH1 II6MTCYNJY0DUXOSWICOGF0ACI6I8XMJYZNJYXODYVMIZY4NDYZODQXLWE0MDM3O GHTPUFXUZQTSE1BQY1TSEYNTYMWC1BXOQQ3JLZVUDGLHBD1BS0LBKNPRFRFLMUMUMU0E1M1BRSZRAQSUYRJIWMHQWOTE4JTJGDXMTZWFZDCDC0XJTJGCMLMKHD3M0X 3jlcxvlc3qmwc1bxotrgf0ztttdi0mdkxofqwnzi4mzlajlgttw16luv4cgly 0mti3ntuyywninjblzjhkgggtcxyzvkmdnin2jkwyzotqqq0mdhjlgtttw16lvn .Mjageedqvtomq4x643vbr6vxu7bchp-ab4gfqtwmcd4)
Callback
你这里有webhooks.yaml配置正确的示例看看吗
你现在webhooks.yaml配置是正确的, 这是我业务服务器的路由
Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑🤝🧑👫🧑🏿🤝🧑🏻👩🏾🤝👨🏿👬🏿
Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑🤝🧑👫🧑🏿🤝🧑🏻👩🏾🤝👨🏿👬🏿
是这样吗? ![openim1](https://private-user-images.githubusercontent.com/126366186/368463830-8afdd1a6-de10-47ab-98e8-07946653b142.jpg?jwt=eyJhbGciOiJIUzI1N iIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJj b250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjY2NDQ4MTksIm5iZiI6MTcyNjY0NDUx OSwicGF0aCI6Ii8xMjYzNjYxODYvMzY4NDYzODMwLThhZmRkMWE2LWRlMTAtNDdhYi05OGU4LTA3OTQ2NjUzYjE0Mi5qcGc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3 JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwOTE4JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDkxOFQwNzI4MzlaJlgtQW1 6LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0xY2Q1MWFjZDVjOWRhMGE0NGU0MGF lYTBkYjI5NDNjZmU4ODc5Y2E2M2I5MzM0NzQzMTQyMWVkZmZhYjI3MWIxJlgtQW16LVNp Z25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.kgkLwQcVFEnb9DCRGCjbiPdLSceuVNEVdqxKe4teKWU ) [OpenIM2] IISINR5CCI6IKPXVCj9.Eyjpc3MIIIJNAXRDWIY29TIIIWIYXVKIJOICMF3LMDDGH1 II6MTCYNJY0DUXOSWICOGF0ACI6I8XMJYZNJYXODYVMIZY4NDYZODQXLWE0MDM3O GHTPUFXUZQTSE1BQY1TSEYNTYM Wc1B 4cgly 0mti3ntuyywninjblzjhkgggtcxyzvkmdnin2jkwyzotqqq0mdhjlgtttw16lvn .Mjageedqvtomq4x643vbr6vxu7bchp-ab4gfqtwmcd4)
Callback
你这里有webhooks.yaml配置正确的示例看看吗
你现在webhooks.yaml配置是正确的, 这是我业务服务器的路由
Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑🤝🧑👫🧑🏿🤝🧑🏻👩🏾🤝👨🏿👬🏿
是这样吗? [OpenIM2] IISINR5CCI6IKPXVCj9.Eyjpc3MIIIJNAXRDWIY29TIIIWIYXVKIJOICMF3LMDDGH1 II6MTCYNJY0DUXOSWICOGF0ACI6I8XMJYZNJYXODYVMIZY4NDYZODQXLWE0MDM3O GHTPUFXUZQTSE1BQY1TSEYNTYMWC1BXOQQ3JLZVUDGLHBD1BS0LBKNPRFRFLMUMUMU0E1M1BRSZRAQSUYRJIWMHQWOTE4JTJGDXMTZWFZDCDC0XJTJGCMLMKHD3M0X 3jlcxvlc3qmwc1bxotrgf0ztttdi0mdkxofqwnzi4mzlajlgttw16luv4cgly 0mti3ntuyywninjblzjhkgggtcxyzvkmdnin2jkwyzotqqq0mdhjlgtttw16lvn .Mjageedqvtomq4x643vbr6vxu7bchp-ab4gfqtwmcd4)
Callback
你这里有webhooks.yaml配置正确的示例看看吗
你现在webhooks.yaml配置是正确的, 这是我业务服务器的路由
我看了日志,都没调用配置的URL
Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑🤝🧑👫🧑🏿🤝🧑🏻👩🏾🤝👨🏿👬🏿
是这样吗? [OpenIM2] IISINR5CCI6IKPXVCj9.Eyjpc3MIIIJNAXRDWIY29TIIIWIYXVKIJOICMF3LMDDGH1 II6MTCYNJY0DUXOSWICOGF0ACI6I8XMJYZNJYXODYVMIZY4NDYZODQXLWE0MDM3O GHTPUFXUZQTSE1BQY1TSEYNTYMWC1BXOQQ3JLZVUDGLHBD1BS0LBKNPRFRFLMUMUMU0E1M1BRSZRAQSUYRJIWMHQWOTE4JTJGDXMTZWFZDCDC0XJTJGCMLMKHD3M0X 3jlcxvlc3qmwc1bxotrgf0ztttdi0mdkxofqwnzi4mzlajlgttw16luv4cgly 0mti3ntuyywninjblzjhkgggtcxyzvkmdnin2jkwyzotqqq0mdhjlgtttw16lvn .Mjageedqvtomq4x643vbr6vxu7bchp-ab4gfqtwmcd4)
Callback
你这里有webhooks.yaml配置正确的示例看看吗
你现在webhooks.yaml配置是正确的, 这是我业务服务器的路由
我看了日志,都没调用配置的URL
我这边是没有问题可以调用的。你应该去看 im 的日志,有发起webhook请求的话,就去检查你的业务服务器是不是哪里不对
I handled callbacks this way in Java projects and successfully validated them in production environments. openim config:
callback:
url: "http://xxxxx.com/webhook"
java controller:
@RequestMapping("/webhook/{cmd}")
public String openIMWebHook(@PathVariable("cmd") String cmd, HttpServletRequest request){
String requestData = readRequestData(request);
// WebHookType.AFTER_SEND_SINGLE_MSG value is "callbackAfterSendSingleMsgCommand"
if(WebHookType.AFTER_SEND_SINGLE_MSG.equals(cmd)){
return webHookService.afterSendSingleMsg(requestData);
}
return "not match cmd";
}
private String readRequestData(HttpServletRequest request){
StringBuilder body = new StringBuilder(2048);
try (BufferedReader reader = request.getReader()) {
char[] chars = new char[1024];
int read;
while ((read = reader.read(chars)) != -1) {
body.append(chars, 0, read);
}
} catch (Exception ignored) { }
return body.toString();
}
是这样吗?
According to this configuration, the webhook route for beforeSendSingleMsg is http://xxx/robot/callbackExample/callbackBeforeSendSingleMsgCommand. You can check if the open route path is correct. If the log level is above 4, you can filter the logs by the keyword “webhook” and the webhook URL to confirm whether the webhook has been called.
docker部署方式,在哪里修改webhooks的配置文件?
Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑🤝🧑👫🧑🏿🤝🧑🏻👩🏾🤝👨🏿👬🏿
Docker deployment method, where to modify the configuration file of webhooks?
按以上文档在.env 文件中增加了IMENV_WEBHOOKS_URL=http://***:8080/callback IMENV_WEBHOOKS_BEFORESENDGROUPMSG_ENABLE=true IMENV_WEBHOOKS_AFTERSENDGROUPMSG_ENABLE=true 然后docker-compose down 和 docker-compose up -d重启容器,还是未收到回调信息,openim-server服务也未打印相关webhooks日志
I'm sorry our documentation wasn't clear enough. The file that needs to be modified is the docker-compose.yml file, and the changes should be added under the environment section of openim-server. We will update the documentation to make this clearer.
OpenIM Server Version
3.8.0
Operating System and CPU Architecture
Linux (AMD)
Deployment Method
Source Code Deployment
Bug Description and Steps to Reproduce
按照 https://docs.openim.io/zh-Hans/restapi/webhooks/example 教程文档配置,回调服务器接口是用java写的,配置了beforeSendSingleMsg和afterSendSingleMsg的enable为true,但发送单聊消息之前和之后都没有回调接口,用的web端发送消息
Screenshots Link