如何创建自定义webhooks接收器 [英] How to create custom webhooks receiver
问题描述
目前我正在开发大型商务,并创建一个公共应用,
我的要求是当任何产品删除创建或更新Web挂钩并需要产品的某些细节时。我正在使用c#创建webhook。但是没有办法收到钩子响应。
我尝试过:
i am install Microsoft.Asp.net.WebHooks.receivers.custome和Microsoft.Asp.net.WebHooks.receivers
添加一个apicontroller
公共类BigCommerceReceiver:ApiController,IWebHookReceiver
{
public string Name => throw new NotImplementedException();
// GET api /< controller>
public IEnumerable< string>获取()
{
返回新字符串[] {value1,value2};
}
// GET api /< controller> / 5
public string Get(int id)
{
returnvalue;
}
// POST api /< controller>
// [HttpPost]
// [路线(api / webooks / include / productcreate)]
public void Post([FromBody] string value)
{
}
// PUT api /< controller> / 5
public void Put(int id,[FromBody] string value)
{
}
// DELETE api /< controller> / 5
public void删除(int id)
{
}
[HttpPost]
[Route(api / webooks / include / productdelete)]
public Task< HttpResponseMessage> ReceiveAsync(string id,HttpRequestContext context,HttpRequestMessage request)
{
throw new NotImplementedException();
}
}
但钩子响应未击中我的控制器。
您是否按照官方文档中有关如何设置WebHook接收器的说明进行操作: ASP.NET WebHooks接收器| Microsoft Docs [ ^
currently i am working in bigcommerce, and create a public app,
my requirement is when any product delete create or update a web hook fire and need some details of the product . I am creating the webhooks using c#. But there is no way to receive the hook response.
What I have tried:
i am install Microsoft.Asp.net.WebHooks.receivers.custome and Microsoft.Asp.net.WebHooks.receivers
the add a apicontroller
public class BigCommerceReceiver : ApiController,IWebHookReceiver { public string Name => throw new NotImplementedException(); // GET api/<controller> public IEnumerable<string> Get() { return new string[] { "value1", "value2" }; } // GET api/<controller>/5 public string Get(int id) { return "value"; } // POST api/<controller> //[HttpPost] //[Route("api/webooks/include/productcreate")] public void Post([FromBody]string value) { } // PUT api/<controller>/5 public void Put(int id, [FromBody]string value) { } // DELETE api/<controller>/5 public void Delete(int id) { } [HttpPost] [Route("api/webooks/include/productdelete")] public Task<HttpResponseMessage> ReceiveAsync(string id, HttpRequestContext context, HttpRequestMessage request) { throw new NotImplementedException(); } }
but hook response not hit my controller .
Have you followed the instructions from the official documentation on how to setup WebHook Receivers here: ASP.NET WebHooks receivers | Microsoft Docs[^]
这篇关于如何创建自定义webhooks接收器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!