APIs & Integrations

srolandmarshall
Participant

API Create Engagement Metadata

SOLVE

Hi there,

 

I have a large batch of data I am running through a Ruby script. To avoid unnecessary debugging and testing, are all fields in an Engagement's Metadata "required"? I.e. if I do not send a start and end time for a phone call, will it not import? 

 

If they are required, is passing in a null value or blank string going to cause the response to be an error?

0 Upvotes
1 Accepted solution
Willson
Solution
HubSpot Employee
HubSpot Employee

API Create Engagement Metadata

SOLVE

Hey @srolandmarshall 

 

To confirm, the metadata is required and if it is not set it will return the following error:

"message": "metadata cannot be null"

In this case, to get past this, we can work with a payload such as:

{
"engagement": {
"active": true,
"ownerId": 1,
"type": "CALL"
},
"associations": {
"contactIds": [48051],
"companyIds": [ ],
"dealIds": [ ],
"ownerIds": [ ],
"ticketIds":[ ]
},
"metadata": {}
}

In the above case, a Call engagement will be logged to the record and the contens of the engagement will be left blank bar the Date and Time that defaults to the time when the request was made, should it be left blank.

 

I hope this helps!

Product Manager @ HubSpot

View solution in original post

2 Replies 2
Willson
Solution
HubSpot Employee
HubSpot Employee

API Create Engagement Metadata

SOLVE

Hey @srolandmarshall 

 

To confirm, the metadata is required and if it is not set it will return the following error:

"message": "metadata cannot be null"

In this case, to get past this, we can work with a payload such as:

{
"engagement": {
"active": true,
"ownerId": 1,
"type": "CALL"
},
"associations": {
"contactIds": [48051],
"companyIds": [ ],
"dealIds": [ ],
"ownerIds": [ ],
"ticketIds":[ ]
},
"metadata": {}
}

In the above case, a Call engagement will be logged to the record and the contens of the engagement will be left blank bar the Date and Time that defaults to the time when the request was made, should it be left blank.

 

I hope this helps!

Product Manager @ HubSpot
srolandmarshall
Participant

API Create Engagement Metadata

SOLVE

Yes, this does make sense. To clarify, my question was about leaving some of the requested fields out of metadata when they are not relevant, I see how I was not clear about that.

 

Your example was awesome and super helpful. Thanks!

0 Upvotes