如何在 clickfunnels 中创建 webhook 以向心愿单会员发送信息

问题描述 投票:0回答:3

clickfunnels 中的说明让我从创建测试端点 URL 开始:

。创建测试端点。

首先,您需要在

<your-domain/funnel_webhooks/test>

创建一个测试端点

它应该包含下面的标题。

Content-Type
application/json

X-Clickfunnels-Webhook-Delivery-Id
作为 URL 和 Payload 的 MD5。

有效负载(HTTP 消息正文)将是一个 JSON 对象,其键为“time”,值为 UTC 中的当前时间,如下所示:

{ "time": "YYYY-MM-DD HH:MM:SS UTC" }

我进入主机中的文件管理器,添加了一个 funnel_webhooks 文件夹和一个名为 test 的文件。

我想我将内容类型更改为 JSON 而且,我想我已经知道如何在文件中创建 JSON 对象了。 我不知道如何做这部分: X-Clickfunnels-Webhook-Delivery-Id 作为 URL 和负载的 MD5。

这个织机视频将显示我目前所处的过程。

https://www.loom.com/share/1c9be96014b8413a8c9ba54f56dd42a8

任何支持将不胜感激!

json webhooks
3个回答
1
投票

其实比你想象的要简单得多。他们只是想通过从您放置在服务器文件夹中的任何文件获取 200 响应来验证您是否拥有该域。

  1. 在服务器的根目录中创建此文件夹结构,并添加一个index.php文件或index.html文件,如下所示: /funnel_webhooks/test/index.php (为了更好的衡量,我在这个文件中写了“hello”)
  2. 转到“点击渠道”。单击您的漏斗。单击“设置”。滚动到底部并单击管理您的漏斗 Webhooks
  3. 使用 URL 创建一个新的 webhook:whateveryourdomain/funnel_webhooks/test/index.php
  4. 单击创建漏斗 Webhook 按钮 如果您的文件位于正确的位置,那么单击渠道将使用它来验证您是否拥有该域。

只要您使用这个经过验证的域名,您以后的所有 Webhooks 都可以正常工作。


0
投票

他们的文档很糟糕。

这是我的快速测试路线:

app.post("/test", async (req: express.Request, res: express.Response) => {
  const currentTime = new Date().toISOString();
    
  console.log(req.body); // This prints the contact/purchase object
  
  const status = 200;
    
  return res.status(status).json({
    text: "[SUCCESS]: text successful",
    ok: status < 300,
    data: currentTime
  });
});

我的端点是

https://us-central1-{SERVER_NAME}.cloudfunctions.net/funnel_webhooks/test
,其中
test
可以是您想要继续的任何其他端点,但
funnel_webhooks
是端点条目的必需部分。


-1
投票

让我试试吧!

您现在所做的只是创建一个 JSON 文件,该文件不会从 clickfunnel 获取 webhook 事件。

如果您的服务器与 PHP 兼容,请首先创建 PHP 文件。 只需在其中编写此代码并尝试一下即可。

<?php
    //set the headers.
    header("Content-Type: application/json;");
    header("X-Clickfunnels-Webhook-Delivery-Id : MD5 of CONTENTS HERE");
    
    
    //check if there is input data.
    if ($json = json_decode(file_get_contents("php://input"), true)) {
    
    
      //print and set the data as variable
      print_r($json);
      $data = $json;
    
    
    }else{
    
      //try getting the POST data.
      print_r($_POST);
      $data = $_POST;
    
    }
    
    
    //set the response as OK - 200
    http_response_code(200); //response code for OK.
    echo json_encode(array("status" => 'OK', "code" => 1, "payload" => $data));
    
    
    //save the data as a file to check the information that was sent by the webhook.
    $file = 'webhook_contents.txt';
    $current = file_get_contents($file);
    $current .= date("Y-m-d h:i:s").json_encode($data);
    file_put_contents($file, $current);
    
    
    
    // From here, it all depends on what you want to do with the webhook event data.
?>

此代码应该为您提供标头以获取 JSON 有效负载,并回显所述有效负载的响应。 同时,它应该创建一个名为“webhook_contents.txt”的文件,您应该能够在其中读取 webhook 事件负载。

如果有效请告诉我!

© www.soinside.com 2019 - 2024. All rights reserved.