标签: webhooks

使用 PHP 转换 WooCommerce Webhook 有效负载

我已经使用 WooCommerce 设置了我的第一个 Webhook,以便在下新订单时通知我的数据库服务器。Webhook 已设置并由我的服务器发送/接收 - 我不想编写一个 PHP 页面来解析 Webhook 的有效负载,以便我可以将带有订单详细信息的新记录写入我的 CRM 数据库。

我在获取 Webhook 的内容时遇到问题。根据 WooCommerce 内部 Webhook 的日志,请求详细信息为(我缩写了内容 JSON 数据):

Headers:

 user-agent: WooCommerce/2.6.4 Hookshot (WordPress/4.6.1)
 content-type: application/json
 x-wc-webhook-source: http://example.com/
 x-wc-webhook-topic: order.created
 x-wc-webhook-resource: order
 x-wc-webhook-event: created
 x-wc-webhook-signature: xxxxxxxxxxxxxxxxxxx=
 x-wc-webhook-id: 3233
 x-wc-webhook-delivery-id: 94

Content:

{"order":{"id":3242,"order_number":3242,"order_key":"wc_order_57f1dbe5bcf03","created_at":"2016-10-03T04:17:41Z", .....
Run Code Online (Sandbox Code Playgroud)

它正在执行 POST 请求,但我无法检索 POST 数据,例如

$postData = var_export($_POST, true);       
error_log($postData, 0);
Run Code Online (Sandbox Code Playgroud)

不返回任何 JSON 数据。我正在寻求以下方面的帮助:

  1. 检索 Webhook 在 POST 请求中发送的 JSON 数据
  2. 帮助了解如何解析 JSON 的每个元素以插入到适当的数据库字段中

php wordpress json webhooks woocommerce

2
推荐指数
1
解决办法
3678
查看次数

将 Stripe webhooks 与 graphql-yoga 和 Prisma 结合使用

我在寻找如何拦截应用程序中的 Stripe webhook 调用时遇到了一些困难。我使用 graphql-yoga (express) 和 prisma。

我必须监听来自 Stripe 的付款失败呼叫,以便我可以编辑相应的用户配置文件。

谢谢您的帮助!

Stripe webhook 调用如下所示:

{
  "created": 1326853478,
  "id": "charge.expired_00000000000000",
  "type": "charge.expired",
  "object": "event",
  "request": null,
  "pending_webhooks": 1,
  "data": {
    "object": {
      "id": "ch_00000000000000",
      "object": "charge",
      "amount": 100,
      "captured": false,
      "created": 1537153592,
      "currency": "usd",
      "customer": null,
      "description": "My First Test Charge (created for API docs)",
      "invoice": null,
      "livemode": false,
      "on_behalf_of": null,
      "order": null,
      "outcome": null,
      "paid": true,
      "receipt_email": null,
      "receipt_number": null,
      "refunded": false,
      "review": null,
      "shipping": null,
      "source": {
        "id": …
Run Code Online (Sandbox Code Playgroud)

webhooks express stripe-payments graphql prisma

2
推荐指数
1
解决办法
1727
查看次数

如何设置 Raspberry Pi 3 B+ 以将更新自动部署到私有 Github 存储库?

我购买了 Pi 3 B+,并希望它能够从私人 github 存储库自动克隆/部署新推送(来自另一台机器)。我只是想知道我会怎么做。我知道我需要一个 github web hook,但我不知道从哪里开始。Pi 将位于一个我不想经常去更新我的代码的地方,因此这将使一切变得更加容易。谢谢

github webhooks raspberry-pi3

2
推荐指数
1
解决办法
6880
查看次数

Asp.net Webforms:为 typeform 创建 webhook 接收器

我如何使用 Typeform 的 asp.net Web 表单制作 webhook 接收器,以及每当有人提交我的表单时我如何获取我的应用程序上的数据。

asp.net webforms webhooks typeform

2
推荐指数
1
解决办法
1509
查看次数

ASPNET 等待网页上的 Webhook 响应/结果

我们有一个接受 Stripe 付款的网页,一旦付款完成,Stripe 就可以调用我们服务器上的 webhook。

此时,我们可以将订单标记为完成并完成任何其他附加任务。

我们如何让订单网页更新/将用户移至订单完成?

我们是否应该持续访问 AJAX 中的服务器来检查它是否已完成,或者是否有更好的方法来执行此操作。

asp.net-mvc webhooks asp.net-mvc-4 stripe-payments asp.net-webhooks

2
推荐指数
1
解决办法
1753
查看次数

发票到期前多少天会调用invoice.upcoming webhook?

Stripe 文档对此确实含糊不清:

https://stripe.com/docs/billing/webhooks

续订前几天,您的网站会在 Webhook 端点收到一个发票.即将到来的事件您可以侦听此事件以将额外的发票项目添加到订阅草稿发票中。

https://stripe.com/docs/billing/lifecycle

当订阅接近其续订日期时,将发送一个invoice.upcoming 事件。


invoice.upcoming有谁知道网络钩子和实际发票之间大约有多少时间?“几天”可能是 2-5 天,具体取决于您询问的对象。

webhooks stripe-payments

2
推荐指数
1
解决办法
1436
查看次数

ASP.Net Core 解析 Stripe Webhook JSON 响应

我正在我的 ASP.Net Core 应用程序中使用 Stripe/Stripe.net Webhooks。我正在尝试映射一个对象,在其中可以使用从 Webhook JSON 响应返回的属性并将各种属性保存到我的数据库中。使用 Postman,我能够接收从 Controller 方法中的 Stripe 测试 Webhooks 获得的示例 JSON,并使用解析 JSON

var json = await new StreamReader(HttpContext.Request.Body).ReadToEndAsync();
Event stripeEvent = EventUtility.ParseEvent(json);
Run Code Online (Sandbox Code Playgroud)

返回:

stripeEvent = {<Stripe.Event@2269235 id=evt_00000000000000> JSON: {"id": "evt_00000000000000", "object": "event", "account": null, "api_version": "2020-03-02", "created": 1326853478, "data": {    "object": { "id": "ch_00000000000000", "...
Run Code Online (Sandbox Code Playgroud)

我需要将 JSON 从 RawObject ChildrenTokens 映射到模型中,但我无法通过 C# 访问 ChildrenTokens。有什么方法能够映射这些属性吗?

c# json webhooks stripe-payments asp.net-core

2
推荐指数
1
解决办法
2021
查看次数

使用 python 创建 Discord Webhook

使用 python 创建 Discord Webhook 我最近正在使用 python 开发一个 Discord 机器人。我的不和谐机器人需要通过“DISCORD WEBHOOK”发送消息。问题是我找不到使用 python 自动创建不和谐 webhook 的方法!有什么办法可以做到吗!

import discord
client = discord.Client()
@client.event
async def on_message(message):
    if message.content == 'createhook':
        #code to create a webhook in that current channel
client.run("token")
Run Code Online (Sandbox Code Playgroud)

python webhooks discord discord.py

2
推荐指数
1
解决办法
1万
查看次数

Webhooks 的 NodeJS 监听器返回空主体

我已经这样做了大约两天,准备拔掉我的头发。

我有一个系统,可以触发我需要捕获和解析的简单 Webhooks。我创建了一个非常简单的 Nodejs 监听器,并运行 Ngrok 来创建公共地址。我收到一个请求,但无论我做什么,主体都是空的。与内容类型或 app.use(bodyParser.urlencoded()) 无关。

主体仍然返回为 {}

'use strict'

const express = require('express')
const bodyParser = require('body-parser')

// Create a new instance of express
const app = express()

// Tell express to use the body-parser middleware and to not parse extended bodies
app.use(bodyParser.json())
app.use(bodyParser.urlencoded({ extended: false }))

// Route that receives a POST request to /sms
app.post('/', function (req, res) {
    console.log(req);
  const body = req.body
  console.log("body")
  console.log(body);
  res.set('Content-Type', 'text/plain')
  res.send(`You sent: ${body} to Express`)
}) …
Run Code Online (Sandbox Code Playgroud)

webhooks node.js express

2
推荐指数
1
解决办法
1811
查看次数

Azure Devops 管道的传入 webhook 触发器:“找不到给定 webHookId 的 webhook”

我尝试在项目中设置传入的 Webhook 以触发 yaml 管道。设置与传入 Webhook 的服务连接。将 yaml 片段添加到管道中,如下所示:

resources:
  webhooks:
    - webhook: testtrigger          ### Webhook alias
      connection: testconnection   ### Incoming webhook service connection
Run Code Online (Sandbox Code Playgroud)

当通过curl:调用url时curl -X POST 'https://dev.azure.com/<my org>/_apis/public/distributedtask/webhooks/testtrigger?api-version=6.0-preview' -d '{ "tags": {} }' -H "Content-Type: application/json",我总是收到错误消息:

{"$id":"1","innerException":null,"message":"Cannot find webhook for the given webHookId testtrigger. Try enabling CD trigger for this artifact.","typeName":"Microsoft.TeamFoundation.DistributedTask.Pipelines.Artifacts.WebHooks.WebHookException, Microsoft.TeamFoundation.DistributedTask.Orchestration.Server","typeKey":"WebHookException","errorCode":0,"eventId":3000}
Run Code Online (Sandbox Code Playgroud)

尝试在触发器/连接上使用不同的名称,但没有任何效果。我缺少什么想法吗?

azure webhooks azure-pipelines azure-devops-pipelines

2
推荐指数
1
解决办法
4386
查看次数