Help with Custom Code to Log Meetings When Custom Object Is Created

Hello,

I’m using a workflow to trigger an action when a new custom object is created. The goal is to automatically log a meeting associated with the contact and company linked to the custom object.

However, I’m facing errors with the timestamp and metadata when using custom code to log the meeting.

What I Need Help With:

  1. Timestamp: The hs_timestamp field is causing validation errors. How should I format this field for logging a meeting?
  2. Metadata: I keep getting the error “metadata cannot be null”. What metadata is required when logging a meeting?

Any help with the custom code to resolve these issues would be greatly appreciated. Or if you have a different proposed solution that would get the same outcome.

Thanks in advance!

datetime Fields, which hs_timestamp is, are generally in the Unix Timestamp format so you would need to convert the value into that.

Not sure on the Metadata error. Did you check the payload of your request to make sure it’s not missing any required data? Missing any required associations? There is this post:

https://community.hubspot.com/t5/APIs-Integrations/API-Create-Engagement-Metadata/m-p/335961

Willson put what seems like a “minimum” payload to create an engagement. You might want to start from there or if you can, post the payload here so we can view it.