简体   繁体   English

如何从 Calendly webhook 获取举办活动的用户?

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

I'm receiving an invitee.created webhook from Calendly, which contains Invitee details.我从 Calendly 收到了一个invitee.created webhook,其中包含被邀请者的详细信息。 I need to get a reference to the Calendly User that hosts the event, so that I can report on it in my application (eg keep track of meetings booked with a specific user).我需要获得对主持该事件的 Calendly 用户的引用,以便我可以在我的应用程序中报告它(例如跟踪与特定用户预订的会议)。 How do I do that?我怎么做?

If you need to know which Calendly User (or Users, for collective events ) the event was booked with, you need to call Get Event .如果您需要知道哪个 Calendly 用户(或用户,对于集体事件)预订了该事件,您需要调用Get Event The event_memberships array will contain a list of User references (URIs). event_memberships数组将包含用户引用 (URI) 列表。 Below is a more detailed step by step guide.下面是更详细的分步指南。

  1. You received a webhook for the event invitee.created .您收到了事件invitee.created的 webhook。 The payload looks something like this: 有效载荷看起来像这样:
{
  "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
  }
}

Here, the payload object is the Invitee .在这里, payload object 是Invitee It has an event field that is a reference to the Event that the Invitee booked.它有一个event字段,该字段是对受邀者预订的事件的引用。

  1. Make a GET call to webhook_data.payload.event - this will be the Get Event operation.webhook_data.payload.event进行 GET 调用 - 这将是Get Event操作。 The response will look like this:响应将如下所示:
{
  "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": []
  }
}

The event_memberships array in the above payload is an array of Users with whom the event is scheduled (can be more than one, if it's a collective event).上面有效负载中的event_memberships数组是一组用户,与他们一起安排了事件(如果是集体事件,可以是多个)。 You can then do a GET on these User URIs or just compare these URIs with what you've previously saved in the database.然后,您可以对这些用户 URI 执行 GET,或者将这些 URI 与您之前保存在数据库中的 URI 进行比较。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM