2014-01-23 16 views
3

我試圖處理Mandrill的webhook數據時,我得到一個反彈我想讓Mandrill告訴我的應用程序它是哪個電子郵件並將各種數據保存在MySql數據庫中。處理Mandrill Webhook數據

我在這裏使用PHP,根據Mandrill他們發送一個URL,我給他們一個帶有JSON數據的$ _POST請求。

通常我會json_decode()這個請求,但是當我這樣做的時候,它看起來是空白的。對我來說,JSON看起來格式不正確,但也許我需要先用它做點什麼?

這是我收到我的腳本:

[mandrill_events] => 
[{\"event\":\"hard_bounce\",\"msg\":{\"ts\":1365109999,\"subject\":\"This an example webhook message\",\"email\":\"[email protected]\",\"sender\":\"[email protected]\",\"tags\":[\"webhook-example\"],\"state\":\"bounced\",\"metadata\":{\"user_id\":111},\"_id\":\"exampleaaaaaaaaaaaaaaaaaaaaaaaaa\",\"_version\":\"exampleaaaaaaaaaaaaaaa\",\"bounce_description\":\"bad_mailbox\",\"bgtools_code\":10,\"diag\":\"smtp;550 5.1.1 The email account that you tried to reach does not exist. Please try double-checking the recipient\'s email address for typos or unnecessary spaces.\"},\"_id\":\"exampleaaaaaaaaaaaaaaaaaaaaaaaaa\",\"ts\":1390483382},{\"event\":\"soft_bounce\",\"msg\":{\"ts\":1365109999,\"subject\":\"This an example webhook message\",\"email\":\"[email protected]\",\"sender\":\"[email protected]\",\"tags\":[\"webhook-example\"],\"state\":\"soft-bounced\",\"metadata\":{\"user_id\":111},\"_id\":\"exampleaaaaaaaaaaaaaaaaaaaaaaaaa1\",\"_version\":\"exampleaaaaaaaaaaaaaaa\",\"bounce_description\":\"mailbox_full\",\"bgtools_code\":22,\"diag\":\"smtp;552 5.2.2 Over Quota\"},\"_id\":\"exampleaaaaaaaaaaaaaaaaaaaaaaaaa1\",\"ts\":1390483382}] 
+1

試圖通過我們的工具運行爲:https:/ /www.runscope.com/docs/request-capture –

回答