繁体   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