<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Finding the next meeting in APIs &amp; Integrations</title>
    <link>https://community.hubspot.com/t5/APIs-Integrations/Finding-the-next-meeting/m-p/849214#M67431</link>
    <description>&lt;P&gt;Thanks.&amp;nbsp; That works!&lt;/P&gt;</description>
    <pubDate>Wed, 13 Sep 2023 21:13:32 GMT</pubDate>
    <dc:creator>KSimmons</dc:creator>
    <dc:date>2023-09-13T21:13:32Z</dc:date>
    <item>
      <title>Finding the next meeting</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Finding-the-next-meeting/m-p/846960#M67274</link>
      <description>&lt;P&gt;Is there a good way to search or retrieve the start time of the NEXT meeting for a company or contact?&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need the start time (date plus time in a string or text field) to include in emails and documents.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Seems like there are two ways to approch pulling the start date of a meeting for a particular company.&lt;/P&gt;&lt;P&gt;1. Get all of the meetings associated with the company and then filter for the soonest upcoming date.&amp;nbsp; Return next date&lt;/P&gt;&lt;P&gt;2.&amp;nbsp; Search for meetings that occur in the next 14 days.&amp;nbsp; Return the meeting date that the search API returns&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Are either of these two options better?&amp;nbsp; Or is there a more straightforward workflow to print the meeting start time to a property?&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Sep 2023 20:38:41 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Finding-the-next-meeting/m-p/846960#M67274</guid>
      <dc:creator>KSimmons</dc:creator>
      <dc:date>2023-09-08T20:38:41Z</dc:date>
    </item>
    <item>
      <title>Re: Finding the next meeting</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Finding-the-next-meeting/m-p/847671#M67313</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/444388"&gt;@KSimmons&lt;/a&gt;&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":waving_hand:"&gt;👋&lt;/span&gt; Thanks for the interesting question. I'd like to invite some of our community members to the conversation. Hey,&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/101258"&gt;@Teun&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/57728"&gt;@KimM&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/257487"&gt;@LMeert&lt;/a&gt;, have you tackled anything similar in your work?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for taking a look! — Jaycee&lt;/P&gt;</description>
      <pubDate>Mon, 11 Sep 2023 16:41:22 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Finding-the-next-meeting/m-p/847671#M67313</guid>
      <dc:creator>Jaycee_Lewis</dc:creator>
      <dc:date>2023-09-11T16:41:22Z</dc:date>
    </item>
    <item>
      <title>Re: Finding the next meeting</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Finding-the-next-meeting/m-p/848898#M67403</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/444388"&gt;@KSimmons&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I presume you are planning on using the Hubspot API and custom code workflow actions for this. So I would suggest using the Meetings Engagements Search endpoint. First I would assign today's date/time to a variable. You can then filter by association with the company or contact and&amp;nbsp;hs_meeting_start_time greater than the date variable you assigned earlier. Make sure to sort by&amp;nbsp;hs_meeting_start_time ascending and set the limit to 1.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This will return just the one meeting which is the next meeting associated with that company or contact. You can then extract the&amp;nbsp;hs_meeting_start_time from the results and format it as you like.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This way you don't have to pull a load of meetings to loop through and are less likely to encounter edge cases when a meeting might not be scheduled in the next 14 days. You may also want to adjust the code or the workflow to handle cases where there are no future-dated meetings.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I just tested it and this seems to work for me:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;var http = require("https");

exports.main = async (event, callback) =&amp;gt; {
  var date = new Date();
  var start_date_time;

  var options = {
    method: "POST",
    hostname: "api.hubapi.com",
    port: null,
    path: "/crm/v3/objects/meetings/search",
    headers: {
      accept: "application/json",
      "content-type": "application/json",
      authorization: "Bearer " + process.env.{{Your Secret}},
    },
  };

  var req = http.request(options, function (res) {
    var chunks = [];

    res.on("data", function (chunk) {
      chunks.push(chunk);
    });

    res.on("end", function () {
      var body = Buffer.concat(chunks);
      var responseBody = JSON.parse(body.toString());

      if (responseBody.results &amp;amp;&amp;amp; responseBody.results[0]) {
        start_date_time = responseBody.results[0].properties.hs_meeting_start_time;
      }

      callback({
        outputFields: {
          start_date_time: start_date_time,
        },
      });
    });
  });

  req.write(
    JSON.stringify({
      filterGroups: [
        {
          filters: [
            {
              propertyName: "associations.contact",
              operator: "EQ",
              value: event.inputFields["id"]
            },
            {
              propertyName: "hs_meeting_start_time",
              operator: "GTE",
              value: date
            },
          ],
        },
      ],
      sorts: [
        {
          propertyName: "hs_meeting_start_time",
          direction: "ASCENDING",
        },
      ],
      properties: ["hs_meeting_start_time"],
      limit: 1,
    })
  );
  req.end();
};&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this helps and feel free to reach out if you encounter any problems.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Kim&lt;/P&gt;</description>
      <pubDate>Wed, 13 Sep 2023 13:24:10 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Finding-the-next-meeting/m-p/848898#M67403</guid>
      <dc:creator>KimM</dc:creator>
      <dc:date>2023-09-13T13:24:10Z</dc:date>
    </item>
    <item>
      <title>Re: Finding the next meeting</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Finding-the-next-meeting/m-p/849214#M67431</link>
      <description>&lt;P&gt;Thanks.&amp;nbsp; That works!&lt;/P&gt;</description>
      <pubDate>Wed, 13 Sep 2023 21:13:32 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Finding-the-next-meeting/m-p/849214#M67431</guid>
      <dc:creator>KSimmons</dc:creator>
      <dc:date>2023-09-13T21:13:32Z</dc:date>
    </item>
    <item>
      <title>Re: Finding the next meeting</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Finding-the-next-meeting/m-p/849353#M67453</link>
      <description>&lt;P&gt;Great to hear&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/444388"&gt;@KSimmons&lt;/a&gt;. Happy to help.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Sep 2023 07:30:08 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Finding-the-next-meeting/m-p/849353#M67453</guid>
      <dc:creator>KimM</dc:creator>
      <dc:date>2023-09-14T07:30:08Z</dc:date>
    </item>
  </channel>
</rss>

