Can't use data from Segment

Hello folks!
I’m sending some data from Segment to Hubspot, with a new custom event that I’ve created previously. I’ve created a new property for my contacts too, but when the event is tracked in Segment and dispatched for Hubspot, that specific value isn’t fulfilled on contact’s profile.

I’m sending an event with a property named last_blog_created and a new property with the same name(the internal one).

My purpose here it’s to use that value and append it on an e-mail that my contact will receive when this event is fired.

Hey @OtavioCapila,

Do you mind sharing more details on how you’re tracking event? Are you using the Events JavaScript API?

If so, could you sharing with me a snippet of the code that you’re using? Additionally, can I confirm that your HubSpot portal ID is 355xxx?

Hi @WendyGoh,
I’m sending this code from segment to Hubspot

analytics.track({
 userId: 'FAKE_VALUE',
 event: 'Blog Ready',
 properties: {
 blogId: 'FAKE_VALUE',
 email: 'FAKE_VALUE',
 last_blog_created: 'FAKE_VALUE',
 userId: 'FAKE_VALUE'
 }
});

I’ve replaced the original values with FAKE_VALUE for security reasons.

As you can see in the snippet above, I’m sending a property called “last_blog_created” with a URL, and I’ve created a property for all contacts with the same name.

When I dispatch that event from Segment to Hubspot, my workflow is triggered, and an email is sent to the contact. But the value of “last_blog_created” on the contact profile isn’t fulfilled with the value that comes from the event.
I’m not using the Events JavaScript API, and yes, my Hubspot ID is 355XXX.

Hey @OtavioCapila,

Thanks for the further clarification!

When looking at the segment documentation here: HubSpot Destination | Segment Documentation - It looks like if you’d like to set HubSpot contact properties on the track function, you’d need to add it in the context.traits object. E.g.

analytics.track(
 user_id='YOUR_USER_ID',
 event='Bought Item',
 properties={
 'email': 'peter@initech.com',
 },
 context={
 'traits': {
 'firstname': 'Peter',
 'lastname': 'Gibbons'
 }
})

Could you try and see if this works?

Hi @WendyGoh,

Thanks for replying :smiley:

I’ve found this solution yesterday and it worked nicely. So I’ll mark your reply as the solution.

Thanks for your help. See ya :sign_of_the_horns:

Can you share a snippet of your code? I had been trying this but there’s no update on the Hubspot side.

Im doing

analytics.track({
 userId: 'FAKE_VALUE',
 event: 'Custom event',
 properties: {
 email: 'FAKE_VALUE',
 },
 context: {
 traits: {
 firstname: 'FAKE_VALUE',
 },
 },
 timestamp: new Date(),
})

But it seems not to work,

Also @WendyGoh, how can I get the name of a field to update, for example I would like to update Opted out of email marketing information, I found the internal name but it seems it doesn’t work either using .identify

BTW, Im not using analytics.js Im using analytics-node

Thanks

@estrada9166 I’m doing exactly like you, and its working.

To get the name of a specific field, you must click on the property to see its settings and click at that blue button on the right side of the input. There you’ll see the name you will pass to Segment in order to update it.

@OtavioCapila Im gonna continue trying! Thank you!

For the moment no result.
16x16_smiley-frustrated.png.png

@estrada9166 Just remember that inside traits object, the property must match the internal name of a property on Hubspot.

So if the property on Hubspot has an internal name of something like “user_lastname”, the traits object must be something like this →

traits:{
   user_lastname:"FAKE_VALUE",
}

@OtavioCapila yeah, I had try with the default values like lastname, firstname and stuff like that but doesn’t work eiter.

If I try the identify with those fields it works fine

@OtavioCapila do you have HubSpot Enterprise account?

Hello!

I have been using this context>traits technique for a while now, but we discovered recently that the information is no longer being persisted in contacts profile. Other destiantions do recieve the data, but not HubSpot.

Any of you guys encountered this problem before? I’m sure we didn’t change a line of code, and specially that other distanations seem to be working properly.