APIs & Integrations

ECupaioli
Member

API documentation for Event Data?

I recently read this guide on how to add an event listener for when someone books a meeting, but I saw it was from 4 years ago so I went to check if the event.data objects were accurate but couldn't find any docs on event.data. I was able to log the object coming through but can someone point me in the right direction for when I need to do something else with the event.data? 

0 Upvotes
7 Replies 7
Teun
Recognized Expert | Diamond Partner
Recognized Expert | Diamond Partner

API documentation for Event Data?

Hi @ECupaioli ,

 

Here is the code I use to send data from the meeting tool to Tagmanager:

<script type="text/javascript">
  window.dataLayer = window.dataLayer || [];
  window.addEventListener('message', event => {
    if (event.data.meetingBookSucceeded) {
      window.dataLayer.push({
        event: 'hubspotBookedMeeting',
        currentUrl: window.location.href,
        hsFormGuid: event.data.meetingsPayload.formGuid,
        paidMeeting: event.data.meetingsPayload.isPaidMeeting,
        linkType: event.data.meetingsPayload.linkType,
        offline: event.data.meetingsPayload.offline,
      });
    }
  });
</script>

Hope this helps! 

I created a video about HubSpot events and GA4, but it also explains a bit about the meeting tool (around 4 min).



Learn more about HubSpot by following me on LinkedIn or YouTube

Did my answer solve your issue? Help the community by marking it as the solution.


EdCupaioli
Member

API documentation for Event Data?

I posted the article I got a very similar solution from. I'm sure your solution works fine too, however my question was regarding the API documentation you used to find that solution. I can't find any docs on the event.data response. How would you have known listen for that response? I'm assuming you read some docs from hubspot or the lords of hubspot appeared in a burning bush to reveal their secrets. I'm hoping the former is true so I can create solutions in the future much like you did since I don't learn anything from just copy pasting solutions. 

Teun
Recognized Expert | Diamond Partner
Recognized Expert | Diamond Partner

API documentation for Event Data?

Hi @EdCupaioli ,

 

Fair point, and mate, do you make me laugh!
Sadly, there isn't any documentation about window events besides the form events. I simply went with testing and using console logs to see what I can use.

As you can see, there is no result in Google available;
https://www.google.com/search?q=site%3Adevelopers.hubspot.com+%22meetingBookSucceeded%22


https://www.google.com/search?q=site%3Aknowledge.hubspot.com+%22meetingBookSucceeded%22

 



Learn more about HubSpot by following me on LinkedIn or YouTube

Did my answer solve your issue? Help the community by marking it as the solution.


0 Upvotes
EdCupaioli
Member

API documentation for Event Data?

I did console logs to test it out so that tracks. I guess I know now hubspot adds messages on successful API calls. Trust me, I googled a plenty but also turned up nothing.  I found API docs on Meetings but no response output like I would expect from API documentation.  

0 Upvotes
Jaycee_Lewis
Community Manager
Community Manager

API documentation for Event Data?

Thank you, @Teun! You're a legend 🙌 And thank you to @EdCupaioli for the Wisdom of the Ancients reference. I needed a good lol/sob – Jaycee

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot

Jaycee_Lewis
Community Manager
Community Manager

API documentation for Event Data?

Hey, @ECupaioli 👋 Welcome to the community. I agree with you, using older resources can be help, but they run the risk of becoming obsolete or outdated.

 

The specifics of what is included in event.data can vary depending on the specific API or platform you're using. Without more information on the specific endpoint you're using, it's hard to provide guidance. Would you mind sharing more details about what you are using? That might help us to provide more targeted advice.

 

Probably not a solution, but you might consider messing around with JavaScript's console.dir(event). It allows you to interactively explore all properties of the event object in your browser's console.

 

Have fun building! — Jaycee

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot

0 Upvotes
EdCupaioli
Member

API documentation for Event Data?

I'm using the Meeting Scheduler widget . There's an ad landing page and an API page for how to build your own, but nothing really on the widget and how to use event listeners with it. This is the code from the guide that works for me but I'm not clear on how that person got that info. It's the wisdom of the ancients without any proper docs.