私はnode.jsのAftership APIによって行われているPUT/webhookリクエストをキャッチしようとしています。プッシュ通知を行う必要があるたびにPUTリクエストが行われ、通知を送信するためにParseを使用していますが、ウェブフックからのデータが必要です。webhook node.jsをキャッチ
ウェブフックのヘッダがContent-Type: application/json
のように見え、このデータが含まれています。
TS - UTC UNIXタイムスタンプイベントが
イベントが発生したこと - イベントの名前(追跡更新のために、値を 'tracking_update')
msg - イベントが発生したメッセージの詳細は、 の形式で表示されます。
どのように私は追跡番号、スラグおよびカスタムフィールドでtoken
の値を取得しに行くかは、ノードまたはJS辞書?
{
"event": "tracking_update",
"msg": {
"id": "53aa94fc55ece21582000004",
"tracking_number": "906587618687",
"title": "906587618687",
"origin_country_iso3": null,
"destination_country_iso3": null,
"shipment_package_count": 0,
"active": false,
"order_id": null,
"order_id_path": null,
"customer_name": null,
"source": "web",
"emails": [],
"custom_fields": {},
"tag": "Delivered",
"tracked_count": 1,
"expected_delivery": null,
"signed_by": "D Johnson",
"shipment_type": null,
"tracking_account_number": null,
"tracking_postal_code": "DA15BU",
"tracking_ship_date": null,
"created_at": "2014-06-25T09:23:08+00:00",
"updated_at": "2014-06-25T09:23:08+00:00",
"slug": "dx",
"unique_token": "xk7LesjIgg",
"checkpoints": [{
"country_name": null,
"country_iso3": null,
"state": null,
"city": null,
"zip": null,
"message": "Signed For by: D Johnson",
"coordinates": [],
"tag": "Delivered",
"created_at": "2014-06-25T09:23:11+00:00",
"checkpoint_time": "2014-05-02T16:24:38",
"slug": "dx"
}]
},
"ts": 1403688191
}
はPUTリクエストのボディに送られ、このJSONのですか? – akonsu
@akonsuはい、私はそう信じています。 – Clip