I have a problem with unsubscribe link in newsletter and can't figure out what I'm doing wrong.
The link in the newsletter is <a title="Unsubscribe" data-msys-unsubscribe="1" href="https://example.com/en/site/unsubscribe">Unsubscribe</a>"
.
I have created a webhook with the same target URL and it seems te be getting triggered since it says "Oh yeah! Last successful batch delivered on March 04, 2016 10:02 am".
I'm implementing this in PHP and at first I thought I'm not reading it correctly (using file_get_contents('php://input')
but when I tried the TEST from Sparkpost webhook interface the response for var_dump(file_get_contents('php://input'))
was:
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"
The same dump when clicking on the unsubscribe link in newsletter is an empty string (string(0) ""
).
Am I doing something wrong?