3

ニュースレターの購読解除リンクに問題があり、何が間違っているのかわかりません。

ニュースレターのリンクは<a title="Unsubscribe" data-msys-unsubscribe="1" href="https://example.com/en/site/unsubscribe">Unsubscribe</a>".

同じターゲット URL で Webhook を作成しましたが、「そうそう! 2016 年 3 月 4 日午前 10:02 に最後に成功したバッチが配信されました」と表示されているため、トリガーされているようです。

私はこれをPHPで実装していますが、最初は正しく読んでいないと思いました(file_get_contents('php://input')しかし、Sparkpost WebhookインターフェースからTESTを試したときの応答は次のvar_dump(file_get_contents('php://input'))とおりでした:

HTTP/1.1 200
Date: Fri, 04 Mar 2016 09:17:57 GMT
Server: Apache
X-Powered-By: PHP/5.5.32
Content-Length: 1290
Connection: close
Content-Type: text/html; charset=utf-8

"<pre>string(1254) \"[{\"msys\":{\"unsubscribe_event\":{\"type\":\"list_unsubscribe\",\"campaign_id\":\"Example Campaign Name\",\"customer_id\":\"1\",\"event_id\":\"92356927693813856\",\"friendly_from\":\"sender@example.com\",\"mailfrom\":\"recipient@example.com\",\"message_id\":\"0e0d94b7-9085-4e3c-ab30-e3f2cd9c273e\",\"rcpt_meta\":{\"customKey\":\"customValue\"},\"rcpt_tags\":[\"male\",\"US\"],\"rcpt_to\":\"recipient@example.com\",\"raw_rcpt_to\":\"recipient@example.com\",\"rcpt_type\":\"cc\",\"subaccount_id\":\"101\",\"template_id\":\"templ-1234\",\"template_version\":\"1\",\"timestamp\":1454442600,\"transmission_id\":\"65832150921904138\"}}},{\"msys\":{\"unsubscribe_event\":{\"type\":\"link_unsubscribe\",\"campaign_id\":\"Example Campaign Name\",\"customer_id\":\"1\",\"event_id\":\"92356927693813856\",\"friendly_from\":\"sender@example.com\",\"mailfrom\":\"recipient@example.com\",\"message_id\":\"0e0d94b7-9085-4e3c-ab30-e3f2cd9c273e\",\"rcpt_meta\":{\"customKey\":\"customValue\"},\"rcpt_tags\":[\"male\",\"US\"],\"rcpt_to\":\"recipient@example.com\",\"raw_rcpt_to\":\"recipient@example.com\",\"rcpt_type\":\"cc\",\"subaccount_id\":\"101\",\"template_id\":\"templ-1234\",\"template_version\":\"1\",\"timestamp\":1454442600,\"transmission_id\":\"65832150921904138\",\"user_agent\":\"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.118 Safari/537.36\"}}}]\"\nstring(2) \"qq\"\n"

ニュースレターの購読解除リンクをクリックしたときの同じダンプは、空の文字列 ( string(0) "") です。

私は何か間違ったことをしていますか?

4

2 に答える 2

1

I was having the same problem. I think that the URL from the unsubscribe link doesn't need to be the same as the webhook.

Instead of printing the result to the screen, write it to a file. You'll see that after some seconds/minutes from your click on the unsubscribe link, it will have the data.

于 2016-03-22T13:26:34.127 に答える