【问题标题】:Custom Webhook Receiver in .Net core 2.1.Net core 2.1 中的自定义 Webhook 接收器
【发布时间】:2018-09-26 11:10:43
【问题描述】:

我正在尝试为 bigcommerce 网络钩子创建网络钩子接收器。

[HttpPost("customer_update")]
public void GetCustomerUpdateHook()
{
    d_logger.Information("Process Webhook reply Web Response Hit");            
}

我的功能没有任何问题。但我不知道如何访问接收数据。我不知道如何使用 WebHookHandler。

框架 => .Net 核心 2.1 控制器 => API 控制器

【问题讨论】:

    标签: asp.net-core-webapi bigcommerce asp.net-webhooks


    【解决方案1】:

    我能够接收数据,而无需使用 webhook 处理程序或接收器。我刚刚通过从请求正文中获取数据在我的控制器中创建了一个“POST”方法。

    [HttpPost("customer_update")]
    public void GetCustomerUpdateHook([FromBody] WebhookResponse p_data)
    {
        d_logger.Information("Process Webhook reply Web Response Hit"); 
        var dataAsString = Newtonsoft.Json.JsonConvert.SerializeObject(p_data);
        d_logger.Information("Response ==> {@data}", dataAsString);           
    }
    

    WebhookResponse 类必须与您获取的数据相匹配。对于发件人身份验证,我在 Bigcommerce webhooks 注册中添加了自定义标头。

    【讨论】:

      猜你喜欢
      • 2021-08-12
      • 2018-12-31
      • 2017-12-17
      • 2019-03-10
      • 1970-01-01
      • 2019-01-08
      • 1970-01-01
      • 1970-01-01
      • 2020-11-20
      相关资源
      最近更新 更多