APIs & Integrations

lukasz_german
Member

Filter call engagements by user

Hello, I'm working on integration with service called Jog.ai and right now I'm preparing a feature that will allow to fetch calls made using HubSpot and create easily readable transcripts using them.

To get a list of calls we use GET /engagements/v1/engagements/recent/modified or GET /engagements/v1/engagements/paged, it's not very convenient, because there are no filtering, so all types of engagements are returned (not just calls), but I can live with that.

We want to limit calls that are fetched to only those that were made by particular user which installed integration. My problem is that those endpoints return all calls that were made in a HubSpot portal. There is no direct way to filter those that belong or were made by particular user.

However, I see a correlation between data returned by following endpoints:
GET /oauth/v1/access-tokens/:token - only way that I know, to identify user, user_id is probably what I need
GET /owners/v2/owners/ - I'm planning to exchange user_id for an ownerId using this endpoint, I've noticed that remoteId corresponds with user ids returned by token information endpoint.
GET /engagements/v1/engagements/paged - knowing ownerId I can filter results

Do you think it's a good way to go? If yes, I have couple of questions:

  1. I don't know if ownerId is prone to be changed or I can store it in my database to use it later?
  2. I have no idea if user will always have corresponding Owner resource?
  3. Can remoteList returned on GET /owners/v2/owners/ be empty?
  4. Do remoteId on remoteList must be of type HUBSPOT?
  5. Maybe it would be better to use email, instead of user_id when looking for ownerId, do emails must be unique for a portal?
  6. I don't know if I can rely on owner_id in engagement? Is it possible to have engagement with empty owner_id?
  7. Any plans for adding filtering on engagements list?

I'm asking for your expertise. I hope with your help I will be able to deliver new and exciting integration that you might find useful.

3 Replies 3
lukasz_german
Member

Filter call engagements by user

@Connor_Barley thanks for such detailed explanation, that helps me a lot!

I have one more question, regarding engagement's ownerId. Is the call type engagement, by default, assigned to person that made the call? Or the default is that the call is not assigned to anyone?

0 Upvotes
cbarley
HubSpot Alumni
HubSpot Alumni

Filter call engagements by user

Hi @lukasz_german, ownerId is explicit, so you have to associate owners in the ownerIds section of the associations section of your post request. The default if you don't provide an ownerId is that it is blank.

0 Upvotes
cbarley
HubSpot Alumni
HubSpot Alumni

Filter call engagements by user

Hi @lukasz_german, happy to help here! I don't see any issue with pulling the user_id via the method you described. As for your questions:

  1. ownerId is not subject to change.
  2. Owners will always be created when a new user is added. Per the docs: "Owners are created and updated automatically inside of HubSpot when HubSpot users are added, or when owners are synced from Salesforce."
  3. remoteList can be empty only if you include the parameter includeInactive=true as per the docs.
  4. remoteId corresponds to a few different things. It can have a value of SALESFORCE if the owner is also synced with Salesforce, it can have a value of EMAIL if an owner has several email aliases, or it can be HUBSPOT. remoteId for Salesforce will be a Salesforce ID like this: 005f4000000gnnjAAA, an email address if there are aliases set, or a HubSpot internal ID.
  5. The email field on an owner must be different in HubSpot in that no two owners can have the same email address, so you could use the email field if you choose.
  6. Owner ID on an engagement is not required. The docs here say "Optional long, corresponding to an Owner. Task engagements use the ownerId to populate the Assigned to field."
  7. At the moment I'm not aware of any plans to add filtering when getting all engagements, but I can pass along your feedback internally and you should submit an idea here: https://community.hubspot.com/t5/custom/page/page-id/ideaslandingpage