我想制作一个webhook,以便更改集合中文档的状态。这将触发其他事件。你知道吗
Router.route('/mandrill/invitation_sent', { where: 'server' })
.post(function () {
var response = EJSON.parse(this.request.body.mandrill_events);
Players.update({
"email": {
"$in": _.map(_.where(response, {
event: 'send'
}), function (obj) {
return obj.msg.email;
})
}
}, {
"feed": {
"$push": {
title: "Player invited",
icon: "ios-player-invited"
}
}
})
});
});
然而。。。我不能直接手动发布到这个webhook吗?你知道吗
>>> import requests
>>> webhook_url = '<url>.com/mandrill/invitation_sent'
>>> payload = { 'mandrill_events': [{ 'event': 'send', 'msg': { 'email': 'foo@bar.com'}}]}
>>> requests.post(webhook_url, data=payload)
<Response [200]>
我如何知道请求来自可信来源?是否有一些规范的方法来确保webhook从可信的源接收数据?你知道吗
mandrillwebhook会对发送给您的请求进行身份验证。 查看their documentation。你知道吗
相关问题 更多 >
编程相关推荐