简体   繁体   English

如何使用 Hubspot API 分配所有者?

[英]How to assign an Owner using the Hubspot API?

I'm using the Hubspot API to create new contacts and would like to automatically set the owner when the contact is created.我正在使用 Hubspot API 创建新联系人,并希望在创建联系人时自动设置所有者。 I know this is possible without using the API via Workflows, however I'd like to use the API for that.我知道在不通过工作流使用 API 的情况下这是可能的,但是我想为此使用 API。

Here's my code right now (which works, just missing the contact owner):这是我现在的代码(有效,只是缺少联系人所有者):

$data = [
    'properties' => [
                        ['property' => 'firstname', 'value' => $contact->first_name],
                        ['property' => 'lastname', 'value' => $contact->last_name],
                    ]
];

$body = json_encode($data);
$response = $client->request('POST', '/contacts/v1/contact/email/'.$user->email.'/profile',
                ['query' => ['hapikey' => $hubspot_key, 'body' => $body]);

I eventually found a way to achieve this:我最终找到了实现这一目标的方法:

  1. Go to your Hubspot instance, then Settings and Properties Go 到您的 Hubspot 实例,然后设置属性
  2. Search for " Contact Owner " and click on Edit搜索“联系所有者”并点击编辑
  3. In " Field type ", identify the Owner's ID value在“字段类型”中,标识所有者的 ID

Then in your API call, simply pass this property:然后在您的 API 调用中,只需传递此属性:

$data['properties'][] = ['property' => 'hubspot_owner_id', 'value' => 123456];

You can find out more about this hubspot_owner_id property (which is internal to Hubspot, this is not a custom property) in Hubspot's documentation .您可以在Hubspot 的文档中找到有关此hubspot_owner_id属性(Hubspot 内部,这不是自定义属性)的更多信息。

It will automatically assign the new created (or updated) Hubspot contact to the related Owner (Hubspot User).它将自动将新创建(或更新)的 Hubspot 联系人分配给相关的所有者(Hubspot 用户)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM