簡體   English   中英

如何從 Calendly webhook 獲取舉辦活動的用戶?

[英]How to get User who hosts the event from a Calendly webhook?

我從 Calendly 收到了一個invitee.created webhook,其中包含被邀請者的詳細信息。 我需要獲得對主持該事件的 Calendly 用戶的引用,以便我可以在我的應用程序中報告它(例如跟蹤與特定用戶預訂的會議)。 我怎么做?

如果您需要知道哪個 Calendly 用戶(或用戶,對於集體事件)預訂了該事件,您需要調用Get Event event_memberships數組將包含用戶引用 (URI) 列表。 下面是更詳細的分步指南。

  1. 您收到了事件invitee.created的 webhook。 有效載荷看起來像這樣:
{
  "created_at": "2020-11-23T17:51:19.000000Z",
  "created_by": "https://api.calendly.com/users/AAAAAAAAAAAAAAAA",
  "event": "invitee.created",
  "payload": {
    "cancel_url": "https://calendly.com/cancellations/AAAAAAAAAAAAAAAA",
    "created_at": "2020-11-23T17:51:18.327602Z",
    "email": "test@example.com",
    "event": "https://api.calendly.com/scheduled_events/GBGBDCAADAEDCRZ2",
    "name": "John Doe",
    "new_invitee": null,
    "old_invitee": null,
    "questions_and_answers": [],
    "reschedule_url": "https://calendly.com/reschedulings/AAAAAAAAAAAAAAAA",
    "rescheduled": false,
    "status": "active",
    "text_reminder_number": null,
    "timezone": "America/New_York",
    "tracking": {
      "utm_campaign": null,
      "utm_source": null,
      "utm_medium": null,
      "utm_content": null,
      "utm_term": null,
      "salesforce_uuid": null
    },
    "updated_at": "2020-11-23T17:51:18.341657Z",
    "uri": "https://api.calendly.com/scheduled_events/GBGBDCAADAEDCRZ2/invitees/AAAAAAAAAAAAAAAA",
    "canceled": false
  }
}

在這里, payload object 是Invitee 它有一個event字段,該字段是對受邀者預訂的事件的引用。

  1. webhook_data.payload.event進行 GET 調用 - 這將是Get Event操作。 響應將如下所示:
{
  "resource": {
    "uri": "https://api.calendly.com/scheduled_events/GBGBDCAADAEDCRZ2",
    "name": "15 Minute Meeting",
    "status": "active",
    "booking_method": "instant",
    "start_time": "2019-08-24T14:15:22Z",
    "end_time": "2019-08-24T14:15:22Z",
    "event_type": "https://api.calendly.com/event_types/GBGBDCAADAEDCRZ2",
    "location": {
      "type": "physical",
      "location": "Calendly Office"
    },
    "invitees_counter": {
      "total": 0,
      "active": 0,
      "limit": 0
    },
    "created_at": "2019-01-02T03:04:05.678Z",
    "updated_at": "2019-01-02T03:04:05.678Z",
    "event_memberships": [
      {
        "user": "https://api.calendly.com/users/GBGBDCAADAEDCRZ2"
      }
    ],
    "event_guests": []
  }
}

上面有效負載中的event_memberships數組是一組用戶,與他們一起安排了事件(如果是集體事件,可以是多個)。 然后,您可以對這些用戶 URI 執行 GET,或者將這些 URI 與您之前保存在數據庫中的 URI 進行比較。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM