|
15444
|
Project: faVsco.js, menu
JY-20725-handle-HS-search Project: faVsco.js, menu
JY-20725-handle-HS-search-rate-limit, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
FirefoxFileEditViewHistoryBookmarksProfilesToolsWindowHelpDaily - Platform - now100% L2Mon 11 May 9:50:50meet.google.com/mie-gawc-dsi?authuser=[EMAIL] Yankov (Presenting)9+Platform Team %.Q Search boardA.J Panorama for CallScoring n coAUTOMATED AT ECOREKowdyoDVJy-20361Setup test coverage forProphet in SonarMAINTENANCSBacklogE 3-109519:50 AM | Daily - Platform*0.Mon 11 May 9:50C Jy 20451 ServicX Jmim8 ProoAttentC Calls -AtsenlCa Transp* MCPIО эррібкhttps://fminny.atlassian.net/jira/software/c/projects/JY/boards/37?selectedissue=JY-206258E Datadog* Claude3 CirclechSentryL tasInsights & Coachin…Al BookmarxssY-20739 / Q JY-20625[POC)Jiminny MCP Connector~ DescriptionCustomers are starting to use AI tool (like Claude and GPT) to connect the information from all f their platform into oneplace. Which they then ufe to interrogate and perform different analysis on their data. We want to create a Jiminny MCPwhich will enable them to connect their Jiminny data to Claude/GPT.• create a POC to demonstrate the approach• determine form where the data needs to be fetched - long term we want to fetch everything from Elastic Search but inorder to release il faster we can consider a temporary mixed approach with the DB"hewittteesnetnokernetthooe• determine what the authentication needs to be (keep in mind requirement 1 and 7)the epproderfnongo snoure de contrmed wan surtkd ane uaya• product requirements - E Jiminny MCP Connector••+33% DonePrioctyASSiOusouy 0/s.Ciedeyoe= м.ON....INDEV -% JY-20743tools/listResearch Competitor's MCP= м.- N...*xI0 DerIn ProgressIx Improve SpikeDetailsAssignee• Nikolay NkolowAssign to meReporter2 Galya DimitrovaDevelopmentQ Open with VS CodeJ Create branch61 commits1 pull request1 build incompleteComponentsPlatformSub-ProductAdd optionsLabelsstory pont estma4 days agoorth0 UxGroup: QueriesAl Reports > Empty pagedesign and promotonAJREPORTSDeployed0 -20372 1 1 •***=SrOK VO ALUIC-207261 @ ••0=Allow users to delete SSand Panorama promptsAКаrОКISDeployedRelease AJ PanoramaAJREPORTS0 -20740 05 1) .00:summary in the CRM...Nikolay IvanovNikolay Yankov4 othersSteliyan GeorgievLukas Kovalik2:23...
|
PhpStorm
|
faVsco.js – Client.php
|
NULL
|
15444
|
|
15443
|
Project: faVsco.js, menu
JY-20725-handle-HS-search Project: faVsco.js, menu
JY-20725-handle-HS-search-rate-limit, menu
Start Listening for PHP Debug Connections
+FirefoxEdit$FileViewHistoryBookmarksProfilesToolsWindowHelpmeet.google.com/mie-gawc-dsi?authuser=[EMAIL] Yankov (Presenting)C Jy 20451 Servic83 Jminr8 PromoO AttentC Cals -0 Abeei(a Transp*0$6000* CiaudeX MOPhttps://fminny.atlassian.net/jira/software/c/projects/JY/boards/37?selectedissue=JY-206254 S5H8E Datadog* Ciaude3 CirclechSentryL tsкa Insights & Coachin0 DerPlatform Team %.Q Search board§ sy-20739 / Q JY-20625[POC)Jiminny MCP ConnectorIn Progress-Ix Improve SpikeAJ Panorama for CallScoring n ouEAUTOMATED AT SCORE~ DetailsP Jy-20361serup test concrare rorProphet in SonarMAINTENANCSBacklogE 3Y-10951DescriptionCustomers are starting to use Al tool (like Claude and GPT) to connect the information from all f their platform into oneplace. Which they then use to interrogate and perform different analysis on their data. We want to create a Jiminny MCPwhich will enable them to connect their Jiminny data to Claude/GPT.• create a POC to demonstrate the approach• determine form where the data needs to be fetched - long term we want to fetch everything from Elastic Search but inorder to release it faster we can consider a temporary mixed approach with the DBAssignee• Nikolay NkolowAssign to meReporter& Galya Dimitrova• Getermine what toe aucreriicaton necos to d0 lacep in moo teout cmieriano nthe epproderftnongo shourd be contrmed wan surtkd ane trye• product requirements - E Jiminny MCP ConnectorDevelopmentQ Open with VS CodeJ Create branch61 commits1 pull request1 build incomplete4 days agoorthComponentsPlatform••+33% DonePrioctyASSiOusAdd optionsauy0lsCiedeyoe= м.O N...IN DEV -Labels% JY-20743tools/listResearch Competitor's MCP= м.• N...story pont estmateDaily - Platform - now100% 12Mon 11 May 9:50:479Nikolay IvanovNikolay YankovMon 11 May 9:50• appіoL Al BookmarksGroup: QueriesAi Reports > Empty pagedesign and promobonAJREPORTSDeployedД -20372 1 1 •***=GrOK Va AZUre-20726 1 • •***=Allow users to delete SSSNTEMeT WODDwhen those are used in a...AJREPORTSDeployed-20770 21 9000Retease AJ PanoramaAJREPORTSDeployed20740 05 12 •=*0:summary in the CRM4 othersSteliyan Georgievalleaale.9:50 AM | Daily - Platform...Lukas Kovalik2:20...
|
PhpStorm
|
faVsco.js – Client.php
|
NULL
|
15443
|
|
15442
|
+FirefoxFileEditViewHistoryBookmarksProfilesToolsW +FirefoxFileEditViewHistoryBookmarksProfilesToolsWindowHelpmeet.google.com/mie-gawc-dsi?authuser=[EMAIL] Yankov (Presenting)C Jy 204yServ83 Jmier83 PromeO AttentC Cals -0 4ee:(a Transp*0.0000% Ciaude© JmineX MOPO sninhttps://jminny.atlassian.net/jira/software/c/projects/JY/boards/37?selectedissue=JY-20625D Projects8E Datadog@ * Cauоe9 CircleCtSentry*xIL tsюinsights & Coachin0 DerPlatform Team %.Q Skarch boarasY-20739 / Q JY-20625[POC)Jiminny MCP ConnectorIn ProgressIx Improve SpikeA.J Panotama for Callscoring n oo(AUTOMATED AL SCORINGHoedytorwR Jy-20361~ Detailsserup tost concrone rorProphet in SonarMAENTENANCSBackiogE 3Y-19951DescriptionCustomers are starting to use Al tool (like Claude and GPT) to connect the information from all f their platform into oneplace. Which they then use to interrogate and perform different analysis on their data. We want to create a Jiminny MCPwhich will enable them to connect their Jiminny data to Claude/GPT.• create a POC to demonstrate the approach• determine form where the data needs to be fetched - long term we want to fetch everything from Elastic Search but inorder to release il faster we can consider a temporary mixed approach with the DB• we will use php/laravel for the implementation• Getermine what te aucreracauon necos to d0 keep in mno teoureiierit aro /nAssignee• Nikolay NkolowAssign to meReporter& Galya Dimitrovathe epprodermnongo snood de comtrmed win surtkd ane unye• product requirements - ED Jiminny MCP ConnectorDevelopmentQ Open with VS CodeJ Create branch61 commits1 pull request1 build incomplete4 days agoComponentsPlatform••+33% DoneWOrKPriortyAssig..SacahSub-ProductAdd options"oJy 0/d7eieaenoe= м.• N.IN DEVELabeis% JY-20743Create Schema for capabilities-toots/listResearch Competitor's MCP= м.• N...Story pont estmasaDaily - Platform - now100% L2Mon 11 May 9:50:42Mon 11 May 9:50L Al Bookmarks9Nikolay IvanovNikolay YankovAl Reports > Empty pagedesign and promotionAJREPORTSDepicyedД -20372 1 1 •0n =SrOK Va ALUIe20/20 1 0 ..00Allow users to delete SSand Panorama promptswhen those are used in a...AJREPORTSDepioyedRebease AJ PanoramaWroeg farmarting forsummary in tho CRM4 othersSteliyan Georgiev9:50 AM | Daily - Platform...Lukas Kovalik• 2:15....
|
PhpStorm
|
faVsco.js – Client.php
|
NULL
|
15442
|
|
15441
|
PhostormVIewINavicareCodeFV faVsco.js°9 JY-20725-h PhostormVIewINavicareCodeFV faVsco.js°9 JY-20725-handle-HS-search-rate-limroledey© BatchSyncCollectolyhuospotsyncstrategybase.ongCachedcrmservicebecorator.onp© ProspectCache.phpe balchsynckealsseС Cпескапокetrукemotematch.ongc closeaDealstagess @ MatchacuivitycrmData.ong© ermactivilyservice.phgDealrielasservice.gc)Decorateacuivilv.or© FieldDefinitions.phrclass Cllent extends Baseclient 1mpLements Hubspotcllentintertace— A2 A65 X1X1 ~C) FieldT vpeconvertee Hubspotclientinterc) Hubspotlokenman© PayloadBuilder.phpC) RemotecrmobiectnP ResponseNormalizec) Service,onoC)SvncFieldAction.onC) SvncRelatedActivitC) WebhookSvncBatclv MintearationAorM AcceccorsConfigD DTO• M SiltersJobs• M ProcnectSoarchStr.W service lralts© DataClient.php© DecorateActivity.phc Localsearch.oneu LocalSearchintertac© RemoteSearch.phpc) Service.phpv W Listeners© ConvertLeadActivitc) PurceLookuocache> M Metadata> Miarationa Pioedrivev Salesforce• D Fields• M OnnortunitvMatcheMOnnortunitvSvneSt897 (M ProsneetSearchStr.M ServiceTraitcC) Client nhr© DecorateActivity.ph. Delete@biectsTrait© FieldDefinitions.php© PayloadBuilder.php© Profile.php© QueryBuilder.phpoubuc tunction 1sunauthorizedzxcentionExcentionse: 000ureturn str contains(Smessage. "401 unauthorized')str contains(Smessage..'http 401') |1str_contains(Smessage, 'status code 401') |(orea match( pattern: • /\b401\b/' Smessage) &s str contains(Smessage. 'unauthorized')):* Validates and refreshes the access token if needed before API requests.* This ensures long-running processes don't fail due to token expiration.* @throws SocialAccountTokenInvalidExceptiony usagespublic function ensureValidToken: voidif (Sthis->oauthAccount === null) {Snewloken = sthis->tokenmanaqer->ensureval1dloken(sth1s->oauthaccount)if (SnewToken !== null) {sthis-›accessloken = snewloken:public function getConfigoreturn Sthis->confia:returns onlv active (anchived=false)9 usadespublic function get0wners: arrayreturn $this->getNewInstance()->crm()->owners()->getALL();* apanam bool Sarchived* dretum arrau<ownens/r71s usageslelner Code will hoin INF to underctand vour Laravel ann code II Generate II Don't Show Anvmore (12 minutes aaoi40 hl• | Daily - Platform • now100% Lz• Mon 11 May 9:50:41AskJiminnyReportActivityServiceTest v+0 ..= 30= custom.loa XA SF (jiminny@localhost]4 HS_local (jiminny@localhost]# console [PKob.# console leu)# console [slAGiNG)[2026-05-07 14:21:15] local.INF0: [Hubspot] DEBUG Getting headers {"neaders".?"Uace":L"Inu,or May 2020 14.21.15 6Ml"Jn"Transter-Encod1nq":"chunked")."Connection":"keep-alive""CF-Ray" : ["9f80deb8db60dc3a-SOF"],"Strict-Transport-Secur1ty":"max-aqe=31536000* 1ncLudeSubDomains: preload")naccent-encodino""access-control-allow-credentials": ["false"J."server-timing": ["hcid;desc=\"019e02d0-6fd8-7812-bdba-885b7ccb3ee3\","x-hubspot-correlation-id":["019e02d0-6fd8-7812-bdba-885b7ccb3ee3"],"So+-Cookie"." c+hm-Stlirtd0aXVr.kSandas6hzVVKhzTn0BidvMaheCtm0V-1778163675-1.0.107-May-26 14:51:15 GMT; domain=.hubapi.com; Http0nly; Secure; SameSite=None"],"Renont-To".r"*"endnoints"."unl".httns:a.nel.cloudflane.com./nenon+|W/v42c=NVA1cVTPQfVm32anS0ixVF/sd2RI"group\":\"cf-nel\","max_age\":604800}"],"NEL":["{\"success_fraction\":0.01,reportto. "cr-nel,"max age":604800}"]"Server": ["cloudflare"]}} {"correlation_1d":"95256555-ec98-4541-b9za-adta/Sb6Yeab","trace_10":"C/AD8565-905t-4604-9405-0e5b551e5545CascadeHubspot Rate Limit ReOk lets mdon't get it what is the issue with matchExactlvBvEmailI IIllC;Ask anvthina (&4L)+ « CodeClaude Onus 4.7 Medium• 7% (72K / 1M) context usedWN Windsurf Teams802•6UTF.Rio 4 spaces...
|
PhpStorm
|
faVsco.js – Client.php
|
NULL
|
15441
|
|
15440
|
FirefoxFileEditViewHistoryBookmarksProfilesToolsWi FirefoxFileEditViewHistoryBookmarksProfilesToolsWindowHelpmeet.google.com/mie-gawc-dsi?authuser=[EMAIL] - Platform - nowNikolay Yankov (Presenting)100% 12Mon 11 May 9:50:399+C Jy 20452 Servic83 Jmier8 Promohttps://fiminny.atlassian.net/jira/software/c/projects/JY/boards/37?selectedissue=JY-20625D Projects23 SSHPlatform Team %Q Search board286JY-20625AJ Panorama for CallScoring nn 0o(AUTOMATED AT EIGORINGKeooy torouyA Jy-2030125 •*** = 3Setup test coverage forProonoricherMASNTENANCSBacklogE 3-109511•*•*= 3O AttentCalsE DatadogCa Transp3 CircieClSentry* MCP• appіoMon 11 May 9:50L Al Bockmarxs0 Der0 UxGroup: QueriesAI Reports > Empty pagedesign and promotonAJREPORTSDeployed0 -20372 1 П •*** = /Grok via AzureMASNTENDeployed0 -20726 • ****=Allow users to delete SSand Panorama promptswhen those are used in a...AJ REPORTSDeployed0 -20770 12 •***=Release AJ PanoramaAJREPORTSDeployedД -20740 05 1 ..00:Wrong formatting forsummary in the CRMNikolay IvanovNikolay Yankov4 othersSteliyan GeorgievallLO NHLukas KovalikLộ39:50 AM | Daily - Platform• 2:12....
|
PhpStorm
|
faVsco.js – Client.php
|
NULL
|
15440
|
|
15439
|
Project: faVsco.js, menu
JY-20725-handle-HS-search Project: faVsco.js, menu
JY-20725-handle-HS-search-rate-limit, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
2
65
1
1
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Services\Crm\Hubspot;
use HubSpot\Client\Crm\Deals\ApiException as DealApiException;
use HubSpot\Client\Crm\Contacts\ApiException as ContactApiException;
use HubSpot\Client\Crm\Companies\ApiException as CompanyApiException;
use HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectWithAssociations as ContactsWithAssociations;
use HubSpot\Client\Crm\Companies\Model\SimplePublicObjectWithAssociations as CompaniesWithAssociations;
use HubSpot\Client\Crm\Deals\Model\SimplePublicObjectWithAssociations as DealWithAssociations;
use HubSpot\Client\Crm\Objects\Model\SimplePublicObjectInput;
use HubSpot\Client\Crm\Objects\Model\SimplePublicObjectWithAssociations as ObjectWithAssociations;
use HubSpot\Client\Crm\Pipelines\Model\Error;
use HubSpot\Client\Crm\Pipelines\Model\PipelineStage;
use HubSpot\Client\Crm\Properties\Model\Property;
use HubSpot\Discovery\Discovery;
use Jiminny\Exceptions\CrmException;
use Jiminny\Exceptions\RateLimitException;
use Jiminny\Exceptions\SocialAccountTokenInvalidException;
use Jiminny\Jobs\Crm\NoteObject;
use Jiminny\Models\Crm\Field;
use Jiminny\Services\Crm\BaseClient;
use Jiminny\Services\Crm\Hubspot\DTO\Response\Owner;
use Jiminny\Services\SocialAccountService;
use SevenShores\Hubspot\Exceptions\BadRequest;
use SevenShores\Hubspot\Exceptions\HubspotException;
use SevenShores\Hubspot\Factory;
use SevenShores\Hubspot\Http\Response;
use Jiminny\Services\Crm\Hubspot\Pagination\HubspotPaginationService;
use Throwable;
/**
* @phpstan-type CrmFieldOption array{id:string, label:string, value?:string}
*/
class Client extends BaseClient implements HubspotClientInterface
{
public const string MIN_API_VERSION = '2';
public const string BASE_URL = '[URL_WITH_CREDENTIALS] T
* @param callable(): T $apiCall
* @return T
*
* @throws RateLimitException
*/
private function executeRequest(callable $apiCall)
{
try {
return $apiCall();
} catch (Throwable $e) {
if ($this->isHubspotRateLimit($e)) {
$retryAfter = $this->parseRetryAfter($e);
$this->log->warning('[Hubspot] Received 429 from API', [
'team_id' => $this->config->team_id,
'config_id' => $this->config->getId(),
'retry_after' => $retryAfter,
'reason' => $e->getMessage(),
]);
throw new RateLimitException('Hubspot returned 429', $retryAfter, $e);
}
throw $e;
}
}
public function isHubspotRateLimit(Throwable $e): bool
{
if ($e instanceof BadRequest
|| $e instanceof DealApiException
|| $e instanceof ContactApiException
|| $e instanceof CompanyApiException
|| $e instanceof \GuzzleHttp\Exception\RequestException
) {
return (int) $e->getCode() === 429;
}
return false;
}
public function parseRetryAfter(Throwable $e): int
{
// First try to get Retry-After from response headers
if (method_exists($e, 'getResponseHeaders')) {
$headers = $e->getResponseHeaders() ?: [];
$value = $headers['Retry-After'] ?? $headers['retry-after'] ?? null;
if (is_array($value)) {
$value = $value[0] ?? null;
}
if (is_numeric($value)) {
return (int) $value;
}
}
if (method_exists($e, 'getResponseBody')) {
$body = $e->getResponseBody();
if (is_string($body)) {
$body = json_decode($body, true) ?? [];
}
$policyName = $body['policyName'] ?? $body['policy'] ?? $body['context']['policyName'] ?? null;
if ($policyName === 'TEN_SECONDLY_ROLLING' || $policyName === 'ten_secondly_rolling') {
return 10;
}
if ($policyName === 'SECONDLY' || $policyName === 'secondly') {
return 1;
}
}
$this->log->warning('[Hubspot] No retry-after header or policy name found, using default', [
'exception_class' => get_class($e),
]);
return 10;
}
public function getMinimumApiVersion(): string
{
return self::MIN_API_VERSION;
}
public function getInstance(): Factory
{
return new Factory([
'key' => $this->accessToken,
'oauth2' => true,
'base_url' => $this->baseUrl,
]);
}
public function getNewInstance(): Discovery
{
return \HubSpot\Factory::createWithAccessToken($this->accessToken);
}
/**
* Secondly and daily limits for Hubspot API
*
* Product Tier: Free & Starter | Professional & Enterprise | API add-on (any tier)
* Burst: 100/10 seconds | 150/10 seconds | 200/10 seconds
* Daily: 250,000 | 500,000 | 1,000,000
*
* Official documentation states: The search endpoints are rate limited to five requests per second.
* Since with 5 RPS were still hitting secondly rate limits we lowered it to 4
*/
public function getPaginatedData(array $payload, string $type, int $offset = 0): array
{
$total = 0;
$lastId = null;
$rows = [];
foreach ($this->getPaginatedDataGenerator($payload, $type, $offset, $total, $lastId) as $row) {
$rows[] = $row;
}
return ['results' => $rows, 'total' => $total, 'last_record' => $lastId];
}
/**
* @throws HubspotException
* @throws SocialAccountTokenInvalidException
* @throws BadRequest
*/
public function getPaginatedDataGenerator(
array $payload,
string $type,
int $offset = 0,
int &$total = 0,
?string &$lastRecordId = null
): \Generator {
return $this->paginationService->getPaginatedDataGenerator(
$this,
$payload,
$type,
$offset,
$total,
$lastRecordId
);
}
/**
* Execute a search request against HubSpot CRM objects with rate limiting.
*
* @param string $objectType The object type ('deals', 'companies', 'contacts', 'calls')
* @param array<string, mixed> $payload The search payload with filters, sorts, properties, etc.
* @return array The search response with 'results', 'total', 'paging' keys
* @throws RateLimitException When rate limit is hit
* @throws HubspotException On API errors
*/
public function search(string $objectType, array $payload): array
{
$endpoint = self::BASE_URL . "/crm/v3/objects/{$objectType}/search";
return $this->executeRequest(function () use ($endpoint, $payload) {
$response = $this->getInstance()->getClient()->request('POST', $endpoint, ['json' => $payload]);
return $response->toArray();
});
}
/**
* @throws DealApiException
* @throws CrmException
*/
public function getOpportunityById(string $crmId, array $fields): array
{
try {
// $deal = $this->executeRequest(fn () => $this->getNewInstance()->crm()->deals()->basicApi()->getById(
$deal = $this->getNewInstance()->crm()->deals()->basicApi()->getById(
$crmId,
implode(',', $fields),
'companies,contacts'
);
} catch (DealApiException $e) {
$this->log->info('[Hubspot] Failed to fetch opportunity', [
'crm_id' => $crmId,
'reason' => $e->getMessage(),
]);
throw $e;
}
if (! $deal instanceof DealWithAssociations) {
throw new CrmException('Deal not found');
}
return [
'id' => $deal->getId(),
'properties' => $deal->getProperties(),
'associations' => $deal->getAssociations(),
];
}
/**
* Generic batch read method for HubSpot objects
*
* @param string $objectType The object type ('deals', 'companies', 'contacts')
* @param array<string> $crmIds Array of HubSpot object IDs (max 100)
* @param array<string> $fields Array of property names to fetch
*
* @return array<string, array> Array keyed by CRM ID with object data
*/
private function batchReadObjects(string $objectType, array $crmIds, array $fields): array
{
if (empty($crmIds)) {
return [];
}
$this->validateBatchSize($objectType, $crmIds);
$this->ensureValidToken();
try {
$batchConfig = $this->createBatchConfiguration($objectType);
$batchReadRequest = $this->prepareBatchRequest($batchConfig, $crmIds, $fields);
$response = $batchConfig['api']->read($batchReadRequest);
$this->validateApiResponse($response, $objectType);
$results = $this->processApiResults($response);
$this->logBatchResults($objectType, $crmIds, $results);
return $results;
} catch (\Throwable $e) {
$this->handleBatchError($e, $objectType, $crmIds);
}
}
private function validateBatchSize(string $objectType, array $crmIds): void
{
if (count($crmIds) > 100) {
throw new \InvalidArgumentException("Batch size cannot exceed 100 {$objectType}");
}
}
private function createBatchConfiguration(string $objectType): array
{
$configurations = [
'deals' => [
'batchReadRequest' => new \HubSpot\Client\Crm\Deals\Model\BatchReadInputSimplePublicObjectId(),
'inputClass' => \HubSpot\Client\Crm\Deals\Model\SimplePublicObjectId::class,
'api' => $this->getNewInstance()->crm()->deals()->batchApi(),
],
'companies' => [
'batchReadRequest' => new \HubSpot\Client\Crm\Companies\Model\BatchReadInputSimplePublicObjectId(),
'inputClass' => \HubSpot\Client\Crm\Companies\Model\SimplePublicObjectId::class,
'api' => $this->getNewInstance()->crm()->companies()->batchApi(),
],
'contacts' => [
'batchReadRequest' => new \HubSpot\Client\Crm\Contacts\Model\BatchReadInputSimplePublicObjectId(),
'inputClass' => \HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectId::class,
'api' => $this->getNewInstance()->crm()->contacts()->batchApi(),
],
];
if (! isset($configurations[$objectType])) {
throw new \InvalidArgumentException("Unsupported object type: {$objectType}");
}
return $configurations[$objectType];
}
private function prepareBatchRequest(array $batchConfig, array $crmIds, array $fields): object
{
$batchReadRequest = $batchConfig['batchReadRequest'];
$inputClass = $batchConfig['inputClass'];
$inputs = array_map(function ($crmId) use ($inputClass) {
$input = new $inputClass();
$input->setId($crmId);
return $input;
}, $crmIds);
$batchReadRequest->setInputs($inputs);
$batchReadRequest->setProperties($fields);
return $batchReadRequest;
}
private function validateApiResponse($response, string $objectType): void
{
if (! $response) {
throw new CrmException("HubSpot API returned null response for {$objectType} batch read");
}
}
private function processApiResults($response): array
{
$results = [];
$responseResults = $response->getResults();
if ($responseResults) {
foreach ($responseResults as $object) {
if ($object && $object->getId()) {
$results[$object->getId()] = [
'id' => $object->getId(),
'properties' => $object->getProperties() ?: [],
];
}
}
}
return $results;
}
private function logBatchResults(string $objectType, array $crmIds, array $results): void
{
$this->log->info("[HubSpot] Batch fetched {$objectType}", [
'requested_count' => count($crmIds),
'returned_count' => count($results),
'crm_ids' => $crmIds,
]);
}
private function handleBatchError(\Throwable $e, string $objectType, array $crmIds): void
{
$errorMessage = $e->getMessage() ?: 'Unknown error';
$errorTrace = $e->getTraceAsString() ?: 'No trace available';
$this->log->error("[HubSpot] Failed to batch fetch {$objectType}", [
'crm_ids' => $crmIds,
'error' => $errorMessage,
'trace' => $errorTrace,
]);
throw new CrmException("Failed to batch fetch {$objectType}: " . $errorMessage);
}
/**
* Batch read multiple opportunities by their CRM IDs
*
* @param array<string> $crmIds Array of HubSpot deal IDs (max 100)
* @param array<string> $fields Array of property names to fetch
*
* @return array<string, array> Array keyed by CRM ID with opportunity data
*/
public function getOpportunitiesByIds(array $crmIds, array $fields): array
{
return $this->batchReadObjects('deals', $crmIds, $fields);
}
/**
* Batch read multiple companies by their CRM IDs
*
* @param array<string> $crmIds Array of HubSpot company IDs (max 100)
* @param array<string> $fields Array of property names to fetch
*
* @return array<string, array> Array keyed by CRM ID with company data
*/
public function getCompaniesByIds(array $crmIds, array $fields): array
{
return $this->batchReadObjects('companies', $crmIds, $fields);
}
/**
* Batch read multiple contacts by their CRM IDs
*
* @param array<string> $crmIds Array of HubSpot contact IDs (max 100)
* @param array<string> $fields Array of property names to fetch
*
* @return array<string, array> Array keyed by CRM ID with contact data
*/
public function getContactsByIds(array $crmIds, array $fields): array
{
return $this->batchReadObjects('contacts', $crmIds, $fields);
}
/**
* @throws CompanyApiException
* @throws CrmException
*/
public function getAccountById(string $crmId, array $fields): array
{
try {
$company = $this->getNewInstance()->crm()->companies()->basicApi()->getById(
$crmId,
implode(',', $fields),
);
} catch (CompanyApiException $e) {
$this->log->info('[Hubspot] Failed to fetch account', [
'crm_id' => $crmId,
'reason' => $e->getMessage(),
]);
throw $e;
}
if (! $company instanceof CompaniesWithAssociations) {
throw new CrmException('Account not found');
}
return [
'id' => $company->getId(),
'properties' => $company->getProperties(),
];
}
/**
* @throws ContactApiException
* @throws CrmException
*/
public function getContactById(string $crmId, array $fields): array
{
try {
$contact = $this->getNewInstance()->crm()->contacts()->basicApi()->getById(
$crmId,
implode(',', $fields)
);
} catch (ContactApiException $e) {
$this->log->info('[Hubspot] Failed to fetch contact', [
'crm_id' => $crmId,
'reason' => $e->getMessage(),
]);
throw $e;
}
if (! $contact instanceof ContactsWithAssociations) {
throw new CrmException('Contact not found');
}
return [
'id' => $contact->getId(),
'properties' => $contact->getProperties(),
];
}
/**
* This is email search request that Hubspot offers as GET (more generous quota)
*/
public function getContactByEmail(string $email, array $fields = []): array
{
try {
$contact = $this->getNewInstance()->crm()->contacts()->basicApi()->getById(
$email,
implode(',', $fields),
null,
false,
'email'
);
return [
'id' => $contact->getId(),
'properties' => $contact->getProperties(),
];
} catch (ContactApiException $e) {
$this->log->info('[Hubspot] Failed to fetch contact', [
'email' => $email,
'reason' => $e->getMessage(),
]);
return [];
}
}
/**
* @throws CrmException
*/
public function fetchProperty(string $objectType, string $propertyId): Property
{
$result = $this->getNewInstance()->crm()->properties()->coreApi()->getByName($objectType, $propertyId);
if (! $result instanceof Property) {
$this->log->error('[Hubspot] Failed to fetch property', [
'object_type' => $objectType,
'property_id' => $propertyId,
'reason' => $result->getMessage(),
]);
throw new CrmException('Failed to fetch property');
}
return $result;
}
/**
* @return array<CrmFieldOption>
*/
public function fetchPropertyOptions(string $objectType, string $propertyId): array
{
/** @var array<CrmFieldOption> */
return $this->fetchProperty($objectType, $propertyId)->getOptions();
}
/**
* @return array<array{id:string, label:string, deleted:bool}>
*/
public function fetchCallDispositions(): array
{
/** @var Response $response */
$response = $this->getInstance()->engagements()->getCallDispositions();
/**
* @var array<array{
* id:string,
* label:string,
* deleted: bool
* }>
*/
return $response->toArray();
}
/**
* @return array<CrmFieldOption>
*/
public function fetchOpportunityPipelineStages(): array
{
$stages = [];
$apiResponse = $this->getNewInstance()->crm()->pipelines()->pipelinesApi()->getAll('deals');
if ($apiResponse instanceof Error) {
$this->log->error('[Hubspot] Failed to fetch opportunity pipelines', [
'reason' => $apiResponse->getMessage(),
]);
return [];
}
foreach ($apiResponse->getResults() as $pipeline) {
$pipelineStages = array_map(
static function (PipelineStage $stage) {
return [
'id' => $stage->getId(),
'label' => $stage->getLabel(),
];
},
$pipeline->getStages()
);
$stages = array_merge($stages, $pipelineStages);
}
return $stages;
}
public function fetchOpportunityPipelines(): array
{
$pipelines = [];
try {
$apiResponse = $this->makeRequest('/crm/v3/pipelines/deals');
} catch (\Exception $e) {
$this->log->info('[Hubspot] Failed to fetch opportunity pipelines', [
'reason' => $e->getMessage(),
]);
return [];
}
$response = $apiResponse->toArray();
foreach ($response['results'] as $pipeline) {
$pipelines[] = [
'id' => $pipeline['id'],
'label' => $pipeline['label'],
];
}
return $pipelines;
}
/**
* @return array<CrmFieldOption>
*/
public function fetchMeetingOutcomeFieldOptions(Field $field): array
{
return $field->getCrmProviderId() === 'meetingOutcome'
? $this->fetchMeetingOutcomeTypes()
: $this->fetchCallActivityTypes();
}
public function fetchMeetingOutcomeTypes(): array
{
return $this->extractMeetingTypeOptions(
'[URL_WITH_CREDENTIALS] Response $response */
$response = $this->getInstance()
->getClient()
->request('GET', $endpoint);
/**
* @var array<array{
* value: string,
* label: string,
* displayOrder: int
* }> $optionData
*/
$optionData = $response->toArray()['options'] ?? [];
$options = [];
foreach ($optionData as $item) {
$options[] = [
'id' => $item['value'],
'value' => $item['value'],
'label' => $item['label'],
'display_order' => $item['displayOrder'],
];
}
return $options;
}
/**
* @return array<CrmFieldOption>
*/
public function fetchDispositionFieldOptions(): array
{
$options = [];
$dispositions = $this->fetchCallDispositions();
foreach ($dispositions as $disposition) {
if ($disposition['deleted'] !== false) {
continue;
}
$option['value'] = $disposition['id'];
$option['id'] = $disposition['id'];
$option['label'] = $disposition['label'];
$options[] = $option;
}
return $options;
}
/**
* @return array<CrmFieldOption>
*/
public function fetchOpportunityFieldOptions(Field $field): array
{
if ($field->isStageField()) {
return $this->fetchOpportunityPipelineStages();
}
if ($field->isPipelineField()) {
return $this->fetchOpportunityPipelines();
}
return $this->fetchPropertyOptions('deals', $field->getCrmProviderId());
}
/**
* @throws BadRequest
* @throws HubspotException
*/
public function makeRequest(string $endpoint, $method = 'GET', $payload = [], ?string $queryString = null)
{
$endpoint = self::BASE_URL . $endpoint;
if ($method === 'GET') {
$response = $this->getInstance()->getClient()?->request(
method: $method,
endpoint: $endpoint,
query_string: $queryString
);
} else {
$response = $this->getInstance()->getClient()->request($method, $endpoint, [
'json' => ($payload),
]);
}
//
// $max = $response->getHeaderLine('X-HubSpot-RateLimit-Max'); // "110"
// $remaining = $response->getHeaderLine('X-HubSpot-RateLimit-Remaining'); // "109"
// $interval = $response->getHeaderLine('X-HubSpot-RateLimit-Interval-Milliseconds'); // "10000"
// $body = json_decode((string) $response->getBody(), true);
//
// \Illuminate\Support\Facades\Log::channel('custom_channel')->info('$max ' . PHP_EOL . print_r($max, true));
// \Illuminate\Support\Facades\Log::channel('custom_channel')->info('$remaining ' . PHP_EOL . print_r($remaining, true));
// \Illuminate\Support\Facades\Log::channel('custom_channel')->info('$interval ' . PHP_EOL . print_r($interval, true));
// \Illuminate\Support\Facades\Log::channel('custom_channel')->info('$body ' . PHP_EOL . print_r($body, true));
return $response;
}
/**
* @throws BadRequest
* @throws HubspotException
*/
public function createMeeting(array $payload): Response
{
$endpoint = '/crm/v3/objects/meetings';
return $this->makeRequest($endpoint, 'POST', $payload);
}
/**
* @throws BadRequest
* @throws HubspotException
*/
public function updateMeeting(string $meetingId, array $payload): Response
{
$endpoint = '/crm/v3/objects/meetings/' . $meetingId;
return $this->makeRequest($endpoint, 'PATCH', $payload);
}
/**
* @throws \Exception
*/
public function createNote(
string $body,
string $ownerId,
int $timestamp,
string $objectId,
NoteObject $noteObject
): ?string {
try {
$noteInput = new SimplePublicObjectInput([
'properties' => [
'hs_note_body' => $body,
'hubspot_owner_id' => $ownerId,
'hs_timestamp' => $timestamp,
],
]);
// Create note
$note = $this->getNewInstance()->crm()->objects()->basicApi()->create('note', $noteInput);
$this->getNewInstance()->crm()->objects()->associationsApi()->create(
'note',
$note->getId(),
$this->getNoteObject($noteObject),
$objectId,
$this->getNoteAssociationType($noteObject),
);
return $note->getId();
} catch (\Exception $e) {
$this->log->error('[Hubspot] Failed to create note', [
'objectId' => $objectId,
'noteObject' => $noteObject->getObjectType(),
'reason' => $e->getMessage(),
]);
\Sentry::captureException($e);
}
return null;
}
public function updateEngagement(string $objectId, array $engagement, array $metadata): void
{
$this->getInstance()->engagements()->update($objectId, $engagement, $metadata);
}
public function getEngagementData(string $engagementId): array
{
$engagement = $this->getInstance()->engagements()->get($engagementId);
return $engagement->toArray();
}
public function createEngagement(array $engagement, array $associations, array $metadata): Response
{
return $this->getInstance()
->engagements()
->create($engagement, $associations, $metadata);
}
public function isUnauthorizedException(\Exception $e): bool
{
// Check for specific HubSpot API exception types first
if ($e instanceof BadRequest) {
// BadRequest can contain 401 status codes
return $e->getCode() === 401;
}
// Check for HTTP client exceptions with status codes
if ($e instanceof \GuzzleHttp\Exception\RequestException && $e->hasResponse()) {
$response = $e->getResponse();
if ($response !== null) {
return $response->getStatusCode() === 401;
}
}
// Check for Guzzle HTTP exceptions
if ($e instanceof \GuzzleHttp\Exception\ClientException) {
return $e->getCode() === 401;
}
// Fallback to string matching as last resort, but be more specific
$message = strtolower($e->getMessage());
return str_contains($message, '401 unauthorized') ||
str_contains($message, 'http 401') ||
str_contains($message, 'status code 401') ||
(preg_match('/\b401\b/', $message) && str_contains($message, 'unauthorized'));
}
/**
* Validates and refreshes the access token if needed before API requests.
* This ensures long-running processes don't fail due to token expiration.
*
* @throws SocialAccountTokenInvalidException
*/
public function ensureValidToken(): void
{
if ($this->oauthAccount === null) {
return;
}
$newToken = $this->tokenManager->ensureValidToken($this->oauthAccount);
if ($newToken !== null) {
$this->accessToken = $newToken;
}
}
public function getConfig()
{
return $this->config;
}
// returns only active (archived=false)
public function getOwners(): array
{
return $this->getNewInstance()->crm()->owners()->getAll();
}
/**
* @param bool $archived
*
* @return array<Owner>|[]
*/
public function getOwnersArchived(bool $archived = true): array
{
$endpoint = '/crm/v3/owners';
$queryParams = [
'archived' => $archived ? 'true' : 'false',
];
$queryString = http_build_query($queryParams);
$owners = [];
try {
$response = $this->makeRequest(endpoint: $endpoint, queryString: $queryString);
$responseData = $response?->toArray();
foreach ($responseData['results'] as $result) {
try {
$owners[] = Owner::create($result);
} catch (Throwable $e) {
$this->log->error('[HubSpot] Failed to process owner data', [
'result' => $result,
'error' => $e->getMessage(),
]);
continue;
}
}
} catch (Throwable $e) {
$this->log->error('HubSpot] Failed to fetch owners', [
'archived' => $archived,
'error' => $e->getMessage(),
]);
return [];
}
return $owners;
}
public function getMeeting(string $engagementId): ObjectWithAssociations
{
return $this->getNewInstance()->crm()->objects()->basicApi()
->getById('meeting', $engagementId, null, 'contact,company,deal');
}
public function deleteEngagement(string $engagementId): void
{
$this->getInstance()->engagements()->delete((int) $engagementId);
}
public function getAssociationsData(array $ids, string $fromObject, string $toObject): array
{
$associationData = [];
$idChunks = array_chunk($ids, self::ASSOCIATIONS_BATCH_SIZE_LIMIT);
foreach ($idChunks as $idChunk) {
try {
$batchInput = new \HubSpot\Client\Crm\Associations\Model\BatchInputPublicObjectId();
$batchInput->setInputs(array_map(function ($id) {
$publicObjectId = new \HubSpot\Client\Crm\Associations\Model\PublicObjectId();
$publicObjectId->setId($id);
return $publicObjectId;
}, $idChunk));
$associatedObjectsData = $this
->getNewInstance()
->crm()
->associations()
->batchApi()
->read($fromObject, $toObject, $batchInput);
if ($associatedObjectsData instanceof \HubSpot\Client\Crm\Associations\Model\BatchResponsePublicAssociationMulti) {
foreach ($associatedObjectsData->getResults() as $association) {
$from = $association->getFrom()->getId();
$toAssociations = $association->getTo();
if (! empty($toAssociations)) {
$associationData[$from] = array_map(function ($item) {
return $item->getId();
}, $toAssociations);
}
}
}
// } catch (RateLimitException $e) {
// throw $e;
} catch (\Exception $e) {
$this->log->error('[Hubspot] Failed to fetch associations', [
'from_object' => $fromObject,
'to_object' => $toObject,
'reason' => $e->getMessage(),
]);
}
}
return $associationData;
}
/**
* @throws \Exception
*/
private function getNoteAssociationType(NoteObject $noteObject): string
{
return match($noteObject) {
NoteObject::Opportunity => 'note_to_deal',
NoteObject::Lead, NoteObject::Contact => 'note_to_contact', // or 'note_to_lead' if your portal supports it
NoteObject::Account => 'note_to_company',
NoteObject::Call, NoteObject::Event => throw new \Exception('Not supported'),
};
}
/**
* @throws \Exception
*/
private function getNoteObject(NoteObject $noteObject): string
{
return match($noteObject) {
NoteObject::Opportunity => 'deal',
NoteObject::Lead, NoteObject::Contact => 'contact',
NoteObject::Account => 'company',
NoteObject::Call, NoteObject::Event => throw new \Exception('Not supported'),
};
}
public function addAssociations(string $objectType, string $associationType, array $payload): Response
{
$endpoint = "/crm/v4/associations/$objectType/$associationType/batch/create";
return $this->makeRequest($endpoint, 'POST', $payload);
}
public function removeAssociations(string $objectType, string $associationType, array $payload): Response
{
$endpoint = "/crm/v4/associations/$objectType/$associationType/batch/archive";
return $this->makeRequest($endpoint, 'POST', $payload);
}
}
Sync Changes
Hide This Notification
Code changed:
Hide
19
Previous Highlighted Error
Next Highlighted Error
[2026-05-07 14:21:15] local.INFO: [Hubspot] DEBUG Getting headers {
"headers":{
"Date":["Thu,07 May 2026 14:21:15 GMT"],
"Content-Type":["application/json;charset=utf-8"],
"Transfer-Encoding":["chunked"],
"Connection":["keep-alive"],
"CF-Ray":["9f80deb8db60dc3a-SOF"],
"CF-Cache-Status":["DYNAMIC"],
"Strict-Transport-Security":["max-age=31536000; includeSubDomains; preload"],
"Vary":["origin,
accept-encoding"],
"access-control-allow-credentials":["false"],
"server-timing":["hcid;desc=\"019e02d0-6fd8-7812-bdba-885b7ccb3ee3\",
cfr;desc=\"9f80deb8e7c6dc3a-IAD\""],
"x-content-type-options":["nosniff"],
"x-hubspot-correlation-id":["019e02d0-6fd8-7812-bdba-885b7ccb3ee3"],
"Set-Cookie":["__cf_bm=SIUrtdQgXVrik50pdqF6hZVYKhzTnQBidvMabeCtm0Y-1778163675-[IP_ADDRESS]-rI.ZggtDKxTge5zr8_2gbBfWMQQ.ufZEXDZyHz2mBUFdzdo2gTHEsOkXMSEShjK0hGYxNhUGM1ZoBpX7BcFZcHEjA7Cs_.SMUhUnd2nYjko; path=/; expires=Thu,
07-May-26 14:51:15 GMT; domain=.hubapi.com; HttpOnly; Secure; SameSite=None"],
"Report-To":["{
\"endpoints\":[{
\"url\":\"https:\\/\\/a.nel.cloudflare.com\\/report\\/v4?s=NYAlsVTP0fYm32qrSDjxYE4sd2RWRqiSp3wHsmdEgZlzoYdxI%2BIxVpHmsKn3O%2BKVA3mFIJ2m7YRECDGSM%2BW2IYTzo6FM4%2BdUIjURO8srzKSvJgZ%2BQ6R79arKQw3uHLlX\"}],
\"group\":\"cf-nel\",
\"max_age\":604800}"],
"NEL":["{
\"success_fraction\":0.01,
\"report_to\":\"cf-nel\",
\"max_age\":604800}"],
"Server":["cloudflare"]}} {
"correlation_id":"95236535-ec98-4541-b92a-adfa73b69eab",
"trace_id":"c7ab8365-903f-46d4-9403-0e5b551e3545"}
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
PhpStorm
|
faVsco.js – Client.php
|
NULL
|
15439
|
|
15438
|
Project: faVsco.js, menu
JY-20725-handle-HS-search Project: faVsco.js, menu
JY-20725-handle-HS-search-rate-limit, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
+FirefoxFileEditViewHistoryBookmarksProfilesToolsWindowHelplah|meet.google.com/mie-gawc-dsi?authuser=[EMAIL] Yankov (Presenting)Jy 20451 ServicXJmim8 PromoO Attent0 Cals -AtsenlCa TranspJmine* MCPIhttps://fiminny.atlassian.net/jira/software/c/projects/JY/boards/37?selectedissue=JY-205668E Datadog* Clauón• crоeс.Platform Team %Q Search boardP JY-TLOTT HST-Z0SAI Review - Q1 - Summary/Action items/Key PointsIn Dev vi Improve StoryAJ Panorama for CallScoring n ou(AUTOMATED AT SGORINGKedoy torDuVA Jy-20301DetailsSetup test coverage forProonoricherMAINTENANCISBacklogE 3-199511****=DescriptionRun AI evaluations for all Al services against the latest versions of trending LLMs and store the results in Google Drive. Wewant to see how our features are tracking comparing to new models that are coming out.• Summary on Call• Action Items on Call |*Key Points on Cal• AA on Call•AAOU• Identity participants foe mono calisAssignee3 Stellyan GeorgievAssign to meReporter& Galya DimitrovaUpdate the test-set. Remove the deleted activities.DevelopmentQ Open with VS Code1 branch14 commits1 pull request4 bullds6 days agoMEROEOSubtasks|••+66% DoneReleases) Productiont7 See all deploymentsWorkPrlocity= MediumCh JY-20568 CLONE - Action items evaluation= Medium% JY-20569 CLONE - Key points evaluaton= Mediumi Stellyan...i2 Stellyan...8 Unassign...ComponentsPlatformSub-ProductNowOdooDaily - Platform - now100% L2Mon 11 May 9:50:129C DerappіoL Al BookmarxsGroup: QueriesAI Reports > Empty pagedesign and promotonAJREPORTSDeployed-20372 1 02 •*** = |JOK V ALUICDeployed0 -20726 |1 • ****=Allow users to delete SSand Panorama promptswhen those are used in a...AarokisDeployedRelease AJ PanoramaAJREPORTSR -20740 05 11 ...0:summary in the CRMNikolay IvanovNikolay Yankov4 othersAneliya Angelova9:50 AM | Daily - Platform→Lukas Kovalik1:45...
|
PhpStorm
|
faVsco.js – Client.php
|
NULL
|
15438
|
|
15437
|
Project: faVsco.js, menu
JY-20725-handle-HS-search Project: faVsco.js, menu
JY-20725-handle-HS-search-rate-limit, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
PhostormVIewINavicareCodeFV faVsco.js°9 JY-20725-handle-HS-search-rate-limroledey© BatchSyncCollectolyhuospotsyncstrategybase.ongCachedcrmservicebecorator.onp© ProspectCache.phpe balchsynckealsseС Cпескапокetrукemotematch.ongccloseaDealstagess @ MatchacuivitycrmData.ong© ermactivilyservice.phgDealrielasservice.gc)Decorateacuivilv.or© FieldDefinitions.phrclass Cllent extends Baseclient 1mpLements Hubspotcllentintertace- A2 A65 X1X1 ~C) FieldT vpeconvertee Hubspotclientinterc) Hubspotlokenman© PayloadBuilder.phpC) RemotecrmobiectP ResponseNormalizec) Service.onoC)SvncFieldAction.onC) SvncRelatedActivitC) WebhookSvncBatclv MintearationAorM Acceccors• D ConfigD DTO• M SiltersJobs• M ProcnectSoarchStr.W service lralts© DataClient.php© DecorateActivity.phcLocalsearch.oneu LocalSearchintertac© RemoteSearch.phpc) Service.phpv W Listeners© ConvertLeadActivitc) PurceLookuocache> M Metadata> Miarationa Pioedrivev Salesforce• D Fields• M OnnortunitvMatcheMOnnortunitvSvneSt897 (M ProsneetSearchStr.M ServiceTraitcC) Client nhr© DecorateActivity.ph. Delete@biectsTrait© FieldDefinitions.php© PayloadBuilder.php© Profile.php© QueryBuilder.phpououc tunction 1sunauthorizedzxcentionExcentionse: 000ureturn str contains(Smessage. "401 unauthorized')Istr contains(Smessage..'http 401') |1str_contains(Smessage, 'status code 401') |(orea match( pattern: • /\b401\b/' Smessage) &s str contains(Smessage, 'unauthorized')):* Validates and refreshes the access token if needed before API requests.* This ensures long-running processes don't fail due to token expiration.* @throws SocialAccountTokenInvalidExceptiony usagespublic function ensureValidToken: voidif (Sthis->oauthAccount === null) {Snewloken = sthis->tokenmanaqer->ensureval1dloken(sth1s->oauthaccountrif (SnewToken !== null) {sthis-›accessloken = snewloken:public function getConfigoreturn Sthis->confia:returns onlv active (archived=false)9 usadespublic function get0wners: arrayreturn $this->getNewInstance()->crm()->owners()->getALL();* apanam bool Sarchived* dretum arrau<ownens/r71s usages40 hlDally - Platrorm • now100% 4 • Mon 11 May 9:50:09U AskJiminnyReportActivityServiceTest v+0 ..11 1l1III=custom.log ^=laravel.logA SF (jiminny@localhost]4 HS_local [jiminny@localhost]# console [PKob.# console [euJ# console [slAGiNG)[2026-05-07 14:21:15] local.INF0: [Hubspot] DEBUG Getting headers {w19 .V"neaders".?"Uace":L"Inu,or May 2020 14.21.15 6Ml"Jn"Transter-Encod1nq":"chunked")."Connection":"keep-alive""CF-Ray" : ["9f80deb8db60dc3a-SOF"],"Strict-Transport-Secur1ty":"max-aqe=31536008* 1ncludeSubDomains: preload")naccent-encodino""access-control-allow-credentials": ["false"]."server-timing": ["hcid;desc=\"019e02d0-6fd8-7812-bdba-885b7ccb3ee3\","x-hubspot-correlation-id":["019e02d0-6fd8-7812-bdba-885b7ccb3ee3"],"So+-Cookie"." c+hm-Stlirtd0aXVr.kSandas6hzVVKhzTn0BidvMaheCtm0V-1778163675-1.0.107-May-26 14:51:15 GMT; domain=.hubapi.com; Http0nly; Secure; SameSite=None"],"Renont-To"."","endpoints\":[{"unl".httns:a.nel.cloudflane.com./nenon+|W/v42c=NVA1cVTPQfVm32anS0ixVF/sd2RI\"group)":\"cf-nel\","max_age\":604800}"],"NEL":["{\"success_fraction\":0.01,reportto. "cr-nel,"max age":604800}"]"Server": ["cloudflare"]}} {"correlation_1d":"95256555-ec98-4541-b9za-adta/Sb6Yeab","trace_10":"C/AD8565-905t-4604-9405-0e50551e5545I IIllC;CascadeHubspot Rate Limit Reif (Sretry) {sleenab:return $this->searchCallsForPeriodByPage($from, $to, $page, false);return null;Why this is now broken/suboptimal with the new client1. Covehes Encef lint Couk Be 1,0, o.) l tecuro d: we aiays sCcep ion that The now clioni carefly consirveted win rety after fiom headers in2. For tng te eage a mpy. The mont cen meon tweslor notsea th lil oer eit o - en oat , t aoi, od in trniscont aloe atry andtee siently3. The Sretry = false recursive flaa is fragile. Once we pass retrvefalse. on the second 429 we just return null without distinguishing rate limit from reaSuggestionCatch Ratel imitFycention cnecificallv and uco detRetrvifterd.D phppublic function searchCallsForPeriodByPage(Carbon strom, Carbon sto, int Spage, int sretries = 2)trydSpay Load = Sthis->payLoadbu1lder->generatesearchcaulsByPer1odPayLoad(Strom, Sto, Spage);return sthis->client->search'cals". Soavload):} catch (RateLimitException $e) {throw se: // hubble un: caller decidec whether to fail the imnort or releace the iohlsleen min Se->aetRetrvAftero, 30)):return $this->searchCallsForPeriodByPage($from, $to, $page, $retries - 1);} catch (Exception Sexception) {$this->logger->info('(HubSpot) Search calls for period failed', (...]);recurh nuet;only swallow non-rate-limit Tallures as beroreEven better — if searchCallsForPeriod is called from a queued job (which it typically is for backfills), don't swallow at all. Let RateLimitException bubble to thejob middleware (HandleHubspotRateLimit), which already handles release-with-delay properly. The in-process sleep() wastes a worker for up to 30s and ties upHorizon throughput.Let me check if it's job-driven:Coorchod caorsbColleGorDorindlrdingURLToken in app (.php) (5)Both callers are backaround workflows (a Console command and an internal service). So letting RateLimitException bubble to the iob middleware is the cleanestanswer - drop the sleep(1) retry path entirely and rely on HandleHubspotRateLimit:: release(Sdelay)TL:DR for #2: the sleep(1) predates the new structured exception. Either:• Catch RateLimitException and use getRetryAfter() (replace blind sleep(1) ), orLet it bubble to the job middleware and delete the in-process retry - preferred3. Whv matchExactlvBvEmail() Has No Rate Limit HandlinaCalle(erch d lstorPero itnypase/secrchdll forpernod /searchCalt9 eo adinguiLroten) it.on onyi6e handit 62-198 wil remove it from find and otherWN Windsurf Teams802•6UTF.RPo 4 spaces...
|
PhpStorm
|
faVsco.js – Client.php
|
NULL
|
15437
|
|
15436
|
Project: faVsco.js, menu
JY-20725-handle-HS-search Project: faVsco.js, menu
JY-20725-handle-HS-search-rate-limit, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
FirefoxFileEditViewHistoryBookmarksProfilesToolsWindowHelplah|meet.google.com/mie-gawc-dsi?authuser=[EMAIL] Yankov (Presenting)Daily - Platform - now100% LMon 11 May 9:50:099+•SC Jy 20451 Servic83 Jmier8 Promohttps://fiminny.atlassian.net/jira/software/c/projects/JY/boards/37?selectedissue=JY-20566D Projects23 SSHPlatform Team %.Q Search board20€A.J Panorama for CallScoring n ou(AUTOMATED AT SGORINGKedoy torDoyA Jy-2030125 **** = $Setup test coverage forProonorioherMASNTENANCISBacklogE 3-109511****= 3O: AttentEa DatadogCalsCa Transp3 CircleCi|SentryX MCP*xI0 DerMon 11 May 9:50• appіo|L Al BookmarxsGroup: QueriesAI Reports > Empty pagedesign and promotonAJREPORTSDeployed0 -20372 1 П •** = |Grok via AzureMAINTENANCEDeployedД -207261 @ •++•=Allow users to delete SSand Panorama promptswhen those are used in a...AJREPORTSDeployed0E -20770 / 12 ..*0 =Release AJ PanoramaDeployed0 -20740 05 12 •***=Wrong formatting forsummary in the CRMMASNTENANCENikolay IvanovNikolay Yankov4 othersAneliya Angelova9:50 AM | Daily - PlatformLộ3Lukas Kovalik1:42...
|
PhpStorm
|
faVsco.js – Client.php
|
NULL
|
15436
|
|
15435
|
Project: faVsco.js, menu
JY-20725-handle-HS-search Project: faVsco.js, menu
JY-20725-handle-HS-search-rate-limit, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
2
65
1
1
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Services\Crm\Hubspot;
use HubSpot\Client\Crm\Deals\ApiException as DealApiException;
use HubSpot\Client\Crm\Contacts\ApiException as ContactApiException;
use HubSpot\Client\Crm\Companies\ApiException as CompanyApiException;
use HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectWithAssociations as ContactsWithAssociations;
use HubSpot\Client\Crm\Companies\Model\SimplePublicObjectWithAssociations as CompaniesWithAssociations;
use HubSpot\Client\Crm\Deals\Model\SimplePublicObjectWithAssociations as DealWithAssociations;
use HubSpot\Client\Crm\Objects\Model\SimplePublicObjectInput;
use HubSpot\Client\Crm\Objects\Model\SimplePublicObjectWithAssociations as ObjectWithAssociations;
use HubSpot\Client\Crm\Pipelines\Model\Error;
use HubSpot\Client\Crm\Pipelines\Model\PipelineStage;
use HubSpot\Client\Crm\Properties\Model\Property;
use HubSpot\Discovery\Discovery;
use Jiminny\Exceptions\CrmException;
use Jiminny\Exceptions\RateLimitException;
use Jiminny\Exceptions\SocialAccountTokenInvalidException;
use Jiminny\Jobs\Crm\NoteObject;
use Jiminny\Models\Crm\Field;
use Jiminny\Services\Crm\BaseClient;
use Jiminny\Services\Crm\Hubspot\DTO\Response\Owner;
use Jiminny\Services\SocialAccountService;
use SevenShores\Hubspot\Exceptions\BadRequest;
use SevenShores\Hubspot\Exceptions\HubspotException;
use SevenShores\Hubspot\Factory;
use SevenShores\Hubspot\Http\Response;
use Jiminny\Services\Crm\Hubspot\Pagination\HubspotPaginationService;
use Throwable;
/**
* @phpstan-type CrmFieldOption array{id:string, label:string, value?:string}
*/
class Client extends BaseClient implements HubspotClientInterface
{
public const string MIN_API_VERSION = '2';
public const string BASE_URL = '[URL_WITH_CREDENTIALS] T
* @param callable(): T $apiCall
* @return T
*
* @throws RateLimitException
*/
private function executeRequest(callable $apiCall)
{
try {
return $apiCall();
} catch (Throwable $e) {
if ($this->isHubspotRateLimit($e)) {
$retryAfter = $this->parseRetryAfter($e);
$this->log->warning('[Hubspot] Received 429 from API', [
'team_id' => $this->config->team_id,
'config_id' => $this->config->getId(),
'retry_after' => $retryAfter,
'reason' => $e->getMessage(),
]);
throw new RateLimitException('Hubspot returned 429', $retryAfter, $e);
}
throw $e;
}
}
public function isHubspotRateLimit(Throwable $e): bool
{
if ($e instanceof BadRequest
|| $e instanceof DealApiException
|| $e instanceof ContactApiException
|| $e instanceof CompanyApiException
|| $e instanceof \GuzzleHttp\Exception\RequestException
) {
return (int) $e->getCode() === 429;
}
return false;
}
public function parseRetryAfter(Throwable $e): int
{
// First try to get Retry-After from response headers
if (method_exists($e, 'getResponseHeaders')) {
$headers = $e->getResponseHeaders() ?: [];
$value = $headers['Retry-After'] ?? $headers['retry-after'] ?? null;
if (is_array($value)) {
$value = $value[0] ?? null;
}
if (is_numeric($value)) {
return (int) $value;
}
}
if (method_exists($e, 'getResponseBody')) {
$body = $e->getResponseBody();
if (is_string($body)) {
$body = json_decode($body, true) ?? [];
}
$policyName = $body['policyName'] ?? $body['policy'] ?? $body['context']['policyName'] ?? null;
if ($policyName === 'TEN_SECONDLY_ROLLING' || $policyName === 'ten_secondly_rolling') {
return 10;
}
if ($policyName === 'SECONDLY' || $policyName === 'secondly') {
return 1;
}
}
$this->log->warning('[Hubspot] No retry-after header or policy name found, using default', [
'exception_class' => get_class($e),
]);
return 10;
}
public function getMinimumApiVersion(): string
{
return self::MIN_API_VERSION;
}
public function getInstance(): Factory
{
return new Factory([
'key' => $this->accessToken,
'oauth2' => true,
'base_url' => $this->baseUrl,
]);
}
public function getNewInstance(): Discovery
{
return \HubSpot\Factory::createWithAccessToken($this->accessToken);
}
/**
* Secondly and daily limits for Hubspot API
*
* Product Tier: Free & Starter | Professional & Enterprise | API add-on (any tier)
* Burst: 100/10 seconds | 150/10 seconds | 200/10 seconds
* Daily: 250,000 | 500,000 | 1,000,000
*
* Official documentation states: The search endpoints are rate limited to five requests per second.
* Since with 5 RPS were still hitting secondly rate limits we lowered it to 4
*/
public function getPaginatedData(array $payload, string $type, int $offset = 0): array
{
$total = 0;
$lastId = null;
$rows = [];
foreach ($this->getPaginatedDataGenerator($payload, $type, $offset, $total, $lastId) as $row) {
$rows[] = $row;
}
return ['results' => $rows, 'total' => $total, 'last_record' => $lastId];
}
/**
* @throws HubspotException
* @throws SocialAccountTokenInvalidException
* @throws BadRequest
*/
public function getPaginatedDataGenerator(
array $payload,
string $type,
int $offset = 0,
int &$total = 0,
?string &$lastRecordId = null
): \Generator {
return $this->paginationService->getPaginatedDataGenerator(
$this,
$payload,
$type,
$offset,
$total,
$lastRecordId
);
}
/**
* Execute a search request against HubSpot CRM objects with rate limiting.
*
* @param string $objectType The object type ('deals', 'companies', 'contacts', 'calls')
* @param array<string, mixed> $payload The search payload with filters, sorts, properties, etc.
* @return array The search response with 'results', 'total', 'paging' keys
* @throws RateLimitException When rate limit is hit
* @throws HubspotException On API errors
*/
public function search(string $objectType, array $payload): array
{
$endpoint = self::BASE_URL . "/crm/v3/objects/{$objectType}/search";
return $this->executeRequest(function () use ($endpoint, $payload) {
$response = $this->getInstance()->getClient()->request('POST', $endpoint, ['json' => $payload]);
return $response->toArray();
});
}
/**
* @throws DealApiException
* @throws CrmException
*/
public function getOpportunityById(string $crmId, array $fields): array
{
try {
// $deal = $this->executeRequest(fn () => $this->getNewInstance()->crm()->deals()->basicApi()->getById(
$deal = $this->getNewInstance()->crm()->deals()->basicApi()->getById(
$crmId,
implode(',', $fields),
'companies,contacts'
);
} catch (DealApiException $e) {
$this->log->info('[Hubspot] Failed to fetch opportunity', [
'crm_id' => $crmId,
'reason' => $e->getMessage(),
]);
throw $e;
}
if (! $deal instanceof DealWithAssociations) {
throw new CrmException('Deal not found');
}
return [
'id' => $deal->getId(),
'properties' => $deal->getProperties(),
'associations' => $deal->getAssociations(),
];
}
/**
* Generic batch read method for HubSpot objects
*
* @param string $objectType The object type ('deals', 'companies', 'contacts')
* @param array<string> $crmIds Array of HubSpot object IDs (max 100)
* @param array<string> $fields Array of property names to fetch
*
* @return array<string, array> Array keyed by CRM ID with object data
*/
private function batchReadObjects(string $objectType, array $crmIds, array $fields): array
{
if (empty($crmIds)) {
return [];
}
$this->validateBatchSize($objectType, $crmIds);
$this->ensureValidToken();
try {
$batchConfig = $this->createBatchConfiguration($objectType);
$batchReadRequest = $this->prepareBatchRequest($batchConfig, $crmIds, $fields);
$response = $batchConfig['api']->read($batchReadRequest);
$this->validateApiResponse($response, $objectType);
$results = $this->processApiResults($response);
$this->logBatchResults($objectType, $crmIds, $results);
return $results;
} catch (\Throwable $e) {
$this->handleBatchError($e, $objectType, $crmIds);
}
}
private function validateBatchSize(string $objectType, array $crmIds): void
{
if (count($crmIds) > 100) {
throw new \InvalidArgumentException("Batch size cannot exceed 100 {$objectType}");
}
}
private function createBatchConfiguration(string $objectType): array
{
$configurations = [
'deals' => [
'batchReadRequest' => new \HubSpot\Client\Crm\Deals\Model\BatchReadInputSimplePublicObjectId(),
'inputClass' => \HubSpot\Client\Crm\Deals\Model\SimplePublicObjectId::class,
'api' => $this->getNewInstance()->crm()->deals()->batchApi(),
],
'companies' => [
'batchReadRequest' => new \HubSpot\Client\Crm\Companies\Model\BatchReadInputSimplePublicObjectId(),
'inputClass' => \HubSpot\Client\Crm\Companies\Model\SimplePublicObjectId::class,
'api' => $this->getNewInstance()->crm()->companies()->batchApi(),
],
'contacts' => [
'batchReadRequest' => new \HubSpot\Client\Crm\Contacts\Model\BatchReadInputSimplePublicObjectId(),
'inputClass' => \HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectId::class,
'api' => $this->getNewInstance()->crm()->contacts()->batchApi(),
],
];
if (! isset($configurations[$objectType])) {
throw new \InvalidArgumentException("Unsupported object type: {$objectType}");
}
return $configurations[$objectType];
}
private function prepareBatchRequest(array $batchConfig, array $crmIds, array $fields): object
{
$batchReadRequest = $batchConfig['batchReadRequest'];
$inputClass = $batchConfig['inputClass'];
$inputs = array_map(function ($crmId) use ($inputClass) {
$input = new $inputClass();
$input->setId($crmId);
return $input;
}, $crmIds);
$batchReadRequest->setInputs($inputs);
$batchReadRequest->setProperties($fields);
return $batchReadRequest;
}
private function validateApiResponse($response, string $objectType): void
{
if (! $response) {
throw new CrmException("HubSpot API returned null response for {$objectType} batch read");
}
}
private function processApiResults($response): array
{
$results = [];
$responseResults = $response->getResults();
if ($responseResults) {
foreach ($responseResults as $object) {
if ($object && $object->getId()) {
$results[$object->getId()] = [
'id' => $object->getId(),
'properties' => $object->getProperties() ?: [],
];
}
}
}
return $results;
}
private function logBatchResults(string $objectType, array $crmIds, array $results): void
{
$this->log->info("[HubSpot] Batch fetched {$objectType}", [
'requested_count' => count($crmIds),
'returned_count' => count($results),
'crm_ids' => $crmIds,
]);
}
private function handleBatchError(\Throwable $e, string $objectType, array $crmIds): void
{
$errorMessage = $e->getMessage() ?: 'Unknown error';
$errorTrace = $e->getTraceAsString() ?: 'No trace available';
$this->log->error("[HubSpot] Failed to batch fetch {$objectType}", [
'crm_ids' => $crmIds,
'error' => $errorMessage,
'trace' => $errorTrace,
]);
throw new CrmException("Failed to batch fetch {$objectType}: " . $errorMessage);
}
/**
* Batch read multiple opportunities by their CRM IDs
*
* @param array<string> $crmIds Array of HubSpot deal IDs (max 100)
* @param array<string> $fields Array of property names to fetch
*
* @return array<string, array> Array keyed by CRM ID with opportunity data
*/
public function getOpportunitiesByIds(array $crmIds, array $fields): array
{
return $this->batchReadObjects('deals', $crmIds, $fields);
}
/**
* Batch read multiple companies by their CRM IDs
*
* @param array<string> $crmIds Array of HubSpot company IDs (max 100)
* @param array<string> $fields Array of property names to fetch
*
* @return array<string, array> Array keyed by CRM ID with company data
*/
public function getCompaniesByIds(array $crmIds, array $fields): array
{
return $this->batchReadObjects('companies', $crmIds, $fields);
}
/**
* Batch read multiple contacts by their CRM IDs
*
* @param array<string> $crmIds Array of HubSpot contact IDs (max 100)
* @param array<string> $fields Array of property names to fetch
*
* @return array<string, array> Array keyed by CRM ID with contact data
*/
public function getContactsByIds(array $crmIds, array $fields): array
{
return $this->batchReadObjects('contacts', $crmIds, $fields);
}
/**
* @throws CompanyApiException
* @throws CrmException
*/
public function getAccountById(string $crmId, array $fields): array
{
try {
$company = $this->getNewInstance()->crm()->companies()->basicApi()->getById(
$crmId,
implode(',', $fields),
);
} catch (CompanyApiException $e) {
$this->log->info('[Hubspot] Failed to fetch account', [
'crm_id' => $crmId,
'reason' => $e->getMessage(),
]);
throw $e;
}
if (! $company instanceof CompaniesWithAssociations) {
throw new CrmException('Account not found');
}
return [
'id' => $company->getId(),
'properties' => $company->getProperties(),
];
}
/**
* @throws ContactApiException
* @throws CrmException
*/
public function getContactById(string $crmId, array $fields): array
{
try {
$contact = $this->getNewInstance()->crm()->contacts()->basicApi()->getById(
$crmId,
implode(',', $fields)
);
} catch (ContactApiException $e) {
$this->log->info('[Hubspot] Failed to fetch contact', [
'crm_id' => $crmId,
'reason' => $e->getMessage(),
]);
throw $e;
}
if (! $contact instanceof ContactsWithAssociations) {
throw new CrmException('Contact not found');
}
return [
'id' => $contact->getId(),
'properties' => $contact->getProperties(),
];
}
/**
* This is email search request that Hubspot offers as GET (more generous quota)
*/
public function getContactByEmail(string $email, array $fields = []): array
{
try {
$contact = $this->getNewInstance()->crm()->contacts()->basicApi()->getById(
$email,
implode(',', $fields),
null,
false,
'email'
);
return [
'id' => $contact->getId(),
'properties' => $contact->getProperties(),
];
} catch (ContactApiException $e) {
$this->log->info('[Hubspot] Failed to fetch contact', [
'email' => $email,
'reason' => $e->getMessage(),
]);
return [];
}
}
/**
* @throws CrmException
*/
public function fetchProperty(string $objectType, string $propertyId): Property
{
$result = $this->getNewInstance()->crm()->properties()->coreApi()->getByName($objectType, $propertyId);
if (! $result instanceof Property) {
$this->log->error('[Hubspot] Failed to fetch property', [
'object_type' => $objectType,
'property_id' => $propertyId,
'reason' => $result->getMessage(),
]);
throw new CrmException('Failed to fetch property');
}
return $result;
}
/**
* @return array<CrmFieldOption>
*/
public function fetchPropertyOptions(string $objectType, string $propertyId): array
{
/** @var array<CrmFieldOption> */
return $this->fetchProperty($objectType, $propertyId)->getOptions();
}
/**
* @return array<array{id:string, label:string, deleted:bool}>
*/
public function fetchCallDispositions(): array
{
/** @var Response $response */
$response = $this->getInstance()->engagements()->getCallDispositions();
/**
* @var array<array{
* id:string,
* label:string,
* deleted: bool
* }>
*/
return $response->toArray();
}
/**
* @return array<CrmFieldOption>
*/
public function fetchOpportunityPipelineStages(): array
{
$stages = [];
$apiResponse = $this->getNewInstance()->crm()->pipelines()->pipelinesApi()->getAll('deals');
if ($apiResponse instanceof Error) {
$this->log->error('[Hubspot] Failed to fetch opportunity pipelines', [
'reason' => $apiResponse->getMessage(),
]);
return [];
}
foreach ($apiResponse->getResults() as $pipeline) {
$pipelineStages = array_map(
static function (PipelineStage $stage) {
return [
'id' => $stage->getId(),
'label' => $stage->getLabel(),
];
},
$pipeline->getStages()
);
$stages = array_merge($stages, $pipelineStages);
}
return $stages;
}
public function fetchOpportunityPipelines(): array
{
$pipelines = [];
try {
$apiResponse = $this->makeRequest('/crm/v3/pipelines/deals');
} catch (\Exception $e) {
$this->log->info('[Hubspot] Failed to fetch opportunity pipelines', [
'reason' => $e->getMessage(),
]);
return [];
}
$response = $apiResponse->toArray();
foreach ($response['results'] as $pipeline) {
$pipelines[] = [
'id' => $pipeline['id'],
'label' => $pipeline['label'],
];
}
return $pipelines;
}
/**
* @return array<CrmFieldOption>
*/
public function fetchMeetingOutcomeFieldOptions(Field $field): array
{
return $field->getCrmProviderId() === 'meetingOutcome'
? $this->fetchMeetingOutcomeTypes()
: $this->fetchCallActivityTypes();
}
public function fetchMeetingOutcomeTypes(): array
{
return $this->extractMeetingTypeOptions(
'[URL_WITH_CREDENTIALS] Response $response */
$response = $this->getInstance()
->getClient()
->request('GET', $endpoint);
/**
* @var array<array{
* value: string,
* label: string,
* displayOrder: int
* }> $optionData
*/
$optionData = $response->toArray()['options'] ?? [];
$options = [];
foreach ($optionData as $item) {
$options[] = [
'id' => $item['value'],
'value' => $item['value'],
'label' => $item['label'],
'display_order' => $item['displayOrder'],
];
}
return $options;
}
/**
* @return array<CrmFieldOption>
*/
public function fetchDispositionFieldOptions(): array
{
$options = [];
$dispositions = $this->fetchCallDispositions();
foreach ($dispositions as $disposition) {
if ($disposition['deleted'] !== false) {
continue;
}
$option['value'] = $disposition['id'];
$option['id'] = $disposition['id'];
$option['label'] = $disposition['label'];
$options[] = $option;
}
return $options;
}
/**
* @return array<CrmFieldOption>
*/
public function fetchOpportunityFieldOptions(Field $field): array
{
if ($field->isStageField()) {
return $this->fetchOpportunityPipelineStages();
}
if ($field->isPipelineField()) {
return $this->fetchOpportunityPipelines();
}
return $this->fetchPropertyOptions('deals', $field->getCrmProviderId());
}
/**
* @throws BadRequest
* @throws HubspotException
*/
public function makeRequest(string $endpoint, $method = 'GET', $payload = [], ?string $queryString = null)
{
$endpoint = self::BASE_URL . $endpoint;
if ($method === 'GET') {
$response = $this->getInstance()->getClient()?->request(
method: $method,
endpoint: $endpoint,
query_string: $queryString
);
} else {
$response = $this->getInstance()->getClient()->request($method, $endpoint, [
'json' => ($payload),
]);
}
//
// $max = $response->getHeaderLine('X-HubSpot-RateLimit-Max'); // "110"
// $remaining = $response->getHeaderLine('X-HubSpot-RateLimit-Remaining'); // "109"
// $interval = $response->getHeaderLine('X-HubSpot-RateLimit-Interval-Milliseconds'); // "10000"
// $body = json_decode((string) $response->getBody(), true);
//
// \Illuminate\Support\Facades\Log::channel('custom_channel')->info('$max ' . PHP_EOL . print_r($max, true));
// \Illuminate\Support\Facades\Log::channel('custom_channel')->info('$remaining ' . PHP_EOL . print_r($remaining, true));
// \Illuminate\Support\Facades\Log::channel('custom_channel')->info('$interval ' . PHP_EOL . print_r($interval, true));
// \Illuminate\Support\Facades\Log::channel('custom_channel')->info('$body ' . PHP_EOL . print_r($body, true));
return $response;
}
/**
* @throws BadRequest
* @throws HubspotException
*/
public function createMeeting(array $payload): Response
{
$endpoint = '/crm/v3/objects/meetings';
return $this->makeRequest($endpoint, 'POST', $payload);
}
/**
* @throws BadRequest
* @throws HubspotException
*/
public function updateMeeting(string $meetingId, array $payload): Response
{
$endpoint = '/crm/v3/objects/meetings/' . $meetingId;
return $this->makeRequest($endpoint, 'PATCH', $payload);
}
/**
* @throws \Exception
*/
public function createNote(
string $body,
string $ownerId,
int $timestamp,
string $objectId,
NoteObject $noteObject
): ?string {
try {
$noteInput = new SimplePublicObjectInput([
'properties' => [
'hs_note_body' => $body,
'hubspot_owner_id' => $ownerId,
'hs_timestamp' => $timestamp,
],
]);
// Create note
$note = $this->getNewInstance()->crm()->objects()->basicApi()->create('note', $noteInput);
$this->getNewInstance()->crm()->objects()->associationsApi()->create(
'note',
$note->getId(),
$this->getNoteObject($noteObject),
$objectId,
$this->getNoteAssociationType($noteObject),
);
return $note->getId();
} catch (\Exception $e) {
$this->log->error('[Hubspot] Failed to create note', [
'objectId' => $objectId,
'noteObject' => $noteObject->getObjectType(),
'reason' => $e->getMessage(),
]);
\Sentry::captureException($e);
}
return null;
}
public function updateEngagement(string $objectId, array $engagement, array $metadata): void
{
$this->getInstance()->engagements()->update($objectId, $engagement, $metadata);
}
public function getEngagementData(string $engagementId): array
{
$engagement = $this->getInstance()->engagements()->get($engagementId);
return $engagement->toArray();
}
public function createEngagement(array $engagement, array $associations, array $metadata): Response
{
return $this->getInstance()
->engagements()
->create($engagement, $associations, $metadata);
}
public function isUnauthorizedException(\Exception $e): bool
{
// Check for specific HubSpot API exception types first
if ($e instanceof BadRequest) {
// BadRequest can contain 401 status codes
return $e->getCode() === 401;
}
// Check for HTTP client exceptions with status codes
if ($e instanceof \GuzzleHttp\Exception\RequestException && $e->hasResponse()) {
$response = $e->getResponse();
if ($response !== null) {
return $response->getStatusCode() === 401;
}
}
// Check for Guzzle HTTP exceptions
if ($e instanceof \GuzzleHttp\Exception\ClientException) {
return $e->getCode() === 401;
}
// Fallback to string matching as last resort, but be more specific
$message = strtolower($e->getMessage());
return str_contains($message, '401 unauthorized') ||
str_contains($message, 'http 401') ||
str_contains($message, 'status code 401') ||
(preg_match('/\b401\b/', $message) && str_contains($message, 'unauthorized'));
}
/**
* Validates and refreshes the access token if needed before API requests.
* This ensures long-running processes don't fail due to token expiration.
*
* @throws SocialAccountTokenInvalidException
*/
public function ensureValidToken(): void
{
if ($this->oauthAccount === null) {
return;
}
$newToken = $this->tokenManager->ensureValidToken($this->oauthAccount);
if ($newToken !== null) {
$this->accessToken = $newToken;
}
}
public function getConfig()
{
return $this->config;
}
// returns only active (archived=false)
public function getOwners(): array
{
return $this->getNewInstance()->crm()->owners()->getAll();
}
/**
* @param bool $archived
*
* @return array<Owner>|[]
*/
public function getOwnersArchived(bool $archived = true): array
{
$endpoint = '/crm/v3/owners';
$queryParams = [
'archived' => $archived ? 'true' : 'false',
];
$queryString = http_build_query($queryParams);
$owners = [];
try {
$response = $this->makeRequest(endpoint: $endpoint, queryString: $queryString);
$responseData = $response?->toArray();
foreach ($responseData['results'] as $result) {
try {
$owners[] = Owner::create($result);
} catch (Throwable $e) {
$this->log->error('[HubSpot] Failed to process owner data', [
'result' => $result,
'error' => $e->getMessage(),
]);
continue;
}
}
} catch (Throwable $e) {
$this->log->error('HubSpot] Failed to fetch owners', [
'archived' => $archived,
'error' => $e->getMessage(),
]);
return [];
}
return $owners;
}
public function getMeeting(string $engagementId): ObjectWithAssociations
{
return $this->getNewInstance()->crm()->objects()->basicApi()
->getById('meeting', $engagementId, null, 'contact,company,deal');
}
public function deleteEngagement(string $engagementId): void
{
$this->getInstance()->engagements()->delete((int) $engagementId);
}
public function getAssociationsData(array $ids, string $fromObject, string $toObject): array
{
$associationData = [];
$idChunks = array_chunk($ids, self::ASSOCIATIONS_BATCH_SIZE_LIMIT);
foreach ($idChunks as $idChunk) {
try {
$batchInput = new \HubSpot\Client\Crm\Associations\Model\BatchInputPublicObjectId();
$batchInput->setInputs(array_map(function ($id) {
$publicObjectId = new \HubSpot\Client\Crm\Associations\Model\PublicObjectId();
$publicObjectId->setId($id);
return $publicObjectId;
}, $idChunk));
$associatedObjectsData = $this
->getNewInstance()
->crm()
->associations()
->batchApi()
->read($fromObject, $toObject, $batchInput);
if ($associatedObjectsData instanceof \HubSpot\Client\Crm\Associations\Model\BatchResponsePublicAssociationMulti) {
foreach ($associatedObjectsData->getResults() as $association) {
$from = $association->getFrom()->getId();
$toAssociations = $association->getTo();
if (! empty($toAssociations)) {
$associationData[$from] = array_map(function ($item) {
return $item->getId();
}, $toAssociations);
}
}
}
// } catch (RateLimitException $e) {
// throw $e;
} catch (\Exception $e) {
$this->log->error('[Hubspot] Failed to fetch associations', [
'from_object' => $fromObject,
'to_object' => $toObject,
'reason' => $e->getMessage(),
]);
}
}
return $associationData;
}
/**
* @throws \Exception
*/
private function getNoteAssociationType(NoteObject $noteObject): string
{
return match($noteObject) {
NoteObject::Opportunity => 'note_to_deal',
NoteObject::Lead, NoteObject::Contact => 'note_to_contact', // or 'note_to_lead' if your portal supports it
NoteObject::Account => 'note_to_company',
NoteObject::Call, NoteObject::Event => throw new \Exception('Not supported'),
};
}
/**
* @throws \Exception
*/
private function getNoteObject(NoteObject $noteObject): string
{
return match($noteObject) {
NoteObject::Opportunity => 'deal',
NoteObject::Lead, NoteObject::Contact => 'contact',
NoteObject::Account => 'company',
NoteObject::Call, NoteObject::Event => throw new \Exception('Not supported'),
};
}
public function addAssociations(string $objectType, string $associationType, array $payload): Response
{
$endpoint = "/crm/v4/associations/$objectType/$associationType/batch/create";
return $this->makeRequest($endpoint, 'POST', $payload);
}
public function removeAssociations(string $objectType, string $associationType, array $payload): Response
{
$endpoint = "/crm/v4/associations/$objectType/$associationType/batch/archive";
return $this->makeRequest($endpoint, 'POST', $payload);
}
}
Sync Changes
Hide This Notification
Code changed:
Hide
19
Previous Highlighted Error
Next Highlighted Error
[2026-05-07 14:21:15] local.INFO: [Hubspot] DEBUG Getting headers {
"headers":{
"Date":["Thu,07 May 2026 14:21:15 GMT"],
"Content-Type":["application/json;charset=utf-8"],
"Transfer-Encoding":["chunked"],
"Connection":["keep-alive"],
"CF-Ray":["9f80deb8db60dc3a-SOF"],
"CF-Cache-Status":["DYNAMIC"],
"Strict-Transport-Security":["max-age=31536000; includeSubDomains; preload"],
"Vary":["origin,
accept-encoding"],
"access-control-allow-credentials":["false"],
"server-timing":["hcid;desc=\"019e02d0-6fd8-7812-bdba-885b7ccb3ee3\",
cfr;desc=\"9f80deb8e7c6dc3a-IAD\""],
"x-content-type-options":["nosniff"],
"x-hubspot-correlation-id":["019e02d0-6fd8-7812-bdba-885b7ccb3ee3"],
"Set-Cookie":["__cf_bm=SIUrtdQgXVrik50pdqF6hZVYKhzTnQBidvMabeCtm0Y-1778163675-[IP_ADDRESS]-rI.ZggtDKxTge5zr8_2gbBfWMQQ.ufZEXDZyHz2mBUFdzdo2gTHEsOkXMSEShjK0hGYxNhUGM1ZoBpX7BcFZcHEjA7Cs_.SMUhUnd2nYjko; path=/; expires=Thu,
07-May-26 14:51:15 GMT; domain=.hubapi.com; HttpOnly; Secure; SameSite=None"],
"Report-To":["{
\"endpoints\":[{
\"url\":\"https:\\/\\/a.nel.cloudflare.com\\/report\\/v4?s=NYAlsVTP0fYm32qrSDjxYE4sd2RWRqiSp3wHsmdEgZlzoYdxI%2BIxVpHmsKn3O%2BKVA3mFIJ2m7YRECDGSM%2BW2IYTzo6FM4%2BdUIjURO8srzKSvJgZ%2BQ6R79arKQw3uHLlX\"}],
\"group\":\"cf-nel\",
\"max_age\":604800}"],
"NEL":["{
\"success_fraction\":0.01,
\"report_to\":\"cf-nel\",
\"max_age\":604800}"],
"Server":["cloudflare"]}} {
"correlation_id":"95236535-ec98-4541-b92a-adfa73b69eab",
"trace_id":"c7ab8365-903f-46d4-9403-0e5b551e3545"}
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
PhpStorm
|
faVsco.js – Client.php
|
NULL
|
15435
|
|
15434
|
Project: faVsco.js, menu
JY-20725-handle-HS-search Project: faVsco.js, menu
JY-20725-handle-HS-search-rate-limit, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
2
65
1
1
Previous Highlighted Error
FirefoxFileEditViewHistoryBookmarksProfilesToolsWindowHelplah|Daily - Platform - now100% LMon 11 May 9:50:03meet.google.com/mie-gawc-dsi?authuser=[EMAIL] Yankov (Presenting)9+Platform Team %Q Search boardA.J Panorama for CallScoring nn 0u(AUTOMATED AT SGORINGKedoyorDVA Jy-20301Setup test coverage forPropnorisonerMAINTENANCEBacklogE 3-109511****=C Jy 20451 Servic83 Jmier8 Promohttps://fiminny.atlassian.net/jira/software/c/projects/JY/boards/37?selectedissue=JY-18091E SSHP JY-105221 2J7-1801Linked work itemsAOd liKcO WORK lenn~ ActivityWork logeehcommeSuggest a replyStatus update…Thanks…Pro tip: press (M to colNkolay IvanoyPotential Breaking Changes Summary@ CRITICAL - Requires Testing1. kalnoy/nestedset (v6 → v7)Used in: Playlist, Activity, User modeis• Major version jump - likely has breaking changes• Check nested set operations, especially in Playlist management |• Test folder/hierarchy operations2. google/protobuf (v4 → v5)• Major version bump|• Uscd dy Good e Aras (ea enoar, weex)• Test Google Calendar/Meet integrations*0.O: Attent0 Cals -AtsentiCa TranspJmineX MCPE Datadog* Claude3 CircleCi|Sentry*xIL LasкInsights & Coachin…0 Der@4|~ DetailsStory PointsNonePriorityNoneSprintDaysNeed QAYesParonJY-16322 PHP 8.5 UpgradeCanny LinksMon 11 May 9:50• эррібкL Al BockmarxsNikolay IvanovNikolay YankovAI Reports > Empty pagedesign and promotonAJREPORTSDeployed8 20372 10 ae00=JrOK VS ALUICWeusuД-20726 1 0 •***=Allow users to delete SSand Panorama promptswhen those are used in a...AКrОкIaDeployedRelease AJ PanoramaAJREPORTSDeployedR-20740 05 1) ..00=summary in the CRM4 othersAneliya Angelova9:50 AM | Daily - PlatformLukas Kovalik1:36...
|
PhpStorm
|
faVsco.js – Client.php
|
NULL
|
15434
|
|
15433
|
Project: faVsco.js, menu
JY-20725-handle-HS-search Project: faVsco.js, menu
JY-20725-handle-HS-search-rate-limit, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
PhostormVIewINavicareCodeFV faVsco.js°9 JY-20725-handle-HS-search-rate-limroledey© BatchSyncCollectolyhuospotsyncstrategybase.ongCachedcrmservicebecorator.onp© ProspectCache.phpe balchsynckealsseС Cпескапокetrукemotematch.ongccloseaDealstagess @ MatchacuivitycrmData.ong© ermactivilyservice.phgDealrielasservice.gc)Decorateacuivilv.or© FieldDefinitions.phrclass Cllent extends Baseclient 1mpLements Hubspotcllentintertace- A2 A65 X1X1 ~C) FieldT vpeconvertee Hubspotclientinterc) Hubspotlokenman© PayloadBuilder.phpC) RemotecrmobiectP ResponseNormalizec) Service.onoC)SvncFieldAction.onC) SvncRelatedActivitC) WebhookSvncBatclv MintearationAorM Acceccors• D ConfigD DTO• M SiltersJobs• M ProcnectSoarchStr.W service lralts© DataClient.php© DecorateActivity.phcLocalsearch.oneu LocalSearchintertac© RemoteSearch.phpc) Service.phpv W Listeners© ConvertLeadActivitc) PurceLookuocache> M Metadata> Miarationa Pioedrivev Salesforce• D Fields• M OnnortunitvMatcheMOnnortunitvSvneSt897 (M ProsneetSearchStr.M ServiceTraitcC) Client nhr© DecorateActivity.ph. Delete@biectsTrait© FieldDefinitions.php© PayloadBuilder.php© Profile.php© QueryBuilder.phpououc tunction 1sunauthorizedzxcentionExcentionse: 000ureturn str contains(Smessage. "401 unauthorized')Istr contains(Smessage..'http 401') |1str_contains(Smessage, 'status code 401') |(orea match( pattern: • /\b401\b/' Smessage) &s str contains(Smessage, 'unauthorized')):* Validates and refreshes the access token if needed before API requests.* This ensures long-running processes don't fail due to token expiration.* @throws SocialAccountTokenInvalidExceptiony usagespublic function ensureValidToken: voidif (Sthis->oauthAccount === null) {Snewloken = sthis->tokenmanaqer->ensureval1dloken(sth1s->oauthaccountrif (SnewToken !== null) {sthis-›accessloken = snewloken:public function getConfigoreturn Sthis->confia:returns onlv active (archived=false)9 usadespublic function get0wners: arrayreturn $this->getNewInstance()->crm()->owners()->getALL();* apanam bool Sarchived* dretum arrau<ownens/r71s usages40 hlDally - Platrorm • now100% 4 • Mon 11 May 9:50:01U AskJiminnyReportActivityServiceTest v+0 ..11 1l1III=custom.log ^=laravel.logA SF (jiminny@localhost]4 HS_local [jiminny@localhost]# console [PKob.# console [euJ# console [slAGiNG)[2026-05-07 14:21:15] local.INF0: [Hubspot] DEBUG Getting headers {w19 .V"neaders".?"Uace":L"Inu,or May 2020 14.21.15 6Ml"Jn"Transter-Encod1nq":"chunked")."Connection":"keep-alive""CF-Ray" : ["9f80deb8db60dc3a-SOF"],"Strict-Transport-Secur1ty":"max-aqe=31536008* 1ncludeSubDomains: preload")naccent-encodino""access-control-allow-credentials": ["false"]."server-timing": ["hcid;desc=\"019e02d0-6fd8-7812-bdba-885b7ccb3ee3\","x-hubspot-correlation-id":["019e02d0-6fd8-7812-bdba-885b7ccb3ee3"],"So+-Cookie"." c+hm-Stlirtd0aXVr.kSandas6hzVVKhzTn0BidvMaheCtm0V-1778163675-1.0.107-May-26 14:51:15 GMT; domain=.hubapi.com; Http0nly; Secure; SameSite=None"],"Renont-To"."","endpoints\":[{"unl".httns:a.nel.cloudflane.com./nenon+|W/v42c=NVA1cVTPQfVm32anS0ixVF/sd2RI\"group)":\"cf-nel\","max_age\":604800}"],"NEL":["{\"success_fraction\":0.01,reportto. "cr-nel,"max age":604800}"]"Server": ["cloudflare"]}} {"correlation_1d":"95256555-ec98-4541-b9za-adta/Sb6Yeab","trace_10":"C/AD8565-905t-4604-9405-0e50551e5545I IIllC;CascadeHubspot Rate Limit Reif (Sretry) {sleenab:return $this->searchCallsForPeriodByPage($from, $to, $page, false);return null;Why this is now broken/suboptimal with the new client1. Covehes Encef lint Couk Be 1,0, o.) l tecuro d: we aiays sCcep ion that The now clioni carefly consirveted win rety after fiom headers in2. For tng te eage a mpy. The mont cen meon tweslor notsea th lil oer eit o - en oat , t aoi, od in trniscont aloe atry andtee siently3. The Sretry = false recursive flaa is fragile. Once we pass retrvefalse. on the second 429 we just return null without distinguishing rate limit from reaSuggestionCatch Ratel imitFycention cnecificallv and uco detRetrvifterd.D phppublic function searchCallsForPeriodByPage(Carbon strom, Carbon sto, int Spage, int sretries = 2)trydSpay Load = Sthis->payLoadbu1lder->generatesearchcaulsByPer1odPayLoad(Strom, Sto, Spage);return sthis->client->search'cals". Soavload):} catch (RateLimitException $e) {throw se: // hubble un: caller decidec whether to fail the imnort or releace the iohlsleen min Se->aetRetrvAftero, 30)):return $this->searchCallsForPeriodByPage($from, $to, $page, $retries - 1);} catch (Exception Sexception) {$this->logger->info('(HubSpot) Search calls for period failed', (...]);recurh nuet;only swallow non-rate-limit Tallures as beroreEven better — if searchCallsForPeriod is called from a queued job (which it typically is for backfills), don't swallow at all. Let RateLimitException bubble to thejob middleware (HandleHubspotRateLimit), which already handles release-with-delay properly. The in-process sleep() wastes a worker for up to 30s and ties upHorizon throughput.Let me check if it's job-driven:Coorchod caorsbColleGorDorindlrdingURLToken in app (.php) (5)Both callers are backaround workflows (a Console command and an internal service). So letting RateLimitException bubble to the iob middleware is the cleanestanswer - drop the sleep(1) retry path entirely and rely on HandleHubspotRateLimit:: release(Sdelay)TL:DR for #2: the sleep(1) predates the new structured exception. Either:• Catch RateLimitException and use getRetryAfter() (replace blind sleep(1) ), orLet it bubble to the job middleware and delete the in-process retry - preferred3. Whv matchExactlvBvEmail() Has No Rate Limit HandlinaCalle(erch d lstorPero itnypase/secrchdll forpernod /searchCalt9 eo adinguiLToten) t:.on eryvice. phprt-162-198 wil remove it from find and otherWN Windsurf Teams802•6UTF.8Po 4 spaces...
|
PhpStorm
|
faVsco.js – Client.php
|
NULL
|
15433
|
|
15432
|
Project: faVsco.js, menu
JY-20725-handle-HS-search Project: faVsco.js, menu
JY-20725-handle-HS-search-rate-limit, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
FirefoxFileEditViewHistoryBookmarksProfilesTools|WindowHelpDaily - Platform • now100% 12Mon 11 May 9:50:00meet.google.com/mie-gawc-dsi?authuser=[EMAIL] Yankov (Presenting)9+$Platform Team %Q Search boardA.J Panorama for CallScoring nn 0u(AUTOMATED AT SGORINGKedoy orDVA Jy-20301Setup test coverage forProonoricherMAINTENANCEBacklogE 3-10951C Jy 20451 Servic© Planhs83 Jmier83 P[URL_WITH_CREDENTIALS] DetailsStory PointsNonePriorityNoneSprintDaysNeed QA 3YesParonJY-16322 PHP 8.5 UpgradeCanny LinksOpen Canny LinksMon 11 May 9:40appiaL Al BockmarxsNikolay IvanovNikolay Yankov9:49 AM | Daily - PlatformAI Reports > Empty pagedesign and promotonAJREPORTSDeployed8 20372 10 ae00=JrOK VS ALUICД-20726 1 0 •**0=Allow users to delete SSand Panorama promptswhen those are used in a...AmrokisDeployedRelease AJ PanoramaAJREPORTSDeployedR-20740 05 1) ..00=summary in the CRM...4 othersAneliya AngelovaLộ3Lukas Kovalik1:33...
|
PhpStorm
|
faVsco.js – Client.php
|
NULL
|
15432
|
|
15431
|
Project: faVsco.js, menu
JY-20725-handle-HS-search Project: faVsco.js, menu
JY-20725-handle-HS-search-rate-limit, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
2
65
1
1
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Services\Crm\Hubspot;
use HubSpot\Client\Crm\Deals\ApiException as DealApiException;
use HubSpot\Client\Crm\Contacts\ApiException as ContactApiException;
use HubSpot\Client\Crm\Companies\ApiException as CompanyApiException;
use HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectWithAssociations as ContactsWithAssociations;
use HubSpot\Client\Crm\Companies\Model\SimplePublicObjectWithAssociations as CompaniesWithAssociations;
use HubSpot\Client\Crm\Deals\Model\SimplePublicObjectWithAssociations as DealWithAssociations;
use HubSpot\Client\Crm\Objects\Model\SimplePublicObjectInput;
use HubSpot\Client\Crm\Objects\Model\SimplePublicObjectWithAssociations as ObjectWithAssociations;
use HubSpot\Client\Crm\Pipelines\Model\Error;
use HubSpot\Client\Crm\Pipelines\Model\PipelineStage;
use HubSpot\Client\Crm\Properties\Model\Property;
use HubSpot\Discovery\Discovery;
use Jiminny\Exceptions\CrmException;
use Jiminny\Exceptions\RateLimitException;
use Jiminny\Exceptions\SocialAccountTokenInvalidException;
use Jiminny\Jobs\Crm\NoteObject;
use Jiminny\Models\Crm\Field;
use Jiminny\Services\Crm\BaseClient;
use Jiminny\Services\Crm\Hubspot\DTO\Response\Owner;
use Jiminny\Services\SocialAccountService;
use SevenShores\Hubspot\Exceptions\BadRequest;
use SevenShores\Hubspot\Exceptions\HubspotException;
use SevenShores\Hubspot\Factory;
use SevenShores\Hubspot\Http\Response;
use Jiminny\Services\Crm\Hubspot\Pagination\HubspotPaginationService;
use Throwable;
/**
* @phpstan-type CrmFieldOption array{id:string, label:string, value?:string}
*/
class Client extends BaseClient implements HubspotClientInterface
{
public const string MIN_API_VERSION = '2';
public const string BASE_URL = '[URL_WITH_CREDENTIALS] T
* @param callable(): T $apiCall
* @return T
*
* @throws RateLimitException
*/
private function executeRequest(callable $apiCall)
{
try {
return $apiCall();
} catch (Throwable $e) {
if ($this->isHubspotRateLimit($e)) {
$retryAfter = $this->parseRetryAfter($e);
$this->log->warning('[Hubspot] Received 429 from API', [
'team_id' => $this->config->team_id,
'config_id' => $this->config->getId(),
'retry_after' => $retryAfter,
'reason' => $e->getMessage(),
]);
throw new RateLimitException('Hubspot returned 429', $retryAfter, $e);
}
throw $e;
}
}
public function isHubspotRateLimit(Throwable $e): bool
{
if ($e instanceof BadRequest
|| $e instanceof DealApiException
|| $e instanceof ContactApiException
|| $e instanceof CompanyApiException
|| $e instanceof \GuzzleHttp\Exception\RequestException
) {
return (int) $e->getCode() === 429;
}
return false;
}
public function parseRetryAfter(Throwable $e): int
{
// First try to get Retry-After from response headers
if (method_exists($e, 'getResponseHeaders')) {
$headers = $e->getResponseHeaders() ?: [];
$value = $headers['Retry-After'] ?? $headers['retry-after'] ?? null;
if (is_array($value)) {
$value = $value[0] ?? null;
}
if (is_numeric($value)) {
return (int) $value;
}
}
if (method_exists($e, 'getResponseBody')) {
$body = $e->getResponseBody();
if (is_string($body)) {
$body = json_decode($body, true) ?? [];
}
$policyName = $body['policyName'] ?? $body['policy'] ?? $body['context']['policyName'] ?? null;
if ($policyName === 'TEN_SECONDLY_ROLLING' || $policyName === 'ten_secondly_rolling') {
return 10;
}
if ($policyName === 'SECONDLY' || $policyName === 'secondly') {
return 1;
}
}
$this->log->warning('[Hubspot] No retry-after header or policy name found, using default', [
'exception_class' => get_class($e),
]);
return 10;
}
public function getMinimumApiVersion(): string
{
return self::MIN_API_VERSION;
}
public function getInstance(): Factory
{
return new Factory([
'key' => $this->accessToken,
'oauth2' => true,
'base_url' => $this->baseUrl,
]);
}
public function getNewInstance(): Discovery
{
return \HubSpot\Factory::createWithAccessToken($this->accessToken);
}
/**
* Secondly and daily limits for Hubspot API
*
* Product Tier: Free & Starter | Professional & Enterprise | API add-on (any tier)
* Burst: 100/10 seconds | 150/10 seconds | 200/10 seconds
* Daily: 250,000 | 500,000 | 1,000,000
*
* Official documentation states: The search endpoints are rate limited to five requests per second.
* Since with 5 RPS were still hitting secondly rate limits we lowered it to 4
*/
public function getPaginatedData(array $payload, string $type, int $offset = 0): array
{
$total = 0;
$lastId = null;
$rows = [];
foreach ($this->getPaginatedDataGenerator($payload, $type, $offset, $total, $lastId) as $row) {
$rows[] = $row;
}
return ['results' => $rows, 'total' => $total, 'last_record' => $lastId];
}
/**
* @throws HubspotException
* @throws SocialAccountTokenInvalidException
* @throws BadRequest
*/
public function getPaginatedDataGenerator(
array $payload,
string $type,
int $offset = 0,
int &$total = 0,
?string &$lastRecordId = null
): \Generator {
return $this->paginationService->getPaginatedDataGenerator(
$this,
$payload,
$type,
$offset,
$total,
$lastRecordId
);
}
/**
* Execute a search request against HubSpot CRM objects with rate limiting.
*
* @param string $objectType The object type ('deals', 'companies', 'contacts', 'calls')
* @param array<string, mixed> $payload The search payload with filters, sorts, properties, etc.
* @return array The search response with 'results', 'total', 'paging' keys
* @throws RateLimitException When rate limit is hit
* @throws HubspotException On API errors
*/
public function search(string $objectType, array $payload): array
{
$endpoint = self::BASE_URL . "/crm/v3/objects/{$objectType}/search";
return $this->executeRequest(function () use ($endpoint, $payload) {
$response = $this->getInstance()->getClient()->request('POST', $endpoint, ['json' => $payload]);
return $response->toArray();
});
}
/**
* @throws DealApiException
* @throws CrmException
*/
public function getOpportunityById(string $crmId, array $fields): array
{
try {
// $deal = $this->executeRequest(fn () => $this->getNewInstance()->crm()->deals()->basicApi()->getById(
$deal = $this->getNewInstance()->crm()->deals()->basicApi()->getById(
$crmId,
implode(',', $fields),
'companies,contacts'
);
} catch (DealApiException $e) {
$this->log->info('[Hubspot] Failed to fetch opportunity', [
'crm_id' => $crmId,
'reason' => $e->getMessage(),
]);
throw $e;
}
if (! $deal instanceof DealWithAssociations) {
throw new CrmException('Deal not found');
}
return [
'id' => $deal->getId(),
'properties' => $deal->getProperties(),
'associations' => $deal->getAssociations(),
];
}
/**
* Generic batch read method for HubSpot objects
*
* @param string $objectType The object type ('deals', 'companies', 'contacts')
* @param array<string> $crmIds Array of HubSpot object IDs (max 100)
* @param array<string> $fields Array of property names to fetch
*
* @return array<string, array> Array keyed by CRM ID with object data
*/
private function batchReadObjects(string $objectType, array $crmIds, array $fields): array
{
if (empty($crmIds)) {
return [];
}
$this->validateBatchSize($objectType, $crmIds);
$this->ensureValidToken();
try {
$batchConfig = $this->createBatchConfiguration($objectType);
$batchReadRequest = $this->prepareBatchRequest($batchConfig, $crmIds, $fields);
$response = $batchConfig['api']->read($batchReadRequest);
$this->validateApiResponse($response, $objectType);
$results = $this->processApiResults($response);
$this->logBatchResults($objectType, $crmIds, $results);
return $results;
} catch (\Throwable $e) {
$this->handleBatchError($e, $objectType, $crmIds);
}
}
private function validateBatchSize(string $objectType, array $crmIds): void
{
if (count($crmIds) > 100) {
throw new \InvalidArgumentException("Batch size cannot exceed 100 {$objectType}");
}
}
private function createBatchConfiguration(string $objectType): array
{
$configurations = [
'deals' => [
'batchReadRequest' => new \HubSpot\Client\Crm\Deals\Model\BatchReadInputSimplePublicObjectId(),
'inputClass' => \HubSpot\Client\Crm\Deals\Model\SimplePublicObjectId::class,
'api' => $this->getNewInstance()->crm()->deals()->batchApi(),
],
'companies' => [
'batchReadRequest' => new \HubSpot\Client\Crm\Companies\Model\BatchReadInputSimplePublicObjectId(),
'inputClass' => \HubSpot\Client\Crm\Companies\Model\SimplePublicObjectId::class,
'api' => $this->getNewInstance()->crm()->companies()->batchApi(),
],
'contacts' => [
'batchReadRequest' => new \HubSpot\Client\Crm\Contacts\Model\BatchReadInputSimplePublicObjectId(),
'inputClass' => \HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectId::class,
'api' => $this->getNewInstance()->crm()->contacts()->batchApi(),
],
];
if (! isset($configurations[$objectType])) {
throw new \InvalidArgumentException("Unsupported object type: {$objectType}");
}
return $configurations[$objectType];
}
private function prepareBatchRequest(array $batchConfig, array $crmIds, array $fields): object
{
$batchReadRequest = $batchConfig['batchReadRequest'];
$inputClass = $batchConfig['inputClass'];
$inputs = array_map(function ($crmId) use ($inputClass) {
$input = new $inputClass();
$input->setId($crmId);
return $input;
}, $crmIds);
$batchReadRequest->setInputs($inputs);
$batchReadRequest->setProperties($fields);
return $batchReadRequest;
}
private function validateApiResponse($response, string $objectType): void
{
if (! $response) {
throw new CrmException("HubSpot API returned null response for {$objectType} batch read");
}
}
private function processApiResults($response): array
{
$results = [];
$responseResults = $response->getResults();
if ($responseResults) {
foreach ($responseResults as $object) {
if ($object && $object->getId()) {
$results[$object->getId()] = [
'id' => $object->getId(),
'properties' => $object->getProperties() ?: [],
];
}
}
}
return $results;
}
private function logBatchResults(string $objectType, array $crmIds, array $results): void
{
$this->log->info("[HubSpot] Batch fetched {$objectType}", [
'requested_count' => count($crmIds),
'returned_count' => count($results),
'crm_ids' => $crmIds,
]);
}
private function handleBatchError(\Throwable $e, string $objectType, array $crmIds): void
{
$errorMessage = $e->getMessage() ?: 'Unknown error';
$errorTrace = $e->getTraceAsString() ?: 'No trace available';
$this->log->error("[HubSpot] Failed to batch fetch {$objectType}", [
'crm_ids' => $crmIds,
'error' => $errorMessage,
'trace' => $errorTrace,
]);
throw new CrmException("Failed to batch fetch {$objectType}: " . $errorMessage);
}
/**
* Batch read multiple opportunities by their CRM IDs
*
* @param array<string> $crmIds Array of HubSpot deal IDs (max 100)
* @param array<string> $fields Array of property names to fetch
*
* @return array<string, array> Array keyed by CRM ID with opportunity data
*/
public function getOpportunitiesByIds(array $crmIds, array $fields): array
{
return $this->batchReadObjects('deals', $crmIds, $fields);
}
/**
* Batch read multiple companies by their CRM IDs
*
* @param array<string> $crmIds Array of HubSpot company IDs (max 100)
* @param array<string> $fields Array of property names to fetch
*
* @return array<string, array> Array keyed by CRM ID with company data
*/
public function getCompaniesByIds(array $crmIds, array $fields): array
{
return $this->batchReadObjects('companies', $crmIds, $fields);
}
/**
* Batch read multiple contacts by their CRM IDs
*
* @param array<string> $crmIds Array of HubSpot contact IDs (max 100)
* @param array<string> $fields Array of property names to fetch
*
* @return array<string, array> Array keyed by CRM ID with contact data
*/
public function getContactsByIds(array $crmIds, array $fields): array
{
return $this->batchReadObjects('contacts', $crmIds, $fields);
}
/**
* @throws CompanyApiException
* @throws CrmException
*/
public function getAccountById(string $crmId, array $fields): array
{
try {
$company = $this->getNewInstance()->crm()->companies()->basicApi()->getById(
$crmId,
implode(',', $fields),
);
} catch (CompanyApiException $e) {
$this->log->info('[Hubspot] Failed to fetch account', [
'crm_id' => $crmId,
'reason' => $e->getMessage(),
]);
throw $e;
}
if (! $company instanceof CompaniesWithAssociations) {
throw new CrmException('Account not found');
}
return [
'id' => $company->getId(),
'properties' => $company->getProperties(),
];
}
/**
* @throws ContactApiException
* @throws CrmException
*/
public function getContactById(string $crmId, array $fields): array
{
try {
$contact = $this->getNewInstance()->crm()->contacts()->basicApi()->getById(
$crmId,
implode(',', $fields)
);
} catch (ContactApiException $e) {
$this->log->info('[Hubspot] Failed to fetch contact', [
'crm_id' => $crmId,
'reason' => $e->getMessage(),
]);
throw $e;
}
if (! $contact instanceof ContactsWithAssociations) {
throw new CrmException('Contact not found');
}
return [
'id' => $contact->getId(),
'properties' => $contact->getProperties(),
];
}
/**
* This is email search request that Hubspot offers as GET (more generous quota)
*/
public function getContactByEmail(string $email, array $fields = []): array
{
try {
$contact = $this->getNewInstance()->crm()->contacts()->basicApi()->getById(
$email,
implode(',', $fields),
null,
false,
'email'
);
return [
'id' => $contact->getId(),
'properties' => $contact->getProperties(),
];
} catch (ContactApiException $e) {
$this->log->info('[Hubspot] Failed to fetch contact', [
'email' => $email,
'reason' => $e->getMessage(),
]);
return [];
}
}
/**
* @throws CrmException
*/
public function fetchProperty(string $objectType, string $propertyId): Property
{
$result = $this->getNewInstance()->crm()->properties()->coreApi()->getByName($objectType, $propertyId);
if (! $result instanceof Property) {
$this->log->error('[Hubspot] Failed to fetch property', [
'object_type' => $objectType,
'property_id' => $propertyId,
'reason' => $result->getMessage(),
]);
throw new CrmException('Failed to fetch property');
}
return $result;
}
/**
* @return array<CrmFieldOption>
*/
public function fetchPropertyOptions(string $objectType, string $propertyId): array
{
/** @var array<CrmFieldOption> */
return $this->fetchProperty($objectType, $propertyId)->getOptions();
}
/**
* @return array<array{id:string, label:string, deleted:bool}>
*/
public function fetchCallDispositions(): array
{
/** @var Response $response */
$response = $this->getInstance()->engagements()->getCallDispositions();
/**
* @var array<array{
* id:string,
* label:string,
* deleted: bool
* }>
*/
return $response->toArray();
}
/**
* @return array<CrmFieldOption>
*/
public function fetchOpportunityPipelineStages(): array
{
$stages = [];
$apiResponse = $this->getNewInstance()->crm()->pipelines()->pipelinesApi()->getAll('deals');
if ($apiResponse instanceof Error) {
$this->log->error('[Hubspot] Failed to fetch opportunity pipelines', [
'reason' => $apiResponse->getMessage(),
]);
return [];
}
foreach ($apiResponse->getResults() as $pipeline) {
$pipelineStages = array_map(
static function (PipelineStage $stage) {
return [
'id' => $stage->getId(),
'label' => $stage->getLabel(),
];
},
$pipeline->getStages()
);
$stages = array_merge($stages, $pipelineStages);
}
return $stages;
}
public function fetchOpportunityPipelines(): array
{
$pipelines = [];
try {
$apiResponse = $this->makeRequest('/crm/v3/pipelines/deals');
} catch (\Exception $e) {
$this->log->info('[Hubspot] Failed to fetch opportunity pipelines', [
'reason' => $e->getMessage(),
]);
return [];
}
$response = $apiResponse->toArray();
foreach ($response['results'] as $pipeline) {
$pipelines[] = [
'id' => $pipeline['id'],
'label' => $pipeline['label'],
];
}
return $pipelines;
}
/**
* @return array<CrmFieldOption>
*/
public function fetchMeetingOutcomeFieldOptions(Field $field): array
{
return $field->getCrmProviderId() === 'meetingOutcome'
? $this->fetchMeetingOutcomeTypes()
: $this->fetchCallActivityTypes();
}
public function fetchMeetingOutcomeTypes(): array
{
return $this->extractMeetingTypeOptions(
'[URL_WITH_CREDENTIALS] Response $response */
$response = $this->getInstance()
->getClient()
->request('GET', $endpoint);
/**
* @var array<array{
* value: string,
* label: string,
* displayOrder: int
* }> $optionData
*/
$optionData = $response->toArray()['options'] ?? [];
$options = [];
foreach ($optionData as $item) {
$options[] = [
'id' => $item['value'],
'value' => $item['value'],
'label' => $item['label'],
'display_order' => $item['displayOrder'],
];
}
return $options;
}
/**
* @return array<CrmFieldOption>
*/
public function fetchDispositionFieldOptions(): array
{
$options = [];
$dispositions = $this->fetchCallDispositions();
foreach ($dispositions as $disposition) {
if ($disposition['deleted'] !== false) {
continue;
}
$option['value'] = $disposition['id'];
$option['id'] = $disposition['id'];
$option['label'] = $disposition['label'];
$options[] = $option;
}
return $options;
}
/**
* @return array<CrmFieldOption>
*/
public function fetchOpportunityFieldOptions(Field $field): array
{
if ($field->isStageField()) {
return $this->fetchOpportunityPipelineStages();
}
if ($field->isPipelineField()) {
return $this->fetchOpportunityPipelines();
}
return $this->fetchPropertyOptions('deals', $field->getCrmProviderId());
}
/**
* @throws BadRequest
* @throws HubspotException
*/
public function makeRequest(string $endpoint, $method = 'GET', $payload = [], ?string $queryString = null)
{
$endpoint = self::BASE_URL . $endpoint;
if ($method === 'GET') {
$response = $this->getInstance()->getClient()?->request(
method: $method,
endpoint: $endpoint,
query_string: $queryString
);
} else {
$response = $this->getInstance()->getClient()->request($method, $endpoint, [
'json' => ($payload),
]);
}
//
// $max = $response->getHeaderLine('X-HubSpot-RateLimit-Max'); // "110"
// $remaining = $response->getHeaderLine('X-HubSpot-RateLimit-Remaining'); // "109"
// $interval = $response->getHeaderLine('X-HubSpot-RateLimit-Interval-Milliseconds'); // "10000"
// $body = json_decode((string) $response->getBody(), true);
//
// \Illuminate\Support\Facades\Log::channel('custom_channel')->info('$max ' . PHP_EOL . print_r($max, true));
// \Illuminate\Support\Facades\Log::channel('custom_channel')->info('$remaining ' . PHP_EOL . print_r($remaining, true));
// \Illuminate\Support\Facades\Log::channel('custom_channel')->info('$interval ' . PHP_EOL . print_r($interval, true));
// \Illuminate\Support\Facades\Log::channel('custom_channel')->info('$body ' . PHP_EOL . print_r($body, true));
return $response;
}
/**
* @throws BadRequest
* @throws HubspotException
*/
public function createMeeting(array $payload): Response
{
$endpoint = '/crm/v3/objects/meetings';
return $this->makeRequest($endpoint, 'POST', $payload);
}
/**
* @throws BadRequest
* @throws HubspotException
*/
public function updateMeeting(string $meetingId, array $payload): Response
{
$endpoint = '/crm/v3/objects/meetings/' . $meetingId;
return $this->makeRequest($endpoint, 'PATCH', $payload);
}
/**
* @throws \Exception
*/
public function createNote(
string $body,
string $ownerId,
int $timestamp,
string $objectId,
NoteObject $noteObject
): ?string {
try {
$noteInput = new SimplePublicObjectInput([
'properties' => [
'hs_note_body' => $body,
'hubspot_owner_id' => $ownerId,
'hs_timestamp' => $timestamp,
],
]);
// Create note
$note = $this->getNewInstance()->crm()->objects()->basicApi()->create('note', $noteInput);
$this->getNewInstance()->crm()->objects()->associationsApi()->create(
'note',
$note->getId(),
$this->getNoteObject($noteObject),
$objectId,
$this->getNoteAssociationType($noteObject),
);
return $note->getId();
} catch (\Exception $e) {
$this->log->error('[Hubspot] Failed to create note', [
'objectId' => $objectId,
'noteObject' => $noteObject->getObjectType(),
'reason' => $e->getMessage(),
]);
\Sentry::captureException($e);
}
return null;
}
public function updateEngagement(string $objectId, array $engagement, array $metadata): void
{
$this->getInstance()->engagements()->update($objectId, $engagement, $metadata);
}
public function getEngagementData(string $engagementId): array
{
$engagement = $this->getInstance()->engagements()->get($engagementId);
return $engagement->toArray();
}
public function createEngagement(array $engagement, array $associations, array $metadata): Response
{
return $this->getInstance()
->engagements()
->create($engagement, $associations, $metadata);
}
public function isUnauthorizedException(\Exception $e): bool
{
// Check for specific HubSpot API exception types first
if ($e instanceof BadRequest) {
// BadRequest can contain 401 status codes
return $e->getCode() === 401;
}
// Check for HTTP client exceptions with status codes
if ($e instanceof \GuzzleHttp\Exception\RequestException && $e->hasResponse()) {
$response = $e->getResponse();
if ($response !== null) {
return $response->getStatusCode() === 401;
}
}
// Check for Guzzle HTTP exceptions
if ($e instanceof \GuzzleHttp\Exception\ClientException) {
return $e->getCode() === 401;
}
// Fallback to string matching as last resort, but be more specific
$message = strtolower($e->getMessage());
return str_contains($message, '401 unauthorized') ||
str_contains($message, 'http 401') ||
str_contains($message, 'status code 401') ||
(preg_match('/\b401\b/', $message) && str_contains($message, 'unauthorized'));
}
/**
* Validates and refreshes the access token if needed before API requests.
* This ensures long-running processes don't fail due to token expiration.
*
* @throws SocialAccountTokenInvalidException
*/
public function ensureValidToken(): void
{
if ($this->oauthAccount === null) {
return;
}
$newToken = $this->tokenManager->ensureValidToken($this->oauthAccount);
if ($newToken !== null) {
$this->accessToken = $newToken;
}
}
public function getConfig()
{
return $this->config;
}
// returns only active (archived=false)
public function getOwners(): array
{
return $this->getNewInstance()->crm()->owners()->getAll();
}
/**
* @param bool $archived
*
* @return array<Owner>|[]
*/
public function getOwnersArchived(bool $archived = true): array
{
$endpoint = '/crm/v3/owners';
$queryParams = [
'archived' => $archived ? 'true' : 'false',
];
$queryString = http_build_query($queryParams);
$owners = [];
try {
$response = $this->makeRequest(endpoint: $endpoint, queryString: $queryString);
$responseData = $response?->toArray();
foreach ($responseData['results'] as $result) {
try {
$owners[] = Owner::create($result);
} catch (Throwable $e) {
$this->log->error('[HubSpot] Failed to process owner data', [
'result' => $result,
'error' => $e->getMessage(),
]);
continue;
}
}
} catch (Throwable $e) {
$this->log->error('HubSpot] Failed to fetch owners', [
'archived' => $archived,
'error' => $e->getMessage(),
]);
return [];
}
return $owners;
}
public function getMeeting(string $engagementId): ObjectWithAssociations
{
return $this->getNewInstance()->crm()->objects()->basicApi()
->getById('meeting', $engagementId, null, 'contact,company,deal');
}
public function deleteEngagement(string $engagementId): void
{
$this->getInstance()->engagements()->delete((int) $engagementId);
}
public function getAssociationsData(array $ids, string $fromObject, string $toObject): array
{
$associationData = [];
$idChunks = array_chunk($ids, self::ASSOCIATIONS_BATCH_SIZE_LIMIT);
foreach ($idChunks as $idChunk) {
try {
$batchInput = new \HubSpot\Client\Crm\Associations\Model\BatchInputPublicObjectId();
$batchInput->setInputs(array_map(function ($id) {
$publicObjectId = new \HubSpot\Client\Crm\Associations\Model\PublicObjectId();
$publicObjectId->setId($id);
return $publicObjectId;
}, $idChunk));
$associatedObjectsData = $this
->getNewInstance()
->crm()
->associations()
->batchApi()
->read($fromObject, $toObject, $batchInput);
if ($associatedObjectsData instanceof \HubSpot\Client\Crm\Associations\Model\BatchResponsePublicAssociationMulti) {
foreach ($associatedObjectsData->getResults() as $association) {
$from = $association->getFrom()->getId();
$toAssociations = $association->getTo();
if (! empty($toAssociations)) {
$associationData[$from] = array_map(function ($item) {
return $item->getId();
}, $toAssociations);
}
}
}
// } catch (RateLimitException $e) {
// throw $e;
} catch (\Exception $e) {
$this->log->error('[Hubspot] Failed to fetch associations', [
'from_object' => $fromObject,
'to_object' => $toObject,
'reason' => $e->getMessage(),
]);
}
}
return $associationData;
}
/**
* @throws \Exception
*/
private function getNoteAssociationType(NoteObject $noteObject): string
{
return match($noteObject) {
NoteObject::Opportunity => 'note_to_deal',
NoteObject::Lead, NoteObject::Contact => 'note_to_contact', // or 'note_to_lead' if your portal supports it
NoteObject::Account => 'note_to_company',
NoteObject::Call, NoteObject::Event => throw new \Exception('Not supported'),
};
}
/**
* @throws \Exception
*/
private function getNoteObject(NoteObject $noteObject): string
{
return match($noteObject) {
NoteObject::Opportunity => 'deal',
NoteObject::Lead, NoteObject::Contact => 'contact',
NoteObject::Account => 'company',
NoteObject::Call, NoteObject::Event => throw new \Exception('Not supported'),
};
}
public function addAssociations(string $objectType, string $associationType, array $payload): Response
{
$endpoint = "/crm/v4/associations/$objectType/$associationType/batch/create";
return $this->makeRequest($endpoint, 'POST', $payload);
}
public function removeAssociations(string $objectType, string $associationType, array $payload): Response
{
$endpoint = "/crm/v4/associations/$objectType/$associationType/batch/archive";
return $this->makeRequest($endpoint, 'POST', $payload);
}
}
Sync Changes
Hide This Notification
Code changed:
Hide
19
Previous Highlighted Error
Next Highlighted Error
[2026-05-07 14:21:15] local.INFO: [Hubspot] DEBUG Getting headers {
"headers":{
"Date":["Thu,07 May 2026 14:21:15 GMT"],
"Content-Type":["application/json;charset=utf-8"],
"Transfer-Encoding":["chunked"],
"Connection":["keep-alive"],
"CF-Ray":["9f80deb8db60dc3a-SOF"],
"CF-Cache-Status":["DYNAMIC"],
"Strict-Transport-Security":["max-age=31536000; includeSubDomains; preload"],
"Vary":["origin,
accept-encoding"],
"access-control-allow-credentials":["false"],
"server-timing":["hcid;desc=\"019e02d0-6fd8-7812-bdba-885b7ccb3ee3\",
cfr;desc=\"9f80deb8e7c6dc3a-IAD\""],
"x-content-type-options":["nosniff"],
"x-hubspot-correlation-id":["019e02d0-6fd8-7812-bdba-885b7ccb3ee3"],
"Set-Cookie":["__cf_bm=SIUrtdQgXVrik50pdqF6hZVYKhzTnQBidvMabeCtm0Y-1778163675-[IP_ADDRESS]-rI.ZggtDKxTge5zr8_2gbBfWMQQ.ufZEXDZyHz2mBUFdzdo2gTHEsOkXMSEShjK0hGYxNhUGM1ZoBpX7BcFZcHEjA7Cs_.SMUhUnd2nYjko; path=/; expires=Thu,
07-May-26 14:51:15 GMT; domain=.hubapi.com; HttpOnly; Secure; SameSite=None"],
"Report-To":["{
\"endpoints\":[{
\"url\":\"https:\\/\\/a.nel.cloudflare.com\\/report\\/v4?s=NYAlsVTP0fYm32qrSDjxYE4sd2RWRqiSp3wHsmdEgZlzoYdxI%2BIxVpHmsKn3O%2BKVA3mFIJ2m7YRECDGSM%2BW2IYTzo6FM4%2BdUIjURO8srzKSvJgZ%2BQ6R79arKQw3uHLlX\"}],
\"group\":\"cf-nel\",
\"max_age\":604800}"],
"NEL":["{
\"success_fraction\":0.01,
\"report_to\":\"cf-nel\",
\"max_age\":604800}"],
"Server":["cloudflare"]}} {
"correlation_id":"95236535-ec98-4541-b92a-adfa73b69eab",
"trace_id":"c7ab8365-903f-46d4-9403-0e5b551e3545"}
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
PhpStorm
|
faVsco.js – Client.php
|
NULL
|
15431
|
|
15430
|
Project: faVsco.js, menu
JY-20725-handle-HS-search Project: faVsco.js, menu
JY-20725-handle-HS-search-rate-limit, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
2
65
1
1
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Services\Crm\Hubspot;
use HubSpot\Client\Crm\Deals\ApiException as DealApiException;
use HubSpot\Client\Crm\Contacts\ApiException as ContactApiException;
use HubSpot\Client\Crm\Companies\ApiException as CompanyApiException;
use HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectWithAssociations as ContactsWithAssociations;
use HubSpot\Client\Crm\Companies\Model\SimplePublicObjectWithAssociations as CompaniesWithAssociations;
use HubSpot\Client\Crm\Deals\Model\SimplePublicObjectWithAssociations as DealWithAssociations;
use HubSpot\Client\Crm\Objects\Model\SimplePublicObjectInput;
use HubSpot\Client\Crm\Objects\Model\SimplePublicObjectWithAssociations as ObjectWithAssociations;
use HubSpot\Client\Crm\Pipelines\Model\Error;
use HubSpot\Client\Crm\Pipelines\Model\PipelineStage;
use HubSpot\Client\Crm\Properties\Model\Property;
use HubSpot\Discovery\Discovery;
use Jiminny\Exceptions\CrmException;
use Jiminny\Exceptions\RateLimitException;
use Jiminny\Exceptions\SocialAccountTokenInvalidException;
use Jiminny\Jobs\Crm\NoteObject;
use Jiminny\Models\Crm\Field;
use Jiminny\Services\Crm\BaseClient;
use Jiminny\Services\Crm\Hubspot\DTO\Response\Owner;
use Jiminny\Services\SocialAccountService;
use SevenShores\Hubspot\Exceptions\BadRequest;
use SevenShores\Hubspot\Exceptions\HubspotException;
use SevenShores\Hubspot\Factory;
use SevenShores\Hubspot\Http\Response;
use Jiminny\Services\Crm\Hubspot\Pagination\HubspotPaginationService;
use Throwable;
/**
* @phpstan-type CrmFieldOption array{id:string, label:string, value?:string}
*/
class Client extends BaseClient implements HubspotClientInterface
{
public const string MIN_API_VERSION = '2';
public const string BASE_URL = '[URL_WITH_CREDENTIALS] T
* @param callable(): T $apiCall
* @return T
*
* @throws RateLimitException
*/
private function executeRequest(callable $apiCall)
{
try {
return $apiCall();
} catch (Throwable $e) {
if ($this->isHubspotRateLimit($e)) {
$retryAfter = $this->parseRetryAfter($e);
$this->log->warning('[Hubspot] Received 429 from API', [
'team_id' => $this->config->team_id,
'config_id' => $this->config->getId(),
'retry_after' => $retryAfter,
'reason' => $e->getMessage(),
]);
throw new RateLimitException('Hubspot returned 429', $retryAfter, $e);
}
throw $e;
}
}
public function isHubspotRateLimit(Throwable $e): bool
{
if ($e instanceof BadRequest
|| $e instanceof DealApiException
|| $e instanceof ContactApiException
|| $e instanceof CompanyApiException
|| $e instanceof \GuzzleHttp\Exception\RequestException
) {
return (int) $e->getCode() === 429;
}
return false;
}
public function parseRetryAfter(Throwable $e): int
{
// First try to get Retry-After from response headers
if (method_exists($e, 'getResponseHeaders')) {
$headers = $e->getResponseHeaders() ?: [];
$value = $headers['Retry-After'] ?? $headers['retry-after'] ?? null;
if (is_array($value)) {
$value = $value[0] ?? null;
}
if (is_numeric($value)) {
return (int) $value;
}
}
if (method_exists($e, 'getResponseBody')) {
$body = $e->getResponseBody();
if (is_string($body)) {
$body = json_decode($body, true) ?? [];
}
$policyName = $body['policyName'] ?? $body['policy'] ?? $body['context']['policyName'] ?? null;
if ($policyName === 'TEN_SECONDLY_ROLLING' || $policyName === 'ten_secondly_rolling') {
return 10;
}
if ($policyName === 'SECONDLY' || $policyName === 'secondly') {
return 1;
}
}
$this->log->warning('[Hubspot] No retry-after header or policy name found, using default', [
'exception_class' => get_class($e),
]);
return 10;
}
public function getMinimumApiVersion(): string
{
return self::MIN_API_VERSION;
}
public function getInstance(): Factory
{
return new Factory([
'key' => $this->accessToken,
'oauth2' => true,
'base_url' => $this->baseUrl,
]);
}
public function getNewInstance(): Discovery
{
return \HubSpot\Factory::createWithAccessToken($this->accessToken);
}
/**
* Secondly and daily limits for Hubspot API
*
* Product Tier: Free & Starter | Professional & Enterprise | API add-on (any tier)
* Burst: 100/10 seconds | 150/10 seconds | 200/10 seconds
* Daily: 250,000 | 500,000 | 1,000,000
*
* Official documentation states: The search endpoints are rate limited to five requests per second.
* Since with 5 RPS were still hitting secondly rate limits we lowered it to 4
*/
public function getPaginatedData(array $payload, string $type, int $offset = 0): array
{
$total = 0;
$lastId = null;
$rows = [];
foreach ($this->getPaginatedDataGenerator($payload, $type, $offset, $total, $lastId) as $row) {
$rows[] = $row;
}
return ['results' => $rows, 'total' => $total, 'last_record' => $lastId];
}
/**
* @throws HubspotException
* @throws SocialAccountTokenInvalidException
* @throws BadRequest
*/
public function getPaginatedDataGenerator(
array $payload,
string $type,
int $offset = 0,
int &$total = 0,
?string &$lastRecordId = null
): \Generator {
return $this->paginationService->getPaginatedDataGenerator(
$this,
$payload,
$type,
$offset,
$total,
$lastRecordId
);
}
/**
* Execute a search request against HubSpot CRM objects with rate limiting.
*
* @param string $objectType The object type ('deals', 'companies', 'contacts', 'calls')
* @param array<string, mixed> $payload The search payload with filters, sorts, properties, etc.
* @return array The search response with 'results', 'total', 'paging' keys
* @throws RateLimitException When rate limit is hit
* @throws HubspotException On API errors
*/
public function search(string $objectType, array $payload): array
{
$endpoint = self::BASE_URL . "/crm/v3/objects/{$objectType}/search";
return $this->executeRequest(function () use ($endpoint, $payload) {
$response = $this->getInstance()->getClient()->request('POST', $endpoint, ['json' => $payload]);
return $response->toArray();
});
}
/**
* @throws DealApiException
* @throws CrmException
*/
public function getOpportunityById(string $crmId, array $fields): array
{
try {
// $deal = $this->executeRequest(fn () => $this->getNewInstance()->crm()->deals()->basicApi()->getById(
$deal = $this->getNewInstance()->crm()->deals()->basicApi()->getById(
$crmId,
implode(',', $fields),
'companies,contacts'
);
} catch (DealApiException $e) {
$this->log->info('[Hubspot] Failed to fetch opportunity', [
'crm_id' => $crmId,
'reason' => $e->getMessage(),
]);
throw $e;
}
if (! $deal instanceof DealWithAssociations) {
throw new CrmException('Deal not found');
}
return [
'id' => $deal->getId(),
'properties' => $deal->getProperties(),
'associations' => $deal->getAssociations(),
];
}
/**
* Generic batch read method for HubSpot objects
*
* @param string $objectType The object type ('deals', 'companies', 'contacts')
* @param array<string> $crmIds Array of HubSpot object IDs (max 100)
* @param array<string> $fields Array of property names to fetch
*
* @return array<string, array> Array keyed by CRM ID with object data
*/
private function batchReadObjects(string $objectType, array $crmIds, array $fields): array
{
if (empty($crmIds)) {
return [];
}
$this->validateBatchSize($objectType, $crmIds);
$this->ensureValidToken();
try {
$batchConfig = $this->createBatchConfiguration($objectType);
$batchReadRequest = $this->prepareBatchRequest($batchConfig, $crmIds, $fields);
$response = $batchConfig['api']->read($batchReadRequest);
$this->validateApiResponse($response, $objectType);
$results = $this->processApiResults($response);
$this->logBatchResults($objectType, $crmIds, $results);
return $results;
} catch (\Throwable $e) {
$this->handleBatchError($e, $objectType, $crmIds);
}
}
private function validateBatchSize(string $objectType, array $crmIds): void
{
if (count($crmIds) > 100) {
throw new \InvalidArgumentException("Batch size cannot exceed 100 {$objectType}");
}
}
private function createBatchConfiguration(string $objectType): array
{
$configurations = [
'deals' => [
'batchReadRequest' => new \HubSpot\Client\Crm\Deals\Model\BatchReadInputSimplePublicObjectId(),
'inputClass' => \HubSpot\Client\Crm\Deals\Model\SimplePublicObjectId::class,
'api' => $this->getNewInstance()->crm()->deals()->batchApi(),
],
'companies' => [
'batchReadRequest' => new \HubSpot\Client\Crm\Companies\Model\BatchReadInputSimplePublicObjectId(),
'inputClass' => \HubSpot\Client\Crm\Companies\Model\SimplePublicObjectId::class,
'api' => $this->getNewInstance()->crm()->companies()->batchApi(),
],
'contacts' => [
'batchReadRequest' => new \HubSpot\Client\Crm\Contacts\Model\BatchReadInputSimplePublicObjectId(),
'inputClass' => \HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectId::class,
'api' => $this->getNewInstance()->crm()->contacts()->batchApi(),
],
];
if (! isset($configurations[$objectType])) {
throw new \InvalidArgumentException("Unsupported object type: {$objectType}");
}
return $configurations[$objectType];
}
private function prepareBatchRequest(array $batchConfig, array $crmIds, array $fields): object
{
$batchReadRequest = $batchConfig['batchReadRequest'];
$inputClass = $batchConfig['inputClass'];
$inputs = array_map(function ($crmId) use ($inputClass) {
$input = new $inputClass();
$input->setId($crmId);
return $input;
}, $crmIds);
$batchReadRequest->setInputs($inputs);
$batchReadRequest->setProperties($fields);
return $batchReadRequest;
}
private function validateApiResponse($response, string $objectType): void
{
if (! $response) {
throw new CrmException("HubSpot API returned null response for {$objectType} batch read");
}
}
private function processApiResults($response): array
{
$results = [];
$responseResults = $response->getResults();
if ($responseResults) {
foreach ($responseResults as $object) {
if ($object && $object->getId()) {
$results[$object->getId()] = [
'id' => $object->getId(),
'properties' => $object->getProperties() ?: [],
];
}
}
}
return $results;
}
private function logBatchResults(string $objectType, array $crmIds, array $results): void
{
$this->log->info("[HubSpot] Batch fetched {$objectType}", [
'requested_count' => count($crmIds),
'returned_count' => count($results),
'crm_ids' => $crmIds,
]);
}
private function handleBatchError(\Throwable $e, string $objectType, array $crmIds): void
{
$errorMessage = $e->getMessage() ?: 'Unknown error';
$errorTrace = $e->getTraceAsString() ?: 'No trace available';
$this->log->error("[HubSpot] Failed to batch fetch {$objectType}", [
'crm_ids' => $crmIds,
'error' => $errorMessage,
'trace' => $errorTrace,
]);
throw new CrmException("Failed to batch fetch {$objectType}: " . $errorMessage);
}
/**
* Batch read multiple opportunities by their CRM IDs
*
* @param array<string> $crmIds Array of HubSpot deal IDs (max 100)
* @param array<string> $fields Array of property names to fetch
*
* @return array<string, array> Array keyed by CRM ID with opportunity data
*/
public function getOpportunitiesByIds(array $crmIds, array $fields): array
{
return $this->batchReadObjects('deals', $crmIds, $fields);
}
/**
* Batch read multiple companies by their CRM IDs
*
* @param array<string> $crmIds Array of HubSpot company IDs (max 100)
* @param array<string> $fields Array of property names to fetch
*
* @return array<string, array> Array keyed by CRM ID with company data
*/
public function getCompaniesByIds(array $crmIds, array $fields): array
{
return $this->batchReadObjects('companies', $crmIds, $fields);
}
/**
* Batch read multiple contacts by their CRM IDs
*
* @param array<string> $crmIds Array of HubSpot contact IDs (max 100)
* @param array<string> $fields Array of property names to fetch
*
* @return array<string, array> Array keyed by CRM ID with contact data
*/
public function getContactsByIds(array $crmIds, array $fields): array
{
return $this->batchReadObjects('contacts', $crmIds, $fields);
}
/**
* @throws CompanyApiException
* @throws CrmException
*/
public function getAccountById(string $crmId, array $fields): array
{
try {
$company = $this->getNewInstance()->crm()->companies()->basicApi()->getById(
$crmId,
implode(',', $fields),
);
} catch (CompanyApiException $e) {
$this->log->info('[Hubspot] Failed to fetch account', [
'crm_id' => $crmId,
'reason' => $e->getMessage(),
]);
throw $e;
}
if (! $company instanceof CompaniesWithAssociations) {
throw new CrmException('Account not found');
}
return [
'id' => $company->getId(),
'properties' => $company->getProperties(),
];
}
/**
* @throws ContactApiException
* @throws CrmException
*/
public function getContactById(string $crmId, array $fields): array
{
try {
$contact = $this->getNewInstance()->crm()->contacts()->basicApi()->getById(
$crmId,
implode(',', $fields)
);
} catch (ContactApiException $e) {
$this->log->info('[Hubspot] Failed to fetch contact', [
'crm_id' => $crmId,
'reason' => $e->getMessage(),
]);
throw $e;
}
if (! $contact instanceof ContactsWithAssociations) {
throw new CrmException('Contact not found');
}
return [
'id' => $contact->getId(),
'properties' => $contact->getProperties(),
];
}
/**
* This is email search request that Hubspot offers as GET (more generous quota)
*/
public function getContactByEmail(string $email, array $fields = []): array
{
try {
$contact = $this->getNewInstance()->crm()->contacts()->basicApi()->getById(
$email,
implode(',', $fields),
null,
false,
'email'
);
return [
'id' => $contact->getId(),
'properties' => $contact->getProperties(),
];
} catch (ContactApiException $e) {
$this->log->info('[Hubspot] Failed to fetch contact', [
'email' => $email,
'reason' => $e->getMessage(),
]);
return [];
}
}
/**
* @throws CrmException
*/
public function fetchProperty(string $objectType, string $propertyId): Property
{
$result = $this->getNewInstance()->crm()->properties()->coreApi()->getByName($objectType, $propertyId);
if (! $result instanceof Property) {
$this->log->error('[Hubspot] Failed to fetch property', [
'object_type' => $objectType,
'property_id' => $propertyId,
'reason' => $result->getMessage(),
]);
throw new CrmException('Failed to fetch property');
}
return $result;
}
/**
* @return array<CrmFieldOption>
*/
public function fetchPropertyOptions(string $objectType, string $propertyId): array
{
/** @var array<CrmFieldOption> */
return $this->fetchProperty($objectType, $propertyId)->getOptions();
}
/**
* @return array<array{id:string, label:string, deleted:bool}>
*/
public function fetchCallDispositions(): array
{
/** @var Response $response */
$response = $this->getInstance()->engagements()->getCallDispositions();
/**
* @var array<array{
* id:string,
* label:string,
* deleted: bool
* }>
*/
return $response->toArray();
}
/**
* @return array<CrmFieldOption>
*/
public function fetchOpportunityPipelineStages(): array
{
$stages = [];
$apiResponse = $this->getNewInstance()->crm()->pipelines()->pipelinesApi()->getAll('deals');
if ($apiResponse instanceof Error) {
$this->log->error('[Hubspot] Failed to fetch opportunity pipelines', [
'reason' => $apiResponse->getMessage(),
]);
return [];
}
foreach ($apiResponse->getResults() as $pipeline) {
$pipelineStages = array_map(
static function (PipelineStage $stage) {
return [
'id' => $stage->getId(),
'label' => $stage->getLabel(),
];
},
$pipeline->getStages()
);
$stages = array_merge($stages, $pipelineStages);
}
return $stages;
}
public function fetchOpportunityPipelines(): array
{
$pipelines = [];
try {
$apiResponse = $this->makeRequest('/crm/v3/pipelines/deals');
} catch (\Exception $e) {
$this->log->info('[Hubspot] Failed to fetch opportunity pipelines', [
'reason' => $e->getMessage(),
]);
return [];
}
$response = $apiResponse->toArray();
foreach ($response['results'] as $pipeline) {
$pipelines[] = [
'id' => $pipeline['id'],
'label' => $pipeline['label'],
];
}
return $pipelines;
}
/**
* @return array<CrmFieldOption>
*/
public function fetchMeetingOutcomeFieldOptions(Field $field): array
{
return $field->getCrmProviderId() === 'meetingOutcome'
? $this->fetchMeetingOutcomeTypes()
: $this->fetchCallActivityTypes();
}
public function fetchMeetingOutcomeTypes(): array
{
return $this->extractMeetingTypeOptions(
'[URL_WITH_CREDENTIALS] Response $response */
$response = $this->getInstance()
->getClient()
->request('GET', $endpoint);
/**
* @var array<array{
* value: string,
* label: string,
* displayOrder: int
* }> $optionData
*/
$optionData = $response->toArray()['options'] ?? [];
$options = [];
foreach ($optionData as $item) {
$options[] = [
'id' => $item['value'],
'value' => $item['value'],
'label' => $item['label'],
'display_order' => $item['displayOrder'],
];
}
return $options;
}
/**
* @return array<CrmFieldOption>
*/
public function fetchDispositionFieldOptions(): array
{
$options = [];
$dispositions = $this->fetchCallDispositions();
foreach ($dispositions as $disposition) {
if ($disposition['deleted'] !== false) {
continue;
}
$option['value'] = $disposition['id'];
$option['id'] = $disposition['id'];
$option['label'] = $disposition['label'];
$options[] = $option;
}
return $options;
}
/**
* @return array<CrmFieldOption>
*/
public function fetchOpportunityFieldOptions(Field $field): array
{
if ($field->isStageField()) {
return $this->fetchOpportunityPipelineStages();
}
if ($field->isPipelineField()) {
return $this->fetchOpportunityPipelines();
}
return $this->fetchPropertyOptions('deals', $field->getCrmProviderId());
}
/**
* @throws BadRequest
* @throws HubspotException
*/
public function makeRequest(string $endpoint, $method = 'GET', $payload = [], ?string $queryString = null)
{
$endpoint = self::BASE_URL . $endpoint;
if ($method === 'GET') {
$response = $this->getInstance()->getClient()?->request(
method: $method,
endpoint: $endpoint,
query_string: $queryString
);
} else {
$response = $this->getInstance()->getClient()->request($method, $endpoint, [
'json' => ($payload),
]);
}
//
// $max = $response->getHeaderLine('X-HubSpot-RateLimit-Max'); // "110"
// $remaining = $response->getHeaderLine('X-HubSpot-RateLimit-Remaining'); // "109"
// $interval = $response->getHeaderLine('X-HubSpot-RateLimit-Interval-Milliseconds'); // "10000"
// $body = json_decode((string) $response->getBody(), true);
//
// \Illuminate\Support\Facades\Log::channel('custom_channel')->info('$max ' . PHP_EOL . print_r($max, true));
// \Illuminate\Support\Facades\Log::channel('custom_channel')->info('$remaining ' . PHP_EOL . print_r($remaining, true));
// \Illuminate\Support\Facades\Log::channel('custom_channel')->info('$interval ' . PHP_EOL . print_r($interval, true));
// \Illuminate\Support\Facades\Log::channel('custom_channel')->info('$body ' . PHP_EOL . print_r($body, true));
return $response;
}
/**
* @throws BadRequest
* @throws HubspotException
*/
public function createMeeting(array $payload): Response
{
$endpoint = '/crm/v3/objects/meetings';
return $this->makeRequest($endpoint, 'POST', $payload);
}
/**
* @throws BadRequest
* @throws HubspotException
*/
public function updateMeeting(string $meetingId, array $payload): Response
{
$endpoint = '/crm/v3/objects/meetings/' . $meetingId;
return $this->makeRequest($endpoint, 'PATCH', $payload);
}
/**
* @throws \Exception
*/
public function createNote(
string $body,
string $ownerId,
int $timestamp,
string $objectId,
NoteObject $noteObject
): ?string {
try {
$noteInput = new SimplePublicObjectInput([
'properties' => [
'hs_note_body' => $body,
'hubspot_owner_id' => $ownerId,
'hs_timestamp' => $timestamp,
],
]);
// Create note
$note = $this->getNewInstance()->crm()->objects()->basicApi()->create('note', $noteInput);
$this->getNewInstance()->crm()->objects()->associationsApi()->create(
'note',
$note->getId(),
$this->getNoteObject($noteObject),
$objectId,
$this->getNoteAssociationType($noteObject),
);
return $note->getId();
} catch (\Exception $e) {
$this->log->error('[Hubspot] Failed to create note', [
'objectId' => $objectId,
'noteObject' => $noteObject->getObjectType(),
'reason' => $e->getMessage(),
]);
\Sentry::captureException($e);
}
return null;
}
public function updateEngagement(string $objectId, array $engagement, array $metadata): void
{
$this->getInstance()->engagements()->update($objectId, $engagement, $metadata);
}
public function getEngagementData(string $engagementId): array
{
$engagement = $this->getInstance()->engagements()->get($engagementId);
return $engagement->toArray();
}
public function createEngagement(array $engagement, array $associations, array $metadata): Response
{
return $this->getInstance()
->engagements()
->create($engagement, $associations, $metadata);
}
public function isUnauthorizedException(\Exception $e): bool
{
// Check for specific HubSpot API exception types first
if ($e instanceof BadRequest) {
// BadRequest can contain 401 status codes
return $e->getCode() === 401;
}
// Check for HTTP client exceptions with status codes
if ($e instanceof \GuzzleHttp\Exception\RequestException && $e->hasResponse()) {
$response = $e->getResponse();
if ($response !== null) {
return $response->getStatusCode() === 401;
}
}
// Check for Guzzle HTTP exceptions
if ($e instanceof \GuzzleHttp\Exception\ClientException) {
return $e->getCode() === 401;
}
// Fallback to string matching as last resort, but be more specific
$message = strtolower($e->getMessage());
return str_contains($message, '401 unauthorized') ||
str_contains($message, 'http 401') ||
str_contains($message, 'status code 401') ||
(preg_match('/\b401\b/', $message) && str_contains($message, 'unauthorized'));
}
/**
* Validates and refreshes the access token if needed before API requests.
* This ensures long-running processes don't fail due to token expiration.
*
* @throws SocialAccountTokenInvalidException
*/
public function ensureValidToken(): void
{
if ($this->oauthAccount === null) {
return;
}
$newToken = $this->tokenManager->ensureValidToken($this->oauthAccount);
if ($newToken !== null) {
$this->accessToken = $newToken;
}
}
public function getConfig()
{
return $this->config;
}
// returns only active (archived=false)
public function getOwners(): array
{
return $this->getNewInstance()->crm()->owners()->getAll();
}
/**
* @param bool $archived
*
* @return array<Owner>|[]
*/
public function getOwnersArchived(bool $archived = true): array
{
$endpoint = '/crm/v3/owners';
$queryParams = [
'archived' => $archived ? 'true' : 'false',
];
$queryString = http_build_query($queryParams);
$owners = [];
try {
$response = $this->makeRequest(endpoint: $endpoint, queryString: $queryString);
$responseData = $response?->toArray();
foreach ($responseData['results'] as $result) {
try {
$owners[] = Owner::create($result);
} catch (Throwable $e) {
$this->log->error('[HubSpot] Failed to process owner data', [
'result' => $result,
'error' => $e->getMessage(),
]);
continue;
}
}
} catch (Throwable $e) {
$this->log->error('HubSpot] Failed to fetch owners', [
'archived' => $archived,
'error' => $e->getMessage(),
]);
return [];
}
return $owners;
}
public function getMeeting(string $engagementId): ObjectWithAssociations
{
return $this->getNewInstance()->crm()->objects()->basicApi()
->getById('meeting', $engagementId, null, 'contact,company,deal');
}
public function deleteEngagement(string $engagementId): void
{
$this->getInstance()->engagements()->delete((int) $engagementId);
}
public function getAssociationsData(array $ids, string $fromObject, string $toObject): array
{
$associationData = [];
$idChunks = array_chunk($ids, self::ASSOCIATIONS_BATCH_SIZE_LIMIT);
foreach ($idChunks as $idChunk) {
try {
$batchInput = new \HubSpot\Client\Crm\Associations\Model\BatchInputPublicObjectId();
$batchInput->setInputs(array_map(function ($id) {
$publicObjectId = new \HubSpot\Client\Crm\Associations\Model\PublicObjectId();
$publicObjectId->setId($id);
return $publicObjectId;
}, $idChunk));
$associatedObjectsData = $this
->getNewInstance()
->crm()
->associations()
->batchApi()
->read($fromObject, $toObject, $batchInput);
if ($associatedObjectsData instanceof \HubSpot\Client\Crm\Associations\Model\BatchResponsePublicAssociationMulti) {
foreach ($associatedObjectsData->getResults() as $association) {
$from = $association->getFrom()->getId();
$toAssociations = $association->getTo();
if (! empty($toAssociations)) {
$associationData[$from] = array_map(function ($item) {
return $item->getId();
}, $toAssociations);
}
}
}
// } catch (RateLimitException $e) {
// throw $e;
} catch (\Exception $e) {
$this->log->error('[Hubspot] Failed to fetch associations', [
'from_object' => $fromObject,
'to_object' => $toObject,
'reason' => $e->getMessage(),
]);
}
}
return $associationData;
}
/**
* @throws \Exception
*/
private function getNoteAssociationType(NoteObject $noteObject): string
{
return match($noteObject) {
NoteObject::Opportunity => 'note_to_deal',
NoteObject::Lead, NoteObject::Contact => 'note_to_contact', // or 'note_to_lead' if your portal supports it
NoteObject::Account => 'note_to_company',
NoteObject::Call, NoteObject::Event => throw new \Exception('Not supported'),
};
}
/**
* @throws \Exception
*/
private function getNoteObject(NoteObject $noteObject): string
{
return match($noteObject) {
NoteObject::Opportunity => 'deal',
NoteObject::Lead, NoteObject::Contact => 'contact',
NoteObject::Account => 'company',
NoteObject::Call, NoteObject::Event => throw new \Exception('Not supported'),
};
}
public function addAssociations(string $objectType, string $associationType, array $payload): Response
{
$endpoint = "/crm/v4/associations/$objectType/$associationType/batch/create";
return $this->makeRequest($endpoint, 'POST', $payload);
}
public function removeAssociations(string $objectType, string $associationType, array $payload): Response
{
$endpoint = "/crm/v4/associations/$objectType/$associationType/batch/archive";
return $this->makeRequest($endpoint, 'POST', $payload);
}
}
Sync Changes
Hide This Notification
Code changed:
Hide
19
Previous Highlighted Error
Next Highlighted Error
[2026-05-07 14:21:15] local.INFO: [Hubspot] DEBUG Getting headers {
"headers":{
"Date":["Thu,07 May 2026 14:21:15 GMT"],
"Content-Type":["application/json;charset=utf-8"],
"Transfer-Encoding":["chunked"],
"Connection":["keep-alive"],
"CF-Ray":["9f80deb8db60dc3a-SOF"],
"CF-Cache-Status":["DYNAMIC"],
"Strict-Transport-Security":["max-age=31536000; includeSubDomains; preload"],
"Vary":["origin,
accept-encoding"],
"access-control-allow-credentials":["false"],
"server-timing":["hcid;desc=\"019e02d0-6fd8-7812-bdba-885b7ccb3ee3\",
cfr;desc=\"9f80deb8e7c6dc3a-IAD\""],
"x-content-type-options":["nosniff"],
"x-hubspot-correlation-id":["019e02d0-6fd8-7812-bdba-885b7ccb3ee3"],
"Set-Cookie":["__cf_bm=SIUrtdQgXVrik50pdqF6hZVYKhzTnQBidvMabeCtm0Y-1778163675-[IP_ADDRESS]-rI.ZggtDKxTge5zr8_2gbBfWMQQ.ufZEXDZyHz2mBUFdzdo2gTHEsOkXMSEShjK0hGYxNhUGM1ZoBpX7BcFZcHEjA7Cs_.SMUhUnd2nYjko; path=/; expires=Thu,
07-May-26 14:51:15 GMT; domain=.hubapi.com; HttpOnly; Secure; SameSite=None"],
"Report-To":["{
\"endpoints\":[{
\"url\":\"https:\\/\\/a.nel.cloudflare.com\\/report\\/v4?s=NYAlsVTP0fYm32qrSDjxYE4sd2RWRqiSp3wHsmdEgZlzoYdxI%2BIxVpHmsKn3O%2BKVA3mFIJ2m7YRECDGSM%2BW2IYTzo6FM4%2BdUIjURO8srzKSvJgZ%2BQ6R79arKQw3uHLlX\"}],
\"group\":\"cf-nel\",
\"max_age\":604800}"],
"NEL":["{
\"success_fraction\":0.01,
\"report_to\":\"cf-nel\",
\"max_age\":604800}"],
"Server":["cloudflare"]}} {
"correlation_id":"95236535-ec98-4541-b92a-adfa73b69eab",
"trace_id":"c7ab8365-903f-46d4-9403-0e5b551e3545"}
Project
Project
New File or Directory…
Expand Selected...
|
PhpStorm
|
faVsco.js – Client.php
|
NULL
|
15430
|
|
15429
|
Project: faVsco.js, menu
JY-20725-handle-HS-search Project: faVsco.js, menu
JY-20725-handle-HS-search-rate-limit, menu
Start Listening for PHP Debug Connections
AskJiminnyReportActivityServiceTest
Run 'AskJiminnyReportActivityServiceTest'
Debug 'AskJiminnyReportActivityServiceTest'
More Actions
JetBrains AI
Search Everywhere
IDE and Project Settings
Sync Changes
Hide This Notification
Code changed:
Hide
2
65
1
1
Previous Highlighted Error
Next Highlighted Error
<?php
declare(strict_types=1);
namespace Jiminny\Services\Crm\Hubspot;
use HubSpot\Client\Crm\Deals\ApiException as DealApiException;
use HubSpot\Client\Crm\Contacts\ApiException as ContactApiException;
use HubSpot\Client\Crm\Companies\ApiException as CompanyApiException;
use HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectWithAssociations as ContactsWithAssociations;
use HubSpot\Client\Crm\Companies\Model\SimplePublicObjectWithAssociations as CompaniesWithAssociations;
use HubSpot\Client\Crm\Deals\Model\SimplePublicObjectWithAssociations as DealWithAssociations;
use HubSpot\Client\Crm\Objects\Model\SimplePublicObjectInput;
use HubSpot\Client\Crm\Objects\Model\SimplePublicObjectWithAssociations as ObjectWithAssociations;
use HubSpot\Client\Crm\Pipelines\Model\Error;
use HubSpot\Client\Crm\Pipelines\Model\PipelineStage;
use HubSpot\Client\Crm\Properties\Model\Property;
use HubSpot\Discovery\Discovery;
use Jiminny\Exceptions\CrmException;
use Jiminny\Exceptions\RateLimitException;
use Jiminny\Exceptions\SocialAccountTokenInvalidException;
use Jiminny\Jobs\Crm\NoteObject;
use Jiminny\Models\Crm\Field;
use Jiminny\Services\Crm\BaseClient;
use Jiminny\Services\Crm\Hubspot\DTO\Response\Owner;
use Jiminny\Services\SocialAccountService;
use SevenShores\Hubspot\Exceptions\BadRequest;
use SevenShores\Hubspot\Exceptions\HubspotException;
use SevenShores\Hubspot\Factory;
use SevenShores\Hubspot\Http\Response;
use Jiminny\Services\Crm\Hubspot\Pagination\HubspotPaginationService;
use Throwable;
/**
* @phpstan-type CrmFieldOption array{id:string, label:string, value?:string}
*/
class Client extends BaseClient implements HubspotClientInterface
{
public const string MIN_API_VERSION = '2';
public const string BASE_URL = '[URL_WITH_CREDENTIALS] T
* @param callable(): T $apiCall
* @return T
*
* @throws RateLimitException
*/
private function executeRequest(callable $apiCall)
{
try {
return $apiCall();
} catch (Throwable $e) {
if ($this->isHubspotRateLimit($e)) {
$retryAfter = $this->parseRetryAfter($e);
$this->log->warning('[Hubspot] Received 429 from API', [
'team_id' => $this->config->team_id,
'config_id' => $this->config->getId(),
'retry_after' => $retryAfter,
'reason' => $e->getMessage(),
]);
throw new RateLimitException('Hubspot returned 429', $retryAfter, $e);
}
throw $e;
}
}
public function isHubspotRateLimit(Throwable $e): bool
{
if ($e instanceof BadRequest
|| $e instanceof DealApiException
|| $e instanceof ContactApiException
|| $e instanceof CompanyApiException
|| $e instanceof \GuzzleHttp\Exception\RequestException
) {
return (int) $e->getCode() === 429;
}
return false;
}
public function parseRetryAfter(Throwable $e): int
{
// First try to get Retry-After from response headers
if (method_exists($e, 'getResponseHeaders')) {
$headers = $e->getResponseHeaders() ?: [];
$value = $headers['Retry-After'] ?? $headers['retry-after'] ?? null;
if (is_array($value)) {
$value = $value[0] ?? null;
}
if (is_numeric($value)) {
return (int) $value;
}
}
if (method_exists($e, 'getResponseBody')) {
$body = $e->getResponseBody();
if (is_string($body)) {
$body = json_decode($body, true) ?? [];
}
$policyName = $body['policyName'] ?? $body['policy'] ?? $body['context']['policyName'] ?? null;
if ($policyName === 'TEN_SECONDLY_ROLLING' || $policyName === 'ten_secondly_rolling') {
return 10;
}
if ($policyName === 'SECONDLY' || $policyName === 'secondly') {
return 1;
}
}
$this->log->warning('[Hubspot] No retry-after header or policy name found, using default', [
'exception_class' => get_class($e),
]);
return 10;
}
public function getMinimumApiVersion(): string
{
return self::MIN_API_VERSION;
}
public function getInstance(): Factory
{
return new Factory([
'key' => $this->accessToken,
'oauth2' => true,
'base_url' => $this->baseUrl,
]);
}
public function getNewInstance(): Discovery
{
return \HubSpot\Factory::createWithAccessToken($this->accessToken);
}
/**
* Secondly and daily limits for Hubspot API
*
* Product Tier: Free & Starter | Professional & Enterprise | API add-on (any tier)
* Burst: 100/10 seconds | 150/10 seconds | 200/10 seconds
* Daily: 250,000 | 500,000 | 1,000,000
*
* Official documentation states: The search endpoints are rate limited to five requests per second.
* Since with 5 RPS were still hitting secondly rate limits we lowered it to 4
*/
public function getPaginatedData(array $payload, string $type, int $offset = 0): array
{
$total = 0;
$lastId = null;
$rows = [];
foreach ($this->getPaginatedDataGenerator($payload, $type, $offset, $total, $lastId) as $row) {
$rows[] = $row;
}
return ['results' => $rows, 'total' => $total, 'last_record' => $lastId];
}
/**
* @throws HubspotException
* @throws SocialAccountTokenInvalidException
* @throws BadRequest
*/
public function getPaginatedDataGenerator(
array $payload,
string $type,
int $offset = 0,
int &$total = 0,
?string &$lastRecordId = null
): \Generator {
return $this->paginationService->getPaginatedDataGenerator(
$this,
$payload,
$type,
$offset,
$total,
$lastRecordId
);
}
/**
* Execute a search request against HubSpot CRM objects with rate limiting.
*
* @param string $objectType The object type ('deals', 'companies', 'contacts', 'calls')
* @param array<string, mixed> $payload The search payload with filters, sorts, properties, etc.
* @return array The search response with 'results', 'total', 'paging' keys
* @throws RateLimitException When rate limit is hit
* @throws HubspotException On API errors
*/
public function search(string $objectType, array $payload): array
{
$endpoint = self::BASE_URL . "/crm/v3/objects/{$objectType}/search";
return $this->executeRequest(function () use ($endpoint, $payload) {
$response = $this->getInstance()->getClient()->request('POST', $endpoint, ['json' => $payload]);
return $response->toArray();
});
}
/**
* @throws DealApiException
* @throws CrmException
*/
public function getOpportunityById(string $crmId, array $fields): array
{
try {
// $deal = $this->executeRequest(fn () => $this->getNewInstance()->crm()->deals()->basicApi()->getById(
$deal = $this->getNewInstance()->crm()->deals()->basicApi()->getById(
$crmId,
implode(',', $fields),
'companies,contacts'
);
} catch (DealApiException $e) {
$this->log->info('[Hubspot] Failed to fetch opportunity', [
'crm_id' => $crmId,
'reason' => $e->getMessage(),
]);
throw $e;
}
if (! $deal instanceof DealWithAssociations) {
throw new CrmException('Deal not found');
}
return [
'id' => $deal->getId(),
'properties' => $deal->getProperties(),
'associations' => $deal->getAssociations(),
];
}
/**
* Generic batch read method for HubSpot objects
*
* @param string $objectType The object type ('deals', 'companies', 'contacts')
* @param array<string> $crmIds Array of HubSpot object IDs (max 100)
* @param array<string> $fields Array of property names to fetch
*
* @return array<string, array> Array keyed by CRM ID with object data
*/
private function batchReadObjects(string $objectType, array $crmIds, array $fields): array
{
if (empty($crmIds)) {
return [];
}
$this->validateBatchSize($objectType, $crmIds);
$this->ensureValidToken();
try {
$batchConfig = $this->createBatchConfiguration($objectType);
$batchReadRequest = $this->prepareBatchRequest($batchConfig, $crmIds, $fields);
$response = $batchConfig['api']->read($batchReadRequest);
$this->validateApiResponse($response, $objectType);
$results = $this->processApiResults($response);
$this->logBatchResults($objectType, $crmIds, $results);
return $results;
} catch (\Throwable $e) {
$this->handleBatchError($e, $objectType, $crmIds);
}
}
private function validateBatchSize(string $objectType, array $crmIds): void
{
if (count($crmIds) > 100) {
throw new \InvalidArgumentException("Batch size cannot exceed 100 {$objectType}");
}
}
private function createBatchConfiguration(string $objectType): array
{
$configurations = [
'deals' => [
'batchReadRequest' => new \HubSpot\Client\Crm\Deals\Model\BatchReadInputSimplePublicObjectId(),
'inputClass' => \HubSpot\Client\Crm\Deals\Model\SimplePublicObjectId::class,
'api' => $this->getNewInstance()->crm()->deals()->batchApi(),
],
'companies' => [
'batchReadRequest' => new \HubSpot\Client\Crm\Companies\Model\BatchReadInputSimplePublicObjectId(),
'inputClass' => \HubSpot\Client\Crm\Companies\Model\SimplePublicObjectId::class,
'api' => $this->getNewInstance()->crm()->companies()->batchApi(),
],
'contacts' => [
'batchReadRequest' => new \HubSpot\Client\Crm\Contacts\Model\BatchReadInputSimplePublicObjectId(),
'inputClass' => \HubSpot\Client\Crm\Contacts\Model\SimplePublicObjectId::class,
'api' => $this->getNewInstance()->crm()->contacts()->batchApi(),
],
];
if (! isset($configurations[$objectType])) {
throw new \InvalidArgumentException("Unsupported object type: {$objectType}");
}
return $configurations[$objectType];
}
private function prepareBatchRequest(array $batchConfig, array $crmIds, array $fields): object
{
$batchReadRequest = $batchConfig['batchReadRequest'];
$inputClass = $batchConfig['inputClass'];
$inputs = array_map(function ($crmId) use ($inputClass) {
$input = new $inputClass();
$input->setId($crmId);
return $input;
}, $crmIds);
$batchReadRequest->setInputs($inputs);
$batchReadRequest->setProperties($fields);
return $batchReadRequest;
}
private function validateApiResponse($response, string $objectType): void
{
if (! $response) {
throw new CrmException("HubSpot API returned null response for {$objectType} batch read");
}
}
private function processApiResults($response): array
{
$results = [];
$responseResults = $response->getResults();
if ($responseResults) {
foreach ($responseResults as $object) {
if ($object && $object->getId()) {
$results[$object->getId()] = [
'id' => $object->getId(),
'properties' => $object->getProperties() ?: [],
];
}
}
}
return $results;
}
private function logBatchResults(string $objectType, array $crmIds, array $results): void
{
$this->log->info("[HubSpot] Batch fetched {$objectType}", [
'requested_count' => count($crmIds),
'returned_count' => count($results),
'crm_ids' => $crmIds,
]);
}
private function handleBatchError(\Throwable $e, string $objectType, array $crmIds): void
{
$errorMessage = $e->getMessage() ?: 'Unknown error';
$errorTrace = $e->getTraceAsString() ?: 'No trace available';
$this->log->error("[HubSpot] Failed to batch fetch {$objectType}", [
'crm_ids' => $crmIds,
'error' => $errorMessage,
'trace' => $errorTrace,
]);
throw new CrmException("Failed to batch fetch {$objectType}: " . $errorMessage);
}
/**
* Batch read multiple opportunities by their CRM IDs
*
* @param array<string> $crmIds Array of HubSpot deal IDs (max 100)
* @param array<string> $fields Array of property names to fetch
*
* @return array<string, array> Array keyed by CRM ID with opportunity data
*/
public function getOpportunitiesByIds(array $crmIds, array $fields): array
{
return $this->batchReadObjects('deals', $crmIds, $fields);
}
/**
* Batch read multiple companies by their CRM IDs
*
* @param array<string> $crmIds Array of HubSpot company IDs (max 100)
* @param array<string> $fields Array of property names to fetch
*
* @return array<string, array> Array keyed by CRM ID with company data
*/
public function getCompaniesByIds(array $crmIds, array $fields): array
{
return $this->batchReadObjects('companies', $crmIds, $fields);
}
/**
* Batch read multiple contacts by their CRM IDs
*
* @param array<string> $crmIds Array of HubSpot contact IDs (max 100)
* @param array<string> $fields Array of property names to fetch
*
* @return array<string, array> Array keyed by CRM ID with contact data
*/
public function getContactsByIds(array $crmIds, array $fields): array
{
return $this->batchReadObjects('contacts', $crmIds, $fields);
}
/**
* @throws CompanyApiException
* @throws CrmException
*/
public function getAccountById(string $crmId, array $fields): array
{
try {
$company = $this->getNewInstance()->crm()->companies()->basicApi()->getById(
$crmId,
implode(',', $fields),
);
} catch (CompanyApiException $e) {
$this->log->info('[Hubspot] Failed to fetch account', [
'crm_id' => $crmId,
'reason' => $e->getMessage(),
]);
throw $e;
}
if (! $company instanceof CompaniesWithAssociations) {
throw new CrmException('Account not found');
}
return [
'id' => $company->getId(),
'properties' => $company->getProperties(),
];
}
/**
* @throws ContactApiException
* @throws CrmException
*/
public function getContactById(string $crmId, array $fields): array
{
try {
$contact = $this->getNewInstance()->crm()->contacts()->basicApi()->getById(
$crmId,
implode(',', $fields)
);
} catch (ContactApiException $e) {
$this->log->info('[Hubspot] Failed to fetch contact', [
'crm_id' => $crmId,
'reason' => $e->getMessage(),
]);
throw $e;
}
if (! $contact instanceof ContactsWithAssociations) {
throw new CrmException('Contact not found');
}
return [
'id' => $contact->getId(),
'properties' => $contact->getProperties(),
];
}
/**
* This is email search request that Hubspot offers as GET (more generous quota)
*/
public function getContactByEmail(string $email, array $fields = []): array
{
try {
$contact = $this->getNewInstance()->crm()->contacts()->basicApi()->getById(
$email,
implode(',', $fields),
null,
false,
'email'
);
return [
'id' => $contact->getId(),
'properties' => $contact->getProperties(),
];
} catch (ContactApiException $e) {
$this->log->info('[Hubspot] Failed to fetch contact', [
'email' => $email,
'reason' => $e->getMessage(),
]);
return [];
}
}
/**
* @throws CrmException
*/
public function fetchProperty(string $objectType, string $propertyId): Property
{
$result = $this->getNewInstance()->crm()->properties()->coreApi()->getByName($objectType, $propertyId);
if (! $result instanceof Property) {
$this->log->error('[Hubspot] Failed to fetch property', [
'object_type' => $objectType,
'property_id' => $propertyId,
'reason' => $result->getMessage(),
]);
throw new CrmException('Failed to fetch property');
}
return $result;
}
/**
* @return array<CrmFieldOption>
*/
public function fetchPropertyOptions(string $objectType, string $propertyId): array
{
/** @var array<CrmFieldOption> */
return $this->fetchProperty($objectType, $propertyId)->getOptions();
}
/**
* @return array<array{id:string, label:string, deleted:bool}>
*/
public function fetchCallDispositions(): array
{
/** @var Response $response */
$response = $this->getInstance()->engagements()->getCallDispositions();
/**
* @var array<array{
* id:string,
* label:string,
* deleted: bool
* }>
*/
return $response->toArray();
}
/**
* @return array<CrmFieldOption>
*/
public function fetchOpportunityPipelineStages(): array
{
$stages = [];
$apiResponse = $this->getNewInstance()->crm()->pipelines()->pipelinesApi()->getAll('deals');
if ($apiResponse instanceof Error) {
$this->log->error('[Hubspot] Failed to fetch opportunity pipelines', [
'reason' => $apiResponse->getMessage(),
]);
return [];
}
foreach ($apiResponse->getResults() as $pipeline) {
$pipelineStages = array_map(
static function (PipelineStage $stage) {
return [
'id' => $stage->getId(),
'label' => $stage->getLabel(),
];
},
$pipeline->getStages()
);
$stages = array_merge($stages, $pipelineStages);
}
return $stages;
}
public function fetchOpportunityPipelines(): array
{
$pipelines = [];
try {
$apiResponse = $this->makeRequest('/crm/v3/pipelines/deals');
} catch (\Exception $e) {
$this->log->info('[Hubspot] Failed to fetch opportunity pipelines', [
'reason' => $e->getMessage(),
]);
return [];
}
$response = $apiResponse->toArray();
foreach ($response['results'] as $pipeline) {
$pipelines[] = [
'id' => $pipeline['id'],
'label' => $pipeline['label'],
];
}
return $pipelines;
}
/**
* @return array<CrmFieldOption>
*/
public function fetchMeetingOutcomeFieldOptions(Field $field): array
{
return $field->getCrmProviderId() === 'meetingOutcome'
? $this->fetchMeetingOutcomeTypes()
: $this->fetchCallActivityTypes();
}
public function fetchMeetingOutcomeTypes(): array
{
return $this->extractMeetingTypeOptions(
'[URL_WITH_CREDENTIALS] Response $response */
$response = $this->getInstance()
->getClient()
->request('GET', $endpoint);
/**
* @var array<array{
* value: string,
* label: string,
* displayOrder: int
* }> $optionData
*/
$optionData = $response->toArray()['options'] ?? [];
$options = [];
foreach ($optionData as $item) {
$options[] = [
'id' => $item['value'],
'value' => $item['value'],
'label' => $item['label'],
'display_order' => $item['displayOrder'],
];
}
return $options;
}
/**
* @return array<CrmFieldOption>
*/
public function fetchDispositionFieldOptions(): array
{
$options = [];
$dispositions = $this->fetchCallDispositions();
foreach ($dispositions as $disposition) {
if ($disposition['deleted'] !== false) {
continue;
}
$option['value'] = $disposition['id'];
$option['id'] = $disposition['id'];
$option['label'] = $disposition['label'];
$options[] = $option;
}
return $options;
}
/**
* @return array<CrmFieldOption>
*/
public function fetchOpportunityFieldOptions(Field $field): array
{
if ($field->isStageField()) {
return $this->fetchOpportunityPipelineStages();
}
if ($field->isPipelineField()) {
return $this->fetchOpportunityPipelines();
}
return $this->fetchPropertyOptions('deals', $field->getCrmProviderId());
}
/**
* @throws BadRequest
* @throws HubspotException
*/
public function makeRequest(string $endpoint, $method = 'GET', $payload = [], ?string $queryString = null)
{
$endpoint = self::BASE_URL . $endpoint;
if ($method === 'GET') {
$response = $this->getInstance()->getClient()?->request(
method: $method,
endpoint: $endpoint,
query_string: $queryString
);
} else {
$response = $this->getInstance()->getClient()->request($method, $endpoint, [
'json' => ($payload),
]);
}
//
// $max = $response->getHeaderLine('X-HubSpot-RateLimit-Max'); // "110"
// $remaining = $response->getHeaderLine('X-HubSpot-RateLimit-Remaining'); // "109"
// $interval = $response->getHeaderLine('X-HubSpot-RateLimit-Interval-Milliseconds'); // "10000"
// $body = json_decode((string) $response->getBody(), true);
//
// \Illuminate\Support\Facades\Log::channel('custom_channel')->info('$max ' . PHP_EOL . print_r($max, true));
// \Illuminate\Support\Facades\Log::channel('custom_channel')->info('$remaining ' . PHP_EOL . print_r($remaining, true));
// \Illuminate\Support\Facades\Log::channel('custom_channel')->info('$interval ' . PHP_EOL . print_r($interval, true));
// \Illuminate\Support\Facades\Log::channel('custom_channel')->info('$body ' . PHP_EOL . print_r($body, true));
return $response;
}
/**
* @throws BadRequest
* @throws HubspotException
*/
public function createMeeting(array $payload): Response
{
$endpoint = '/crm/v3/objects/meetings';
return $this->makeRequest($endpoint, 'POST', $payload);
}
/**
* @throws BadRequest
* @throws HubspotException
*/
public function updateMeeting(string $meetingId, array $payload): Response
{
$endpoint = '/crm/v3/objects/meetings/' . $meetingId;
return $this->makeRequest($endpoint, 'PATCH', $payload);
}
/**
* @throws \Exception
*/
public function createNote(
string $body,
string $ownerId,
int $timestamp,
string $objectId,
NoteObject $noteObject
): ?string {
try {
$noteInput = new SimplePublicObjectInput([
'properties' => [
'hs_note_body' => $body,
'hubspot_owner_id' => $ownerId,
'hs_timestamp' => $timestamp,
],
]);
// Create note
$note = $this->getNewInstance()->crm()->objects()->basicApi()->create('note', $noteInput);
$this->getNewInstance()->crm()->objects()->associationsApi()->create(
'note',
$note->getId(),
$this->getNoteObject($noteObject),
$objectId,
$this->getNoteAssociationType($noteObject),
);
return $note->getId();
} catch (\Exception $e) {
$this->log->error('[Hubspot] Failed to create note', [
'objectId' => $objectId,
'noteObject' => $noteObject->getObjectType(),
'reason' => $e->getMessage(),
]);
\Sentry::captureException($e);
}
return null;
}
public function updateEngagement(string $objectId, array $engagement, array $metadata): void
{
$this->getInstance()->engagements()->update($objectId, $engagement, $metadata);
}
public function getEngagementData(string $engagementId): array
{
$engagement = $this->getInstance()->engagements()->get($engagementId);
return $engagement->toArray();
}
public function createEngagement(array $engagement, array $associations, array $metadata): Response
{
return $this->getInstance()
->engagements()
->create($engagement, $associations, $metadata);
}
public function isUnauthorizedException(\Exception $e): bool
{
// Check for specific HubSpot API exception types first
if ($e instanceof BadRequest) {
// BadRequest can contain 401 status codes
return $e->getCode() === 401;
}
// Check for HTTP client exceptions with status codes
if ($e instanceof \GuzzleHttp\Exception\RequestException && $e->hasResponse()) {
$response = $e->getResponse();
if ($response !== null) {
return $response->getStatusCode() === 401;
}
}
// Check for Guzzle HTTP exceptions
if ($e instanceof \GuzzleHttp\Exception\ClientException) {
return $e->getCode() === 401;
}
// Fallback to string matching as last resort, but be more specific
$message = strtolower($e->getMessage());
return str_contains($message, '401 unauthorized') ||
str_contains($message, 'http 401') ||
str_contains($message, 'status code 401') ||
(preg_match('/\b401\b/', $message) && str_contains($message, 'unauthorized'));
}
/**
* Validates and refreshes the access token if needed before API requests.
* This ensures long-running processes don't fail due to token expiration.
*
* @throws SocialAccountTokenInvalidException
*/
public function ensureValidToken(): void
{
if ($this->oauthAccount === null) {
return;
}
$newToken = $this->tokenManager->ensureValidToken($this->oauthAccount);
if ($newToken !== null) {
$this->accessToken = $newToken;
}
}
public function getConfig()
{
return $this->config;
}
// returns only active (archived=false)
public function getOwners(): array
{
return $this->getNewInstance()->crm()->owners()->getAll();
}
/**
* @param bool $archived
*
* @return array<Owner>|[]
*/
public function getOwnersArchived(bool $archived = true): array
{
$endpoint = '/crm/v3/owners';
$queryParams = [
'archived' => $archived ? 'true' : 'false',
];
$queryString = http_build_query($queryParams);
$owners = [];
try {
$response = $this->makeRequest(endpoint: $endpoint, queryString: $queryString);
$responseData = $response?->toArray();
foreach ($responseData['results'] as $result) {
try {
$owners[] = Owner::create($result);
} catch (Throwable $e) {
$this->log->error('[HubSpot] Failed to process owner data', [
'result' => $result,
'error' => $e->getMessage(),
]);
continue;
}
}
} catch (Throwable $e) {
$this->log->error('HubSpot] Failed to fetch owners', [
'archived' => $archived,
'error' => $e->getMessage(),
]);
return [];
}
return $owners;
}
public function getMeeting(string $engagementId): ObjectWithAssociations
{
return $this->getNewInstance()->crm()->objects()->basicApi()
->getById('meeting', $engagementId, null, 'contact,company,deal');
}
public function deleteEngagement(string $engagementId): void
{
$this->getInstance()->engagements()->delete((int) $engagementId);
}
public function getAssociationsData(array $ids, string $fromObject, string $toObject): array
{
$associationData = [];
$idChunks = array_chunk($ids, self::ASSOCIATIONS_BATCH_SIZE_LIMIT);
foreach ($idChunks as $idChunk) {
try {
$batchInput = new \HubSpot\Client\Crm\Associations\Model\BatchInputPublicObjectId();
$batchInput->setInputs(array_map(function ($id) {
$publicObjectId = new \HubSpot\Client\Crm\Associations\Model\PublicObjectId();
$publicObjectId->setId($id);
return $publicObjectId;
}, $idChunk));
$associatedObjectsData = $this
->getNewInstance()
->crm()
->associations()
->batchApi()
->read($fromObject, $toObject, $batchInput);
if ($associatedObjectsData instanceof \HubSpot\Client\Crm\Associations\Model\BatchResponsePublicAssociationMulti) {
foreach ($associatedObjectsData->getResults() as $association) {
$from = $association->getFrom()->getId();
$toAssociations = $association->getTo();
if (! empty($toAssociations)) {
$associationData[$from] = array_map(function ($item) {
return $item->getId();
}, $toAssociations);
}
}
}
// } catch (RateLimitException $e) {
// throw $e;
} catch (\Exception $e) {
$this->log->error('[Hubspot] Failed to fetch associations', [
'from_object' => $fromObject,
'to_object' => $toObject,
'reason' => $e->getMessage(),
]);
}
}
return $associationData;
}
/**
* @throws \Exception
*/
private function getNoteAssociationType(NoteObject $noteObject): string
{
return match($noteObject) {
NoteObject::Opportunity => 'note_to_deal',
NoteObject::Lead, NoteObject::Contact => 'note_to_contact', // or 'note_to_lead' if your portal supports it
NoteObject::Account => 'note_to_company',
NoteObject::Call, NoteObject::Event => throw new \Exception('Not supported'),
};
}
/**
* @throws \Exception
*/
private function getNoteObject(NoteObject $noteObject): string
{
return match($noteObject) {
NoteObject::Opportunity => 'deal',
NoteObject::Lead, NoteObject::Contact => 'contact',
NoteObject::Account => 'company',
NoteObject::Call, NoteObject::Event => throw new \Exception('Not supported'),
};
}
public function addAssociations(string $objectType, string $associationType, array $payload): Response
{
$endpoint = "/crm/v4/associations/$objectType/$associationType/batch/create";
return $this->makeRequest($endpoint, 'POST', $payload);
}
public function removeAssociations(string $objectType, string $associationType, array $payload): Response
{
$endpoint = "/crm/v4/associations/$objectType/$associationType/batch/archive";
return $this->makeRequest($endpoint, 'POST', $payload);
}
}
Sync Changes
Hide This Notification
Code changed:
Hide
19
Previous Highlighted Error
Next Highlighted Error
[2026-05-07 14:21:15] local.INFO: [Hubspot] DEBUG Getting headers {
"headers":{
"Date":["Thu,07 May 2026 14:21:15 GMT"],
"Content-Type":["application/json;charset=utf-8"],
"Transfer-Encoding":["chunked"],
"Connection":["keep-alive"],
"CF-Ray":["9f80deb8db60dc3a-SOF"],
"CF-Cache-Status":["DYNAMIC"],
"Strict-Transport-Security":["max-age=31536000; includeSubDomains; preload"],
"Vary":["origin,
accept-encoding"],
"access-control-allow-credentials":["false"],
"server-timing":["hcid;desc=\"019e02d0-6fd8-7812-bdba-885b7ccb3ee3\",
cfr;desc=\"9f80deb8e7c6dc3a-IAD\""],
"x-content-type-options":["nosniff"],
"x-hubspot-correlation-id":["019e02d0-6fd8-7812-bdba-885b7ccb3ee3"],
"Set-Cookie":["__cf_bm=SIUrtdQgXVrik50pdqF6hZVYKhzTnQBidvMabeCtm0Y-1778163675-[IP_ADDRESS]-rI.ZggtDKxTge5zr8_2gbBfWMQQ.ufZEXDZyHz2mBUFdzdo2gTHEsOkXMSEShjK0hGYxNhUGM1ZoBpX7BcFZcHEjA7Cs_.SMUhUnd2nYjko; path=/; expires=Thu,
07-May-26 14:51:15 GMT; domain=.hubapi.com; HttpOnly; Secure; SameSite=None"],
"Report-To":["{
\"endpoints\":[{
\"url\":\"https:\\/\\/a.nel.cloudflare.com\\/report\\/v4?s=NYAlsVTP0fYm32qrSDjxYE4sd2RWRqiSp3wHsmdEgZlzoYdxI%2BIxVpHmsKn3O%2BKVA3mFIJ2m7YRECDGSM%2BW2IYTzo6FM4%2BdUIjURO8srzKSvJgZ%2BQ6R79arKQw3uHLlX\"}],
\"group\":\"cf-nel\",
\"max_age\":604800}"],
"NEL":["{
\"success_fraction\":0.01,
\"report_to\":\"cf-nel\",
\"max_age\":604800}"],
"Server":["cloudflare"]}} {
"correlation_id":"95236535-ec98-4541-b92a-adfa73b69eab",
"trace_id":"c7ab8365-903f-46d4-9403-0e5b551e3545"}
Project
Project
New File or Directory…
Expand Selected
Collapse All
Options
Hide...
|
PhpStorm
|
faVsco.js – Client.php
|
NULL
|
15429
|
|
15428
|
Firefoxlah|+FileEditViewHistoryBookmarksProfilesTo Firefoxlah|+FileEditViewHistoryBookmarksProfilesToolsWindowHelpmeet.google.com/mie-gawc-dsi?authuser=[EMAIL] Yankov (Presenting)Platform Team %.Q Search boardA.J Panorama for CallScoring n oo(AUTOMATED AI SCORINGKowyorwA Jy-20361Setup test coverage forPTocnorichetMAINTENANCEBacklogE 3-19951C Jy 20457 Servic83 Jmier83 PromeO Attent0 Calis -Ca Transp* Caude© Jmin:L HoectEal Datadoo&Sentry0 1a5sy-16322 / E JY-18001@4|Upgrade to PHP 8.5inDeyy12 Emprove Tecnnical Story~ Description~ DetailsBranchInitial ReleaseActive Support UntilSecurity Support Untll23 Nov 202331 Dec 202531 Dec 2027AssigneeNikolay Ivanor|Assign to me21 Nov 202431 Dec 202631 Dec 202831 Dec 202731 Dec 2029KaDort@ Martin PeckovDevelooment)Currenty the Jiminny app is on PHP 8.3 which is 2 versions behind the latest one. It is atready stable as was reieasedcouple of months ago, so please proceed with an update.Hore are Migration Guides:• E PHP: Migrating from PHP 8.3.x to PHP 8.4x - Marual• E PHP: Migrating from PHP 8.4 x 10 PHP 8.5x - MarualQ Open with VS Code2 branches|10 commits1 pull request1 buildSubtasksComponentsPlatformLinked work itemsAdd optionsLabelsACKIVILY9:49 AM | Daily - PlatformLộ383 МCP3 days aoc.OPENC DewDaily - Platform - now100% LMon 11 May 9:49:28• appіo:La Al Bookmarxs9Nikolay IvanovNikolay YankovAI Reports > Empty pageceehheeeeeoenAJREPORTSDeployed-20372 1 12 ••**=JrOK VS ALUICDeployedД -20726 1 0 •00=Allow users to delete SSand Panorama promptswhen those are used in a...AkrokiaDeployed0 -2070 119000Release AJ PanoramaAJREPORTSDeployedR -20740 05 11 .*0:summary in the CRM...4 othersAneliya AngelovaLukas Kovalik1:02...
|
PhpStorm
|
faVsco.js – Client.php
|
NULL
|
15428
|
|
15427
|
Project: faVsco.js, menu
JY-20725-handle-HS-search Project: faVsco.js, menu
JY-20725-handle-HS-search-rate-limit, menu
PhostormVIewINavicareCodeFV faVsco.js°9 JY-20725-handle-HS-search-rate-limroledey© BatchSyncCollectolyhuospotsyncstrategybase.ongCachedcrmservicebecorator.onp© ProspectCache.phpe balchsynckealsseС Cпескапокetrукemotematch.ongccloseaDealstagess @ MatchacuivitycrmData.ong© ermactivilyservice.phgDealrielasservice.gc)Decorateacuivilv.or© FieldDefinitions.phrclass Cllent extends Baseclient 1mpLements HubspotcllentintertaceM |A2 A65 X1X1AC) FieldT vpeconvertee Hubspotclientinterc) Hubspotlokenman© PayloadBuilder.phpC) RemotecrmobiectnP ResponseNormalizec) Service,onoC)SvncFieldAction.onC) SvncRelatedActivitC) WebhookSvncBatclv MintearationAorM Accaccors)• D ConfigD DTO• M SiltersJobs• M ProcnectSearchStr.W service lralts© DataClient.php© DecorateActivity.phc Localsearch.oneu LocalSearchintertac© RemoteSearch.phpc) Service.phpv W Listeners© ConvertLeadActivitc) PurceLookuocache> M Metadata> Miarationa Pioedrivev Salesforce• D Fields• M OnnortunitvMatcheMOnnortunitvSvneSt897 (M ProsneetSearchStr.M ServiceTraitcC) Client nhr© DecorateActivity.ph. Delete@biectsTrait© FieldDefinitions.php© PayloadBuilder.php© Profile.php© QueryBuilder.phpououc tunction 1sunauthorizedzxcentionExcentionse: 000ureturn str contains(Smessage. "401 unauthorized')Istr contains(Smessage..'http 401') |1str_contains(Smessage, 'status code 401') |(orea match( pattern: • /\b401\b/' Smessage) &s str contains(Smessage, 'unauthorized')):* Validates and refreshes the access token if needed before API requests.* This ensures long-running processes don't fail due to token expiration.* @throws SocialAccountTokenInvalidExceptiony usagespublic function ensureValidToken: voidif (Sthis->oauthAccount === null) {Snewloken = sthis->tokenmanaqer->ensureval1dloken(sth1s->oauthaccountrif (SnewToken !== null) {sthis-›accessloken = snewloken:public function getConfigoreturn Sthis->confia:returns onlv active (archived=false)9 usadespublic function get0wners: arrayreturn $this->getNewInstance()->crm()->owners()->getALL();* apanam bool Sarchived* dreturn arrau<ownens/r71s usages40 lDally - Platrorm • now100% 4 • Mon 11 May 9:49:26U AskJiminnyReportActivityServiceTest v+0 ..11 1l1III=custom.log ^=laravel.logA SF (jiminny@localhost]4 HS_local (jiminny@localhost]# console [PKOb.# console leu)# console [slAGiNg)[2026-05-07 14:21:15] local.INF0: [Hubspot] DEBUG Getting headers {W19 ^V"neaders".?"Uace":L"Inu,or May 2020 14.21.15 6Ml"Jn"Transter-Encod1nq":"chunked")."Connection":"keep-alive""CF-Ray" : ["9f80deb8db60dc3a-SOF"],"Strict-Transport-Secur1ty":"max-aqe=31536008* 1ncludeSubDomains: preload")naccent-encodino""access-control-allow-credentials": ["false"]."server-timing": ["hcid;desc=\"019e02d0-6fd8-7812-bdba-885b7ccb3ee3\","x-hubspot-correlation-id":["019e02d0-6fd8-7812-bdba-885b7ccb3ee3"],"So+-Cookie"." c+hm-Stlirtd0aXVr.kSandas6hzVVKhzTn0BidvMaheCtm0V-1778163675-1.0.107-May-26 14:51:15 GMT; domain=.hubapi.com; Http0nly; Secure; SameSite=None"],"Renont-To"."","endpoints\":[{"unl".httns:a.nel.cloudflane.com./nenon+|W/v42c=NVA1cVTPQfVm32anS0ixVF/sd2RI\"group)":\"cf-nel\","max_age\":604800}"],"NEL":["{\"success_fraction\":0.01,reportto. "cr-nel,"max age":604800}"]"Server": ["cloudflare"]}} {"correlation_1d":"95256555-ec98-4541-b9za-adta/Sb6Yeab","trace_10":"C/AD8565-905t-4604-9405-0e50551e5545I IIllC;CascadeHubspot Rate Limit Reif (Sretry) {sleenab:return $this->searchCallsForPeriodByPage($from, $to, $page, false);return null;Why this is now broken/suboptimal with the new client1. Covehes Encef lint Couk Be 1,0, o.) l tecuro d: we aiays sCcep ion that The now clioni carefly consirveted win rety after fiom headers in2. For tng ie eae a mpy. The mont cen meon tw eslor potiea ehe Ail oer ert - e oat , t agoia os im rninco tf aloe eaty and tee siently3. The Sretry = false recursive flaa is fragile. Once we pass retrvefalse. on the second 429 we just return null without distinguishing rate limit from reaSuggestionCatch Ratel imitFycention cnecificallv and uco detRetrvifterd.D phppublic function searchCallsForPeriodByPage(Carbon strom, Carbon sto, int Spage, int sretries = 2)trydSpay Load = Sthis->payLoadbu1lder->generatesearchcaulsByPer1odPayLoad(Strom, Sto, Spage);return sthis->client->search'cals". Soavload):} catch (RateLimitException $e) {throw se: // hubble un: caller decidec whether to fail the imnort or releace the iohlsleen min Se->aetRetrvAftero, 30)):return $this->searchCallsForPeriodByPage($from, $to, $page, $retries - 1);} catch (Exception Sexception)$this->logger->info('(HubSpot) Search calls for period failed', (...]);recurh nuet;only swallow non-rate-limit Tallures as beroreEven better — if searchCallsForPeriod is called from a queued job (which it typically is for backfills), don't swallow at all. Let RateLimitException bubble to thejob middleware (HandleHubspotRateLimit), which already handles release-with-delay properly. The in-process sleep() wastes a worker for up to 30s and ties upHorizon throughput.Let me check if it's job-driven:Coorchod co!JingURLToken in app (.php) (5)Both callers are backaround workflows (a Console command and an internal service). So letting RateLimitException bubble to the iob middleware is the cleanestanswer - drop the sleep(1) retry path entirely and rely on HandleHubspotRateLimit:: release(Sdelay)TL:DR for #2: the sleep(1) predates the new structured exception. Either:• Catch RateLimitException and use getRetryAfter() (replace blind sleep(1) ), orLet it bubble to the job middleware and delete the in-process retry - preferred3. Whv matchExactlvBvEmail() Has No Rate Limit HandlinaCalle(erch d lstorPero itnypase/secrchdll ferpernod searchCalt9 eo dinguiLToten) in tnat rasie e vilt oniy tre 8 2i eas tre ered torm÷ « Code802•6UTF.8Po 4 spaces...
|
PhpStorm
|
faVsco.js – Client.php
|
NULL
|
15427
|
|
15426
|
FirefoxFileEditViewHistoryBookmarksProfilesToolsWi FirefoxFileEditViewHistoryBookmarksProfilesToolsWindowHelplah|Daily - Platform - now100% L2Mon 11 May 9:49:23meet.google.com/mie-gawc-dsi?authuser=[EMAIL] Yankov (Presenting)9+SPlatform Team %Q Suaren boareA.J Panorama far CallScoting a coENITOMITEN AT BCOGMgedytorwereQ JY-2U301Setup test coverage forProphet in SonarMAINTAMANCESackiogE Jr-soneeas=C Jy2051 Servic@ Planha83 Jmier83 Promehttps://fiminny.atlassian.net/jira/software/c/projects/JY/boards/37?sejectedissue=JY-18091D Hooct801§ sy-16322 / E JY-18001Upgrade to PHP 8.5DescriptionBranchInkial ReleaseActive Support UntilSecurity Support Unti23 Nov 202331Dec 202531 Dec 202721 Nov 202431 Dec 202631 Dec 202831 Dec 202731 Dec 2029Curtenty the Jiminny app is on PHP 8.3 which is 2 versions behind the latest one. It is already stable as was reieasedcoupe of months ago, so please proceed with an update.Here are Migration Guides:•АРНР: МИrЬО tо PИг Б.SХ1о PИР 8.4К- Мага• E3 PHP: Migraning from PHP B.4.x 10 PHP 8.5.x - MaryoalSubtasksLinked work itemsAOtCOd wEKAOACUIVILYO AltenoC Calis -0 AttenCa Transe* Ciaude© smin:El Datacon* Cauón• arcelSentryCo TaiaIn Devk Improve Technical Story~ DotailsAssignee•Nikciay IvanowAssign to meKeoortO Martin PeticvDevelopmient@ Open with VS Code2 branches10 commits1 pull request1 buildComponentsPtatformAdd optionsLabeis83 МСР• snol•appіaD DesL Al BookmarxsNikolay IvanovNikolay YankovAl Reports » Empty page0es 9n sna promobenDepioyedR -20172 1i 1l чммя =acmaureDepiogedQ -30728 113Allun users 10 deiete SSand Panorama promptswhen those are used in a.мEDRETDepioyedReteace AJ PanoraenaО -3040 ВД 1Д чмляsummary in the CRM•..4 othersAneliya Angelova3.abys.290OPEN9:49 AM | Daily - PlatformLukas Kovalik• 0:56Lộ3...
|
Notion Calendar
|
NULL
|
NULL
|
15426
|
|
15425
|
FV faVsco.js°9 JY-20725-handle-HS-search-rateroled FV faVsco.js°9 JY-20725-handle-HS-search-rateroledey© BatchSyncCollectolyhuospotsyncstrategybase.ongCachedcrmservicebecorator.onp© ProspectCache.phpe balchsynckealsseС Cпескапокetrукemotematch.ongc clientoneccloseaDealstagess @ MatchacuivitycrmData.ong© ermactivilyservice.phgDealrielasservice.gc)Decorateacuivilv.or© FieldDefinitions.phrclass Cllent extends Baseclient 1mpLements Hubspotcllentintertace- A2 A65 X1X1 ~C) FieldT vpeconvertee Hubspotclientinterc) Hubspotlokenman© PayloadBuilder.phpC) RemotecrmobiectnP ResponseNormalizec) Service,onoC)SvncFieldAction.onC) SvncRelatedActivitC) WebhookSvncBatclv MintearationAorM Acceccors• D ConfigD DTO• M SiltersJobs• M ProcnectSearchStr.W service Iralts© DataClient.php© DecorateActivity.phcLocalsearch.oneu LocalSearchintertac© RemoteSearch.phpc) Service.phpv W Listeners© ConvertLeadActivitc) PurceLookuocache> M Metadata> Miarationa Pioedrivev Salesforce• D Fields• M OnnortunitvMatcheMOnnortunitvSvneSt897 (> M ProsnectSearchStr:M ServiceTraitcC) Client nhr© DecorateActivity.ph. Delete@biectsTrait© FieldDefinitions.php© PayloadBuilder.php© Profile.php© QueryBuilder.phpououc tunction 1sunauthorizedzxcentionExcentionse: 000ureturn str contains(Smessage. "401 unauthorized')Istr contains(Smessage.'http 401') |1str_contains(Smessage, 'status code 401') |(orea match( pattern: • /\b401\b/' Smessage) &s str contains(Smessage, 'unauthorized')):* Validates and refreshes the access token if needed before API requests.* This ensures long-running processes don't fail due to token expiration.* @throws SocialAccountTokenInvalidExceptiony usagespublic function ensureValidToken: voidif (Sthis->oauthAccount === null) {Snewloken = sthis->tokenmanaqer->ensureval1dloken(sth1s->oauthaccountrif (SnewToken !== null) {sthis-›accessloken = snewloken:public function getConfigoreturn Sthis->confia:returns onlv active (archived=false)9 usadespublic function get0wners: arrayreturn $this->getNewInstance()->crm()->owners()->getALL();* apanam bool Sarchived* dreturn arrau<ownens/rn1s usages>0 Ih| • | Daily - Platform -100% • Mon 11 May 9.49.20AskJiminnyReportActivityServiceTest+0 ..11 1l1III=custom.log ^=laravel.logA SF (jiminny@localhost]4 HS_local (jiminny@localhost]# console [PKob.# console leu)# console [slAGiNG)[2026-05-07 14:21:15] local.INF0: [Hubspot] DEBUG Getting headers {"neaders".?"Uace":L"Inu,or May 2020 14.21.15 6Ml"Jn"Transter-Encod1nq":"chunked")."Connection":"keep-alive"]"CF-Ray" : ["9f80deb8db60dc3a-SOF"],"Strict-Transport-Secur1ty":"max-aqe=31536008* 1ncludeSubDomains: preload")naccent-encodino""access-control-allow-credentials": ["false"]."server-timing": ["hcid;desc=\"019e02d0-6fd8-7812-bdba-885b7ccb3ee3\","x-hubspot-correlation-id":["019e02d0-6fd8-7812-bdba-885b7ccb3ee3"],"So+-Cookie"." c+hm-Stlirtd0aXVr.kSandas6hzVVKhzTn0BidvMaheCtm0V-1778163675-1.0.107-May-26 14:51:15 GMT; domain=.hubapi.com; Http0nly; Secure; SameSite=None"],"Renont-To"."","endpoints\":[{"unl".httns:a.nel.cloudflane.com./nenon+|W/v42c=NVA1cVTPQfVm32anS0ixVF/sd2RI"group\":\"cf-nel\","max_age\":604800}"],"NEL":["{\"success_fraction\":0.01,reportto. "cr-nel,"max age":604800}"]"Server": ["cloudflare"]}} {"correlation_1d":"95256555-ec98-4541-b9za-adta/Sb6Yeab","trace_10":"C/AD8565-905t-4604-9405-0e50551e5545I IIllC;CascadeHubspot Rate Limit ReW19 ^Vif (Sretry) {sleenab:return $this->searchCallsForPeriodByPage($from, $to, $page, false);return null;Why this is now broken/suboptimal with the new client1. Covehes Encef lint Couk Be 1,0, o.) l tecuro d: we aiays sCcep ion that The now clioni carefly consirveted win rety after fiom headers in2. For tng te eage a mpy. The mont cen meon tweslor notsea th lil oer eit o - en oat , t aoi, od in trniscont aloe atry andtee siently3. The Sretry = false recursive flaa is fragile. Once we pass retrvefalse. on the second 429 we just return null without distinguishing rate limit from reaSuggestionCatch Ratel imitFycention cnecificallv and uco detRetrvifterd.D phppublic function searchCallsForPeriodByPage(Carbon strom, Carbon sto, int Spage, int sretries = 2)trydSpay Load = Sthis->payLoadbu1lder->generatesearchcaulsByPer1odPayLoad(Strom, Sto, Spage);return sthis->client->search'cals". Soavload):} catch (RateLimitException $e) {throw se: // hubble un: caller decidec whether to fail the imnort or releace the iohlsleen min Se->aetRetrvAftero, 30)):return $this->searchCallsForPeriodByPage($from, $to, $page, $retries - 1);} catch (Exception Sexception)$this->logger->info('(HubSpot) Search calls for period failed', (...]);recurh nuet;only swallow non-rate-limit Tallures as beroreEven better — if searchCallsForPeriod is called from a queued job (which it typically is for backfills), don't swallow at all. Let RateLimitException bubble to thejob middleware (HandleHubspotRateLimit), which already handles release-with-delay properly. The in-process sleep() wastes a worker for up to 30s and ties upHorizon throughput.Let me check if it's job-driven:Coorchod co!JingURLToken in app (.php) (5)Both callers are backaround workflows (a Console command and an internal service). So letting RateLimitException bubble to the iob middleware is the cleanestanswer - drop the sleep(1) retry path entirely and rely on HandleHubspotRateLimit:: release(Sdelay)TL:DR for #2: the sleep(1) predates the new structured exception. Either:• Catch RateLimitException and use getRetryAfter() (replace blind sleep(1) ), orLet it bubble to the job middleware and delete the in-process retry - preferred3. Whv matchExactlvBvEmail() Has No Rate Limit HandlinaCalle(erch d lstorPero itnypase/secrchdll forpernod searchCalt9 eo dinguiLToten) in that casie e vilt oniy tre 8 2i eas tre ered tormio 4 spa...
|
Notion Calendar
|
NULL
|
NULL
|
15425
|
|
15424
|
FirefoxProfilesToolsWindow(abl+FileEditViewHistory FirefoxProfilesToolsWindow(abl+FileEditViewHistoryBookmarksHelp→meet.google.com/mie-gawc-dsi?authuser=[EMAIL] Yankov (Presenting)C Jy 20451 Servic83 Jmien83 PromsO Attent0 Calls -0 AttenCa TranspJmine* MCPID HogoctиEl Datadog* ClaudeСrоeoSentryPlatform Team %Q Search boardsY-16322 / E JY-18001@4|Upgrade to PHP 8.5XneyyAJ Panorama for CallScoring n 00(AUTOMATED AT SGORINGKeddy torwoyA Jy-20301K& Improve Technical StoryDescriptionDetailsBranchInitial ReleaseActive Support UntilSecurity Support UntlSetup test coverage forProonoricherMAINTENANCSBacklogE 3-109511****=23 Nov 202331 Dec 202531 Dec 2027AssigneeNikolay Ivanow|Assign to me21 Nov 202431 Dec 202631 Dec 202731 Dec 2029@ Martin PeckovDeveloomentCurrenty the Jiminny app is on PHP 8.3 which is 2 versions behind the latest one. It is atready stabie as was reieasedcouple of months ago, so please proceed with an update.Here are Migration Guides:• PHP: Migrating from PHP 8.3.x to PHP 8.4x - Manual• PHP: Migrating from PHP 8.4.x 10 PHP 8.5x - MacualQ Open with VS Code2 branches|10 commits1 pull request1 build3 days agoSubtasksComponentsPlatformLinked work itemsAdd optionsLabelsACKIVILY9:49 AM | Daily - PlatformLộ3C Der| Daily - Platform • now100% <478• Mon 11 May 9:49:20• эррібкL Al Bookmarxs9=Nikolay IivanovNikolay YankovAI Reports > Empty pagedesign and promotonAJ REPORTSDeployed20372 1 0000 =JrOK Và AZUICDeployedД 20726 1 0 •+0=Allow users to delete SSand Panorama promptswhen those are used in a...AJREPORTSDeployed0 - 207701 8 •000=Release AJ PanoramaAJREPORTSDeployed0 -20740 05 1) ..00:summary in the CRM...4 othersAneliya AngelovaLukas Kovalik0:54...
|
Notion Calendar
|
NULL
|
NULL
|
15424
|
|
15423
|
Meet - Daily - Platform
Close tab
New Tab
Open Goo Meet - Daily - Platform
Close tab
New Tab
Open Google Gemini (⌃X)
Tabs from other devices
Open history (⇧⌘H)
Open bookmarks (⌘B)
Customize sidebar
Nikolay Yankov (Presenting)
Nikolay Yankov (Presenting)
People
9
Take notes with Gemini
Take notes with Gemini
Gemini
Gemini...
|
Firefox
|
Meet - Daily - Platform — Work
|
meet.google.com/mie-gawc-dsi?authuser=lukas.kovali meet.google.com/mie-gawc-dsi?authuser=lukas.kovalik@jiminny.com...
|
15423
|
|
15422
|
Meet - Daily - Platform
Close tab
New Tab
Open Goo Meet - Daily - Platform
Close tab
New Tab
Open Google Gemini (⌃X)
Tabs from other devices
Open history (⇧⌘H)
Open bookmarks (⌘B)
Customize sidebar
Nikolay Yankov (Presenting)
Nikolay Yankov (Presenting)
People
9
Take notes with Gemini
Take notes with Gemini
Gemini
Gemini
Pop out this video More screens are more fun. Play this video while you do other things.
Pop out this video
More screens are more fun. Play this video while you do other things.
Zoom in
Open in new window
Enter Full Screen
Pop out this video More screens are more fun. Play this video while you do other things.
Pop out this video
More screens are more fun. Play this video while you do other things.
Nikolay Ivanov
Pop out this video More screens are more fun. Play this video while you do other things.
Pop out this video
More screens are more fun. Play this video while you do other things.
Nikolay Yankov
Pop out this video More screens are more fun. Play this video while you do other things.
Pop out this video
More screens are more fun. Play this video while you do other things.
Aneliya Angelova
User profile picture User profile picture 4 others
4 others
Pop out this video More screens are more fun. Play this video while you do other things.
Pop out this video
More screens are more fun. Play this video while you do other things.
Lukas Kovalik
Others might see more of your background. Click to view your full video.
9:49
AM
Daily - Platform
Daily - Platform
Audio settings
Turn on microphone
Video settings
Turn off camera
Nikolay Yankov is presenting
Send a reaction
Turn on captions
Raise hand (ctrl + ⌘ + h)
More options
Leave call
Meeting details
Chat with everyone
Meeting tools
Your microphone is off....
|
Firefox
|
Meet - Daily - Platform — Work
|
meet.google.com/mie-gawc-dsi?authuser=lukas.kovali meet.google.com/mie-gawc-dsi?authuser=lukas.kovalik@jiminny.com...
|
15422
|
|
15421
|
Meet - Daily - Platform
Close tab
New Tab
Open Goo Meet - Daily - Platform
Close tab
New Tab
Open Google Gemini (⌃X)
Tabs from other devices
Open history (⇧⌘H)
Open bookmarks (⌘B)
Customize sidebar
Nikolay Yankov (Presenting)
Nikolay Yankov (Presenting)
People
9
Take notes with Gemini
Take notes with Gemini
Gemini
Gemini
Pop out this video More screens are more fun. Play this video while you do other things.
Pop out this video
More screens are more fun. Play this video while you do other things.
Zoom in
Open in new window
Enter Full Screen
Pop out this video More screens are more fun. Play this video while you do other things.
Pop out this video
More screens are more fun. Play this video while you do other things.
Nikolay Ivanov
Pop out this video More screens are more fun. Play this video while you do other things.
Pop out this video
More screens are more fun. Play this video while you do other things.
Nikolay Yankov
Pop out this video More screens are more fun. Play this video while you do other things.
Pop out this video
More screens are more fun. Play this video while you do other things.
Aneliya Angelova
User profile picture User profile picture 4 others
4 others
Pop out this video More screens are more fun. Play this video while you do other things.
Pop out this video
More screens are more fun. Play this video while you do other things.
Lukas Kovalik
Others might see more of your background. Click to view your full video.
9:49
AM
Daily - Platform
Daily - Platform...
|
Firefox
|
Meet - Daily - Platform — Work
|
meet.google.com/mie-gawc-dsi?authuser=lukas.kovali meet.google.com/mie-gawc-dsi?authuser=lukas.kovalik@jiminny.com...
|
15421
|
|
15420
|
Meet - Daily - Platform
+FirefoxProfilesTools(abl$ Meet - Daily - Platform
+FirefoxProfilesTools(abl$FileEditViewHistoryBookmarksWindowHelp→meet.google.com/mie-gawc-dsi?authuser=[EMAIL] Yankov (Presenting)C Jy20Y1 Servic83 Snin83 PromeO Astent0 Cals -0 AtenCa Transp*0$0000© Jmin:83 МCP0 Jninhttps://jminny.atlassian.net/jira/software/c/projects/JY/boards/37?selectedissue=JY-18091C ProjectsE3 SSH16 E Datadog © © * Cavde9 CirclechSentry *XL lasInsights & Coachin0 DerPlatform Team %Q Searen boara§ sY-16322 / JY-18001@4|Graup: QueriasUpgrade to PHP 8.5A.J Panorama for CallScoring in OD(MITOMATED AT SICORINGReady for Dev1 Jy-20301Ki Improve Technical Story~ Description~ DetailsAI Reports > Empty pagedesign and promotonAJREPORTSDepioyedД -20372 Е П •***=BranchInitial ReleaseActive Support UntilSecurity Support UntilSetup test coverage forProphet in SonarMASNTENANGIBacklog1Y-1905123 Nov 202331 Dec 202531 Dec 2027AssigneeNikolay Ivanow|Assign to meSICA Va ALUIC21 Nov 202431 Dec 202631 Dec 202831 Dec 202731 Dec 2029Keoort3 Martin PeckovDeployed0 -20726 |3 •** =Curtenty the Jiminny app is on PHP 8.3 which is 2 versions behind the latest one. It is aiready stable as was reieasedcoupte of months ago, so please proceed with an update.Here are Migration Guides:•АРНР. Матсоnо ноm рИr Б.5010 PИР 0.4.X * Mamus• # PHP: Migrating from PHP 8.4.x to PHP 8.5x - ManualDevelopment@ Open with VS Code2 branches10 commits1 pull request1 build3.dtys.agoAton users t0 doieto SSand Panorama promptswhen those are used in aAіRIRONTяDeployed02070 1 T1 ***SubtasksComponentsPlatformReiease A.J PanoramaLinked work itemsAottnacdweeAdd optionsLabeissummary in tha CRMACUVISY| Daily - Platform • now100% <478• Mon 11 May 9:49:069=Mon 11 May 9:49L Al BookmarxsNikolay IyanoyNikolay Yankov4 othersAneliya Angelova9:49 AM | Daily - PlatformLộ3Lukas Kovalik0:39...
|
Firefox
|
Meet - Daily - Platform — Work
|
meet.google.com/mie-gawc-dsi?authuser=lukas.kovali meet.google.com/mie-gawc-dsi?authuser=lukas.kovalik@jiminny.com...
|
15420
|
|
15419
|
Meet - Daily - Platform
Close tab
New Tab
Open Goo Meet - Daily - Platform
Close tab
New Tab
Open Google Gemini (⌃X)
Tabs from other devices
Open history (⇧⌘H)
Open bookmarks (⌘B)
Customize sidebar
Nikolay Yankov (Presenting)
Nikolay Yankov (Presenting)
People
9
Take notes with Gemini
Take notes with Gemini
Gemini
Gemini
Pop out this video More screens are more fun. Play this video while you do other things.
Pop out this video
More screens are more fun. Play this video while you do other things.
Zoom in
Open in new window
Enter Full Screen
Pop out this video More screens are more fun. Play this video while you do other things.
Pop out this video
More screens are more fun. Play this video while you do other things.
Nikolay Ivanov
Pop out this video More screens are more fun. Play this video while you do other things.
Pop out this video
More screens are more fun. Play this video while you do other things.
Nikolay Yankov
Pop out this video More screens are more fun. Play this video while you do other things.
Pop out this video
More screens are more fun. Play this video while you do other things.
Aneliya Angelova
User profile picture User profile picture 4 others
4 others
Pop out this video More screens are more fun. Play this video while you do other things.
Pop out this video
More screens are more fun. Play this video while you do other things.
Lukas Kovalik
Others might see more of your background. Click to view your full video.
9:49
AM
Daily - Platform
Daily - Platform
Audio settings
Turn on microphone
Video settings
Turn off camera
Nikolay Yankov is presenting
Send a reaction
Turn on captions
Raise hand (ctrl + ⌘ + h)
More options
Leave call
Meeting details
Chat with everyone
Meeting tools
Your microphone is off....
|
Firefox
|
Meet - Daily - Platform — Work
|
meet.google.com/mie-gawc-dsi?authuser=lukas.kovali meet.google.com/mie-gawc-dsi?authuser=lukas.kovalik@jiminny.com...
|
15419
|
|
15418
|
Meet - Daily - Platform
Close tab
New Tab
Open Goo Meet - Daily - Platform
Close tab
New Tab
Open Google Gemini (⌃X)
Tabs from other devices
Open history (⇧⌘H)
Open bookmarks (⌘B)
Customize sidebar
Nikolay Yankov (Presenting)
Nikolay Yankov (Presenting)
People
9
Take notes with Gemini
+FirefoxTools(ablSFileEditViewHistoryBookmarksProfilesWindowHelp→meet.google.com/mie-gawc-dsi?authuser=[EMAIL] Yankov (Presenting)*C Jy 204Servid83 Jmier8 PromoO Altent0 Cals -Ca Transp* MCPIhttps://fiminny.atlassian.net/jira/software/c/projects/JY/boards/37?selectedissue=JY-20818Ea Datadog* Caude9 CirclechSentry*xIL lasк0 Der|Platform Team %.Q Search board06§ SY-19240 / I0E [EMAIL] Ask Jiminny reports to separated datadog metric57 Improve BugA.J Panorama for CallScoring n ou(AUTOMATEO AT SGORINGKewytorDVД 3y-20361Details25 •***= 3~ Key detailsDescriptionEdit descriptionSetup test coverage forProphet in SonarMASNTENANCIESBacklogE 39-10951otets toruprouusewonelAssignee #® Lukas Kovallk|Assion.1e mgReporter2 Lukas Kovailknctuds outcouneAdd textExpected outcomeAdd textSubtasksAdd subtaskDevelopmentQ Open with VS CodeJ Create branch3 commits1 pull request2 bullds3 days agoMEROLOwinxwXAdd linked work iterActivitvAdd optionsStory PolntsCan I get more info...?Status update..Thanks.Organisations| Daily - Platform • now100% <478• Mon 11 May 9:48:519Mon 11 May 9:48О aрpіскL Al BookmarksGroup: QueriesAI Reports > Empty pagedesign and promodonAJ REPORTSDeployed0 -20572 (10 11 **** = ®GrCK Và AZUre-20726 1 • •***=Allow users to deiete SSand Panorama promptswhen those are used in a...AJREPORTSDeployed0 -207201 12 .000=Reiease AJ PanoramaAJREPORTSDeployedR -20740 05 11 .**0=summary in the CRMNikolay IvanovNikolay YankovSUTLE4 othersAneliya Angelova9:48 AM | Daily - PlatformLukas Kovalik• 0:25Lộ3...
|
Firefox
|
Meet - Daily - Platform — Work
|
meet.google.com/mie-gawc-dsi?authuser=lukas.kovali meet.google.com/mie-gawc-dsi?authuser=lukas.kovalik@jiminny.com...
|
15418
|
|
15417
|
Meet - Daily - Platform
Close tab
New Tab
Open Goo Meet - Daily - Platform
Close tab
New Tab
Open Google Gemini (⌃X)
Tabs from other devices
Open history (⇧⌘H)
Open bookmarks (⌘B)
Customize sidebar
Nikolay Yankov (Presenting)
Nikolay Yankov (Presenting)
People
9
Take notes with Gemini
Take notes with Gemini...
|
Firefox
|
Meet - Daily - Platform — Work
|
meet.google.com/mie-gawc-dsi?authuser=lukas.kovali meet.google.com/mie-gawc-dsi?authuser=lukas.kovalik@jiminny.com...
|
15417
|
|
15416
|
Meet - Daily - Platform
Close tab
New Tab
Open Goo Meet - Daily - Platform
Close tab
New Tab
Open Google Gemini (⌃X)
Tabs from other devices
Open history (⇧⌘H)
Open bookmarks (⌘B)
Customize sidebar
Nikolay Yankov (Presenting)
Nikolay Yankov (Presenting)
People
FV faVsco.js°9 JY-20725-handle-HS-search-rateroledey© BatchSyncCollectolyhuospotsyncstrategybase.ongCachedcrmservicebecorator.onp© ProspectCache.phpe balchsynckealsseС Cпескапокetrукemotematch.ongc clientonec closeaDealstagess @ MatchacuivitycrmData.ong© ermactivilyservice.phgDealrielasservice.gc)Decorateacuivilv.or© FieldDefinitions.phrclass Cllent extends Baseclient 1mpLements HubspotclientintertaceM A2 A65 X1X1 AC) FieldT vpeconvertee Hubspotclientinterc) Hubspotlokenman© PayloadBuilder.phpC) RemotecrmobiectnP ResponseNormalizec) Service,onoC)SvncFieldAction.onC) SvncRelatedActivitC) WebhookSvncBatclv MintearationAorM AcceccorsConfigD DTO• M SiltersJobs• M ProcnectSearchStr.W service Iralts© DataClient.php© DecorateActivity.phcLocalsearch.oneu LocalSearchintertac© RemoteSearch.phpc) Service.phpv W Listeners© ConvertLeadActivitc) PurceLookuocache> M Metadata> Miarationa Pioedrivev Salesforce• D Fields• M OnnortunitvMatcheMOnnortunitvSvneSt897 (> M ProsnectSearchStr:M ServiceTraitcC) Client nhr© DecorateActivity.ph. Delete@biectsTrait© FieldDefinitions.php© PayloadBuilder.php© Profile.php© QueryBuilder.phpoubuc tunction 1sunauthorizedzxcention Excention se: 000ureturn str contains(Smessage. "401 unauthorized')Istr contains(Smessage.'http 401') |1str_contains(Smessage, 'status code 401') |(orea match( pattern: • /\b401\b/* Smessage) &s str contains(Smessage. 'unauthorized')):* Validates and refreshes the access token if needed before API requests.* This ensures long-running processes don't fail due to token expiration.* @throws SocialAccountTokenInvalidExceptiony usagespublic function ensureValidToken: voidif (Sthis->oauthAccount === null) {Snewloken = sthis->tokenmanaqer->ensureval1dloken(sth1s->oauthaccount)rif (SnewToken !== null) {sthis-›accessloken = snewloken:public function getConfigoreturn Sthis->confia:returns onlv active (archived=false)9 usadespublic function get0wners: arrayreturn $this->getNewInstance()->crm()->owners()->getALL();* apanam bool Sarchived* dreturn arrau<ownens/rn13 usages‹ >0 li| • | Daily - Platform • no100% • MOn 11 May 9.40.41AskJiminnyReportActivityServiceTest v D :+0 ..11 1l=custom.log ^=laravel.logA SF (jiminny@localhost]4 HS_local [jiminny@localhost]# console [PKob.# console leu)# console [slAGiNg)[2026-05-07 14:21:15] local.INF0: [Hubspot] DEBUG Getting headers {"neaders".?"Uace":L"Inu,or May 2020 14.21.15 6Ml"Jn"Transter-Encod1nq":"chunked")."Connection":"keep-alive""CF-Ray":L"9t80debödb60dcsa-S0F"J,"Strict-Transport-Secur1ty":"max-aqe=31536008* 1ncLudeSubDomains: preload")n"Vary"*"orioin.accent-encodino""access-control-allow-credentials": ["false"]."server-timing": ["hcid;desc=\"019e02d0-6fd8-7812-bdba-885b7ccb3ee3\","x-hubspot-correlation-id":["019e02d0-6fd8-7812-bdba-885b7ccb3ee3"],"So+-Cookie"." c+hm-Stlirtd0aXVr.kSandas6hzVVKhzTn0BidvMaheCtm0V-1778163675-1.0.107-May-26 14:51:15 GMT; domain=.hubapi.com; Http0nly; Secure; SameSite=None"],"Report-To":["{"endpoints\":[{"unl".httns:la.nel.cloudflane.com./renon+W/v42c=NVA1cVTPQfVm32anS0#xVF/sd2RN"group\":\"cf-nel\","max_age\":604800}"],"NEL": ["1\"success_fraction\":0.01,reportto. "cr-nel,"max age":604800}"]"Server": ["cloudflare"]}} {"correlation_1d":"95256555-ec98-4541-b09za-adta/SboYeab"."trace_10":"C/AD8565-905t-4604-9405-0e5b551e5545I IIllC;CascadeHubspot Rate Limit Rej caten (eanecaea tas sextentan sexcepten) .)catch\Sentry:: captureException($exception);Sresponse = sthis→>response→>errorinternalError selt::MESSAGE GENERALEXCEPTIONSEARCHING=RateLimicexcepcion excepczon excends excepcion = so it talls through to the last catch• Reports to Sentry as a 500 internal error (noisy!)• Returns errorInternalError to the client (extension shows "something went wrong")• The user has no idea this is transientThis is the wrong outcome for a transient 429. There's no retry, no backoff, no useful UX.Contirmed callersCrmController.php:84Sresponse = ScrmService->find(Sname, Sscopes):* Bul lhornSearchCommand (CLI debug only). So yes - fand() is essentially controller-only. It is a synchronous request driven by user typing in the ChromeWhat should hannen on rate limitThis is a cunchronous HTTD reauest — we canlt releace-and-retrv like a ich Ontions ordered hv what I'd recommend.(a) Translate RateLimitException → HTTP 429 with Retrv-After header. This is the standard wav.D php} catch (RateLimitException $e) {return Sthis->response->setStatusCode(429)»ertrortoomanynequessl ern search race-tamared, predse reury shorcty.eThe frontend then shows a friendly "too many searches, retry in N seconds" instead of a generic error. No Sentry noise.(b) Inside find(), retry once with a short bounded sleep() (similar to searchCallByRecordingURLToken). HubSpot's SECONDLY policy has retry_after = 1 . Asinale 1sln-reauest retry.wouldlahsorh.the.most.common.case//secondlvlhurst Can.retries.at=a.svnchronousHTiTD reauest.shouldnlfhlock 10s/for TEN_SECONDI( Dunit cachofalures, (achesitreaber wit T. 0 il o ech an exception, butit does cache sucestil empy arcys. The 8009 eacthias et fandlresults actually helps absorb pressure under typina/repeat searches — that's good, leave it.Recommendation: (a) + (b) combined. Catch RateLimitException inside find(), retry once after min(SretryAfter, 1) s, and if it still fails, let it bubble: controllermaps it to HTTP 429 with Retrv-After7. The Syictind cleen(1) Retrv in searchcall cForPeriodBvPade cearchcal BvRecordinauRLTokenCurrent code• Service.php:1584-15993 catch (Fycention Ceycention)Sthis->logger→>info('[HubSpot) Search calls for period failed'. [...1):OK lets make it extremely simple. Only consider eclient- phpffL220-229 for CHubspotPaginationservice.php#fL162-198 lwill remove it from finPo. 4 spac...
|
Firefox
|
Meet - Daily - Platform — Work
|
meet.google.com/mie-gawc-dsi?authuser=lukas.kovali meet.google.com/mie-gawc-dsi?authuser=lukas.kovalik@jiminny.com...
|
15416
|
|
15415
|
Meet - Daily - Platform
Close tab
New Tab
Open Goo Meet - Daily - Platform
Close tab
New Tab
Open Google Gemini (⌃X)
Tabs from other devices
Open history (⇧⌘H)
Open bookmarks (⌘B)
Customize sidebar
Nikolay Yankov (Presenting)
Nikolay Yankov (Presenting)
FirefoxFileTools(abl| Daily - Platform • now100% <478• Mon 11 May 9:48:45EditViewHistoryBookmarksProfiles→WindowHelpmeet.google.com/mie-gawc-dsi?authuser=[EMAIL] Yankov (Presenting)9=+Platform Team %.Q Search bostaA.J Panorama for CallsononooCAUTOMATED AISCORINGR Jy-2030125 ****= 2Setup test coverage forProphet in SonarMAINTENANGEBackdog837-190511****= 3C Jy 204Servid83 Jminr8 ProoO Attent0 Cals -( Transphttps://fminny.atiassian.net/jira/software/c/projects/JY/boards/37?selectedissue=JY-20818CO Projects1a E Datadog* Claude3 CirclechSentry,01§ SY-10240 / I0E JY-20818Move Ask Jiminny reports to separated datadog metric~ Key detailsDescriptionEdit descriptionSteps to reproducewvonelnctud ouiconeAdd textExpected outcomeAdd textSubtasksAdd subtaskAdd linked work iterActivitvCan I get more info...?Status update...Thanks.*0.* MCPIL tasкInsights & Coachin…0 Der•1Code Review# Improve BugDetailsAssignee® Lukas Kovallk|Assign to meReporter@ Lukas KovalkDevelopmentaQ Open with VS CodeJ Crate branch3 commits1 pull request2 bullds3 dtys a90MEROEDAdd optionsStory PointsOrganisationsMon 11 May 9:48• appіoкL Al BookmarksGroup: QueriesAI Reports > Empty pagedesign and promotionAJRIPORTSDeployedД -20572 |3 1 **** = ®UrCK Va AZureDeployedД -20261 6 ***= 3Allow users to oeiete SSand Panorama promptswten those are used in a...AJREPORTSDeployed20720 22 9808=Release AJ PanoramaAJREPORTSDeployed0 -20740 05 12 .+0 =pummary in the CRMNikolay IvanovNikolay Yankov4 othersAneliya AngelovaLộ39:48 AM | Daily - PlatformLukas Kovalik• 0:18...
|
Firefox
|
Meet - Daily - Platform — Work
|
meet.google.com/mie-gawc-dsi?authuser=lukas.kovali meet.google.com/mie-gawc-dsi?authuser=lukas.kovalik@jiminny.com...
|
15415
|
|
15414
|
Meet - Daily - Platform
FV faVsco.js°9 JY-20725-ha Meet - Daily - Platform
FV faVsco.js°9 JY-20725-handle-HS-search-rateroledey© BatchSyncCollectolyhuospotsyncstrategybase.ongCachedcrmservicebecorator.onp© ProspectCache.phpe balchsynckealsseС Cпескапокetrукemotematch.ongc clientonec closeaDealstagess @ MatchacuivitycrmData.ong© ermactivilyservice.phgDealrielasservice.gc)Decorateacuivilv.or© FieldDefinitions.phrclass Cllent extends Baseclient 1mpLements HubspotclientintertaceM A2 A65 X1X1 AC) FieldT vpeconvertee Hubspotclientinterc) Hubspotlokenman© PayloadBuilder.phpC) RemotecrmobiectnP ResponseNormalizec) Service,onoC)SvncFieldAction.onC) SvncRelatedActivitC) WebhookSvncBatclv MintearationAorM AcceccorsConfigD DTO• M SiltersJobs• M ProcnectSearchStr.W service Iralts© DataClient.php© DecorateActivity.phcLocalsearch.oneu LocalSearchintertac© RemoteSearch.phpc) Service.phpv W Listeners© ConvertLeadActivitc) PurceLookuocache> M Metadata> Miarationa Pioedrivev Salesforce• D Fields• M OnnortunitvMatcheMOnnortunitvSvneSt897 (> M ProsnectSearchStr:M ServiceTraitcC) Client nhr© DecorateActivity.ph. Delete@biectsTrait© FieldDefinitions.php© PayloadBuilder.php© Profile.php© QueryBuilder.phpoubuc tunction 1sunauthorizedzxcention Excention se: 000ureturn str contains(Smessage. "401 unauthorized')Istr contains(Smessage.'http 401') |1str_contains(Smessage, 'status code 401') |(orea match( pattern: • /\b401\b/* Smessage) &s str contains(Smessage. 'unauthorized')):* Validates and refreshes the access token if needed before API requests.* This ensures long-running processes don't fail due to token expiration.* @throws SocialAccountTokenInvalidExceptiony usagespublic function ensureValidToken: voidif (Sthis->oauthAccount === null) {Snewloken = sthis->tokenmanaqer->ensureval1dloken(sth1s->oauthaccount)rif (SnewToken !== null) {sthis-›accessloken = snewloken:public function getConfigoreturn Sthis->confia:returns onlv active (archived=false)9 usadespublic function get0wners: arrayreturn $this->getNewInstance()->crm()->owners()->getALL();* apanam bool Sarchived* dreturn arrau<ownens/rn13 usages‹ >0 h| • | Daily - Platform • nov100% • MOn 11 May 9.40.44AskJiminnyReportActivityServiceTest v D :+0 ..11 1l=custom.log ^=laravel.logA SF (jiminny@localhost]4 HS_local [jiminny@localhost]# console [PKob.# console leu)# console [slAGiNG)[2026-05-07 14:21:15] local.INF0: [Hubspot] DEBUG Getting headers {"neaders".?"Uace":L"Inu,or May 2020 14.21.15 6Ml"Jn"Transter-Encod1nq":"chunked")."Connection":"keep-alive""CF-Ray":L"9t80debödb60dcsa-S0F"J,"Strict-Transport-Secur1ty":"max-aqe=31536008* 1ncLudeSubDomains: preload")n"Vary"*"orioin.accent-encodino""access-control-allow-credentials": ["false"]."server-timing": ["hcid;desc=\"019e02d0-6fd8-7812-bdba-885b7ccb3ee3\","x-hubspot-correlation-id":["019e02d0-6fd8-7812-bdba-885b7ccb3ee3"],"So+-Cookie"." c+hm-Stlirtd0aXVr.kSandas6hzVVKhzTn0BidvMaheCtm0V-1778163675-1.0.107-May-26 14:51:15 GMT; domain=.hubapi.com; Http0nly; Secure; SameSite=None"],"Report-To":["{"endpoints\":[{"unl".httns:la.nel.cloudflane.com./renon+W/v42c=NVA1cVTPQfVm32anS0#xVF/sd2RN"group\":\"cf-nel\","max_age\":604800}"],"NEL": ["1\"success_fraction\":0.01,reportto. "cr-nel,"max age":604800}"]"Server": ["cloudflare"]}} {"correlation_1d":"95256555-ec98-4541-b09za-adta/SboYeab"."trace_10":"C/AD8565-905t-4604-9405-0e5b551e5545I IIllC;CascadeHubspot Rate Limit Rej caten (eanecaea tas sextentan sexcepten) .)catch\Sentry:: captureException($exception);Sresponse = sthis→>response→>errorinternalError selt::MESSAGE GENERALEXCEPTIONSEARCHING=RateLimicexcepcion excepczon excends excepcion = so it talls through to the last catch• Reports to Sentry as a 500 internal error (noisy!)• Returns errorInternalError to the client (extension shows "something went wrong")• The user has no idea this is transientThis is the wrong outcome for a transient 429. There's no retry, no backoff, no useful UX.Contirmed callersCrmController.php:84Sresponse = ScrmService->find(Sname, Sscopes):* Bul lhornSearchCommand (CLI debug only). So yes - fand() is essentially controller-only. It is a synchronous request driven by user typing in the ChromeWhat should hannen on rate limitThis is a cunchronous HTTD reauest — we canlt releace-and-retrv like a ich Ontions ordered hv what I'd recommend.(a) Translate RateLimitException → HTTP 429 with Retrv-After header. This is the standard wav.D php} catch (RateLimitException $e) {return Sthis->response->setStatusCode(429)»ertrortoomanynequessl ern search race-tamared, predse reury shorcty.eThe frontend then shows a friendly "too many searches, retry in N seconds" instead of a generic error. No Sentry noise.(b) Inside find(), retry once with a short bounded sleep() (similar to searchCallByRecordingURLToken). HubSpot's SECONDLY policy has retry_after = 1 . Asinale 1sln-reauest retry.wouldlahsorh.the.most.common.case//secondlvlhurst Can.retries.at=a.svnchronousHTiTD reauest.shouldnlfhlock 10s/for TEN_SECONDI( Dunit cachofalures, (achesitreaber wit T. 0 il o ech an exception, butit does cache sucestil empy arcys. The 8009 eacthias et fandlresults actually helps absorb pressure under typina/repeat searches — that's good, leave it.Recommendation: (a) + (b) combined. Catch RateLimitException inside find(), retry once after min(SretryAfter, 1) s, and if it still fails, let it bubble: controllermaps it to HTTP 429 with Retrv-After7. The Syictind cleen(1) Retrv in searchcall cForPeriodBvPade cearchcal BvRecordinauRLTokenCurrent code• Service.php:1584-15993 catch (Fycention Ceycention)Sthis->logger→>info('[HubSpot) Search calls for period failed'. [...1):OK lets make it extremely simple. Only consider eclient- phpffL220-229 for CHubspotPaginationservice.php#fL162-198 lwill remove it from finPo. 4 spac...
|
Firefox
|
Meet - Daily - Platform — Work
|
meet.google.com/mie-gawc-dsi?authuser=lukas.kovali meet.google.com/mie-gawc-dsi?authuser=lukas.kovalik@jiminny.com...
|
15414
|
|
15413
|
0:17
FirefoxFileEditViewHistoryBookmarksProfilesTo 0:17
FirefoxFileEditViewHistoryBookmarksProfilesToolsWindowHelp(ablmeet.google.com/mie-gawc-dsi?authuser=[EMAIL] Yankov (Presenting)| Daily - Platform • now100% C8• Mon 11 May 9:48:439C Jy 204Servid83 Jminr8 PromoO Attenthttps://fminny.atiassian.net/jira/software/c/projects/JY/boards/37?selectedissue=JY-20818CO ProjectsDatadogPlatform Team 2.Q Search bosta,01JY-10240 / I08 Jr-20818A.J Panorama for CalXononooCAUTOMATID AISICOKINGR2 JY-2030125 ****= 3Setup test coverage forProphot in SonarMAINTENANGEBackdog8 39-190511**=3Move Ask Jiminny reports to separated datadog metric~ Key detailsDescriptionEdn descriptionSteps to reproduce©Wvonelnctuss ouiceneAdd textExpected outcomeAdd textSubtasksAdd subtaskAdd liniced work iternActivitvCan I get more info...?Status update...Thanks.0 Cals -C Transp3 Circlech*L tasк@1Code RevicwDetailsAssignee@ Lukas KovallkAssign to meReporter@ Lukas KovaikDevelopmentOpen with VS CodeJ Create branch3 commits1 pull request2 buildsLSOUTAdd optionsStory PointsOrganisationsX MCPI0 DerImprove Bug3 Овуs.990|MEROCOMon 11 May 9:48• appіoкL Al BookmarksGroup: QueriesAI Reports > Empty pagedesign and promotionAJ REPORTSDeployed0 -20572 3 11 **** = ®JCR Va AZUreDeployedД -2261 • **= 3Allow users to oeiete SSand Panorama promptswten those are used in a...AJREPORTSDeployed0-207201 12 9888-Release AJ PanoramaAUREPORTSDeployed0 -20740 05 12 »50 =Wrong formatting forsummary in the CRMNikolay IvanovNikolay YankovORKOUTIE4 othersAneliya AngelovaLộ39:48 AM | Daily - PlatformLukas Kovalik• 0:17....
|
CleanShot X
|
|
NULL
|
15413
|
|
15412
|
0:14
FirefoxFileEditViewHistoryBookmarksProfilesTo 0:14
FirefoxFileEditViewHistoryBookmarksProfilesToolsWindowHelpmeet.google.com/mie-gawc-dsi?authuser=[EMAIL]| Daily - Platform • now100% <478• Mon 11 May 9:48:40Nikolay Yankov (Presenting)SPlatform Team 8.Q Search boardA.J Panorama for Calscoting in ouCAUTOMATED AI SCORDKewdytorDVД Jy-20301Setup test coverage forProphet in SonarMRABMTTHANCEBacktog@JY-190511***=?C Jy 20452 Servicv Planhi83 Jmіn83 Promehttps://fiminny.atlassian.net/jira/software/c/projects/JY/boards/37CO ProjectsHome | Salesforce2000018EpicТуро ~IN DEV 4Upgrade to PHP 8.5PIEASUNCALDEin Deyl₴ Jу-1са1Al Review - 01-1Summary acooh wemsiNonPointsGROWDI• MAINTALN OUI COMIn Dev020500 2 •****=[POC) Jimiony MCPConnectcrIn Progress.20025 10 П1 •=**eichindoneeekhubspot accounts/contactsPLATFORM STANTITTYIn DevlO Jy-20725Quick fitersSmart Instant Nudge Pre-TiseringCOST-EFFECTIVE AMD FASTER NOCode Reviewд Jv20423 15 4 •= OMove Ask Jiminny ceportsto separated datadognacukCode ReviewD Jy-208181•= 0+ CreateO Atten:E Datadog+CalmЕ3 МСР0 Der• applo|Mon 11 May 9:48L Al BookmarkslNikolay IvanovNikolay YankovPOACDPIANESync opportunities withoutCXATYORM STARSUTY?In OA12-20352 5 П ^*** = (AI Reports > Empty pagettwewoo0eAJREPORTEDeployed8203721 0000 =Grok via AzureDeployedL -20728 1 0 aяs0 =Allow users to delete SSand Panorama promptswhen those are used in a...AJSCPORTEDeployed20720 101 П »*** =Release AJ PanoramnaDeployed0 -20740 05 [2 -00 =Wrong formatting forsummary in the CRM4 othersAneliya AngelovaLộ39:48 AM | Daily - PlatformLukas Kovalik• 0:14....
|
CleanShot X
|
|
NULL
|
15412
|
|
15411
|
0:11
FirefoxFileEditViewHistoryBookmarksProfilesTo 0:11
FirefoxFileEditViewHistoryBookmarksProfilesToolsWindowHelp(ablmeet.google.com/mie-gawc-dsi?authuser=[EMAIL] Yankov (Presenting)| Daily - Platform • now100% <478• Mon 11 May 9:48:379Platform TeamQ Search boardAJ Panorama for CallScoring n 0o(AUTOMATEO AT SCORINGKeddy torwoyP Jy-2030125 •***= 3Setup test coverage forPToonoricherMASNTENANCEBacklogE 3-109511****=C Jy 20451 ServicU Planhi83 Jmier8 Proohttps://fiminny.atlassian.net/jira/software/c/projects/JY/boards/37?selectedissue=JY-204932 SSHJT-50541 1S7-20489Smart Instant Nudge Pre-filteringDescriptionProblem:E) Nudge Feature Performance Recommendations | Problem #3: Instant Nudge Dispatch FloodSolution:Nudge Feature Performance Recommendations | Solution 2: Smart Instant Nudge Pre fitering (PT)[EMAIL]:35-69For every AnalyticsConpletedEvent (one per new activity), the job loads every Activity\Search in the team that has aweone lenroorinoooeichos octiuorcheenoewinoucomoetremeweoryodsearch fiters.PrecessNudgeSeazchJob (PzocesstudgeSearchJob.php:42-98) then runs an ES onDenand$croll plus a DB dedup chunkloop (NudgeRunFactory.phe:195-225). When 0 new activities are found ik balls on line 75 — but only after the ES round-tripaweouoworkn00 SUOwsLinked work itemsAdd linked work item*O Attent0 Cals -0 AvenCa TranspJmineX MCPE Datadog* Claude3 CircleCi|Sentry*xIL tasкInsights & Coachin…• DetailsNonePriorityFix versionsNoneSprintPlatform Sprint 3 Q2DaysNeed QAYesJy-9654 Cost-effective and faster nudCanny LinksOpen canny Laxs~ More fields0 DerMon 11 May 9:48• apploL Al BookmarxsGroup: QueriesAI Reports > Empty pagedesign and promotionAJREPORTSDeployed8 20372 1 0000=JOK VÀ ALUICД-20726 1 0 •*0=Allow users to delete SSand Panorama promptsАКРОКISDeployedRelease AJ PanoramaAJREPORTSDeployed0-20740 05 1) •**=summary in the CRMNikolay IvanovNikolay Yankov4 othersAneliya AngelovaLộ39:48 AM | Daily - PlatformLukas Kovalik• 0:11...
|
CleanShot X
|
|
NULL
|
15411
|
|
15410
|
0:07
FirefoxFileEditViewHistoryBookmarksProfilesTo 0:07
FirefoxFileEditViewHistoryBookmarksProfilesToolsWindowHelp(ablmeet.google.com/mie-gawc-dsi?authuser=[EMAIL] Yankov (Presenting)| Daily - Platform • now100% <478• Mon 11 May 9:48:339Platform Team %Q Search boardA.J Panorama for CallScoring nn 00(AUTOMATEO AI SGORINGKesdy torwoyA JY-20361Setup test coverage forProonorwocherMAINTENANCSBacklogE 3-10051C Jy 20452 ServicU Planht83 Jmier8 PromoO Attent0 Cals -https://fiminny.atlassian.net/jira/software/c/projects/JY/boards/37?selectedissue=JY-204934 S5H8E DatadogJY-50541 4 J7-20489Smart Instant Nudge Pre-filteringDescriptionProblem:E) Nudge Feature Performance Recommendations | Problem #3: Instant Nudge Dispatch FloodSolution:© Nudge Feature Performance Recommendations | Solution 2: Smart Instant Nudge Pre fitering (P1)Processoroantsa.1on.sned.atelubaes./0o.png/gs=6%For every AnalyticsConpletedEvent (one per new activity), the job loads every Activity\Search in the team that has anwone lenroorenooicno octuerrcheenoewinoucomoeiretemeweeitsearch fiters.PrecessNudgeSeazchJob (ProcessNudgeSearchJob.php:42-98) then runs an ES onDenand$croll plus a DB dedup chunkloop (NudgeRunFactory.php:195-225). When 0 new activities are found ik balls on line 75 — but only after the ES round-tripaweouoworknod sucwissLinked work itemsAdd linked work item*AtsenlCa TranspJmine* MCPI* Claude3 CircleciSentry*xIL tasкDetailsorgar saconsNonePriorityFix versionsNoneSprintPlatform Sprint 3 Q2Days15Need QAYesJY-9654 Cost-effective and faster nudCanny LinksOpen canny Laxs~ More fields0 DerMon 11 May 9:48• эpplо:L Al BookmarxsGroup: QueriesAl Reports > Empty pagedesign and promotionAJREPORTSDeployed0 -20372 1 11 •**0 =JOK Và ALUICД -20726 1 0 •*0=Allow users to delete SSand Panorama promptswhen those are used in a...AJREPORTSDeployedRelease AJ PanoramaAJREPORTS0-20740 05 1l ..0•Teneaiotoneersummary in the CRMNikolay IvanovNikolay Yankov4 othersAneliya AngelovaLộ39:48 AM | Daily - PlatformLukas Kovalik• 0:06...
|
CleanShot X
|
|
NULL
|
15410
|
|
15409
|
0:05
FV faVsco.js°9 JY-20725-handle-HS-search-rate 0:05
FV faVsco.js°9 JY-20725-handle-HS-search-rateroledey© BatchSyncCollectolyhuospotsyncstrategybase.ongCachedcrmservicebecorator.onp© ProspectCache.phpe balchsynckealsseС Cпескапокetrукemotematch.ongc clientonec closeaDealstagess @ MatchacuivitycrmData.ong© ermactivilyservice.phgDealrielasservice.gc)Decorateacuivilv.or© FieldDefinitions.phrclass Cllent extends Baseclient 1mpLements HubspotclientintertaceM |A2 A65 X1X1AC) FieldT vpeconvertee Hubspotclientinterc) Hubspotlokenman© PayloadBuilder.phpC) RemotecrmobiectnP ResponseNormalizec) Service,onoC)SvncFieldAction.onC) SvncRelatedActivitC) WebhookSvncBatclv MintearationAorM AcceccorsConfigD DTO• M SiltersJobs• M ProcnectSearchStr.W service Iralts© DataClient.php© DecorateActivity.phcLocalsearch.oneu LocalSearchintertac© RemoteSearch.phpc) Service.phpv W Listeners© ConvertLeadActivitc) PurceLookuocache> M Metadata> Miarationa Pioedrivev Salesforce• D Fields• M OnnortunitvMatcheMOnnortunitvSvneSt897 (> M ProsnectSearchStr:M ServiceTraitcC) Client nhr© DecorateActivity.ph. Delete@biectsTrait© FieldDefinitions.php© PayloadBuilder.php© Profile.php© QueryBuilder.phpoubuc tunction 1sunauthorizedzxcention Excention se: 000ureturn str contains(Smessage. "401 unauthorized')Istr contains(Smessage.'http 401') |1str_contains(Smessage, 'status code 401') |(orea match( pattern: • /\b401\b/* Smessage) &s str contains(Smessage. 'unauthorized')):* Validates and refreshes the access token if needed before API requests.* This ensures long-running processes don't fail due to token expiration.* @throws SocialAccountTokenInvalidExceptiony usagespublic function ensureValidToken: voidif (Sthis->oauthAccount === null) {Snewloken = sthis->tokenmanaqer->ensureval1dloken(sth1s->oauthaccount)rif (SnewToken !== null) {sthis-›accessloken = snewloken:public function getConfigoreturn Sthis->confia:returns onlv active (archived=false)9 usadespublic function get0wners: arrayreturn $this->getNewInstance()->crm()->owners()->getALL();* apanam bool Sarchived* dreturn arrau<ownens/rn13 usages‹ >0 h| • | Daily - Platform • nov100% • MOn 11 May 9.40.37AskJiminnyReportActivityServiceTest v D :+0 ..11 1l=custom.log ^=laravel.logA SF (jiminny@localhost]4 HS_local [jiminny@localhost]# console [PKob.# console leu)# console [slAGiNG)[2026-05-07 14:21:15] local.INF0: [Hubspot] DEBUG Getting headers {"neaders".?"Uace":L"Inu,or May 2020 14.21.15 6Ml"Jn"Transter-Encod1nq":"chunked")."Connection":"keep-alive""CF-Ray":L"9t80debödb60dcsa-S0F"J,"Strict-Transport-Secur1ty":"max-aqe=31536008* 1ncLudeSubDomains: preload")n"Vary"*"orioin.accent-encodino""access-control-allow-credentials": ["false"]."server-timing": ["hcid;desc=\"019e02d0-6fd8-7812-bdba-885b7ccb3ee3\","x-hubspot-correlation-id":["019e02d0-6fd8-7812-bdba-885b7ccb3ee3"],"So+-Cookie"." c+hm-Stlirtd0aXVr.kSandas6hzVVKhzTn0BidvMaheCtm0V-1778163675-1.0.107-May-26 14:51:15 GMT; domain=.hubapi.com; Http0nly; Secure; SameSite=None"],"Report-To":["{"endpoints\":[{"unl".httns:la.nel.cloudflane.com./renon+W/v42c=NVA1cVTPQfVm32anS0#xVF/sd2RN"group\":\"cf-nel\","max_age\":604800}"],"NEL": ["1\"success_fraction\":0.01,reportto. "cr-nel,"max age":604800}"]"Server": ["cloudflare"]}} {"correlation_1d":"95256555-ec98-4541-b09za-adta/SboYeab"."trace_10":"C/AD8565-905t-4604-9405-0e5b551e5545I II1l-;CascadeHubspot Rate Limit Rej caten (eanecaea tas sextentan sexcepten) .)catch\Sentry:: captureException($exception);Sresponse = sthis→>response→>errorinternalError selt::MESSAGE GENERALEXCEPTIONSEARCHING=RateLimicexcepcion ecepczon excends excepcion = so it talls through to the last catch• Reports to Sentry as a 500 internal error (noisy!)• Returns errorInternalError to the client (extension shows "something went wrong")• The user has no idea this is transientThis is the wrong outcome for a transient 429. There's no retry, no backoff, no useful UX.Contirmed callersCrmController.php:84Sresponse = ScrmService->find(Sname, Sscopes):* Bul lhornSearchCommand (CLI debug only). So yes - fand() is essentially controller-only. It is a synchronous request driven by user typing in the ChromeWhat should hannen on rate limitThis is a cunchronous HTTD reauest — we canlt releace-and-retrv like a ich Ontions ordered hv what I'd recommend.(a) Translate RateLimitException → HTTP 429 with Retrv-After header. This is the standard wav.D php} catch (RateLimitException $e) {return Sthis->response->setStatusCode(429)»ertrortoomanynequessl ern search race-tamared, predse reury shorcty.eThe frontend then shows a friendly "too many searches, retry in N seconds" instead of a generic error. No Sentry noise.(b) Inside find(), retry once with a short bounded sleep() (similar to searchCallByRecordingURLToken). HubSpot's SECONDLY policy has retry_after = 1 . Asinale 1sln-reauest retry.wouldlahsorh.the.most.common.case//secondlvlhurst Can.retries.at=a.svnchronousHTiTD reauest.shouldnlfhlock 10s/for TEN_SECONDI( Dunit cachofalures, (achesitreaber wit T. 0 il o ech an exception, butit does cache sucestil empy arcys. The 8009 eacthias et fandlresults actually helps absorb pressure under typina/repeat searches — that's good, leave it.Recommendation: (a) + (b) combined. Catch RateLimitException inside find(), retry once after min(SretryAfter, 1) s, and if it still fails, let it bubble: controllermaps it to HTTP 429 with Retrv-After7. The Syictind cleen(1) Retrv in searchcall cForPeriodBvPade cearchcal BvRecordinauRLTokenCurrent code• Service.php:1584-15993 catch (Fycention Ceycention)Sthis->logger→>info('[HubSpot) Search calls for period failed'. [...1):OK lets make it extremely simple. Only consider eclient- phpffL220-229 for CHubspotPaginationservice.php#fL162-198 lwill remove it from finPo. 4 spac...
|
CleanShot X
|
|
NULL
|
15409
|
|
15408
|
0:05
FirefoxFileToolsWindow(abl| Daily - Platform 0:05
FirefoxFileToolsWindow(abl| Daily - Platform • now100% <478• Mon 11 May 9:48:30EditViewHistoryBookmarksProfiles→Helpmeet.google.com/mie-gawc-dsi?authuser=[EMAIL] Yankov (Presenting)9=+Platform Team %Q Search boardA.J Panorama for CallScoring nn 00(AUTOMATEO AI SGORINGKedoy torDyP Jy-20361Setup test coverage forPropnoriooharMAINTENANCSBacklogE 3-100511 ****= 3C Jy 20452 Servic© Planha83 Jmier8 PromoO Attenthttps://fiminny.atlassian.net/jira/software/c/projects/JY/boards/37?selectedissue=JY-204934 S5HLa E DatadogJT-90541 1S7-20489Smart Instant Nudge Pre-filteringDescriptionProblem:E) Nudge Feature Performance Recommendations | Problem #3: Instant Nudge Dispatch FloodSolution:™ Nudge Feature Performance Recommendations | Solution 2: Smart Instant Nudge Pre fitering (PT)Processoroan.sa.ton.snedtatelubaes.oo.prg/3a=6%For every AnalyticsConpletedEvent (one per new activity), the job loads every Activity\Search in the team that has anweone lent noornoooaicno oceuwcheenoewinou comoeiretemeweeiyotsearch fiters.ProcessNudgeSeazchJob (ProcesstudgeSearchJob.php:42-98) then runs an ES onDenand$croll plus a DB dedup chunkloop (NudgeRunFactory-php:195-225 ). When 0 new activities are found it bails on line 75 - but only after the ES round-tripaweouowork-UowWXnod suowissLinked work itemsAdd linked work item*0 Cals -AtsenlCa TranspJmine* MCPI© * Ciaude3 CircleciSentry*xIL tasк0 Der• Detailsorgar saconsNonePriorityFix versionsNoneSprintPlatform Sprint 3 Q2DaysNeed QA #YesJy-9654 Cost-effective and faster nudCanny LinksOpen Canny Links~ More fields0:0411IMon 11 May 9:48• эpplо:L Al BookmarxsGroup: QueriesAl Reports > Empty pagedesign and promotionAJREPORTSDeployed0 -20372 1 11 •*** =JOK Và ALUICД-20726 1 0 •**0=Allow users to delete SSand Panorama promptswhen those are used in a...AJREPORTSDeployedRelease AJ PanoramaAJREPORTSDeployed0-20740 05 1 ..0•:summary in the CRM...Nikolay IvanovNikolay Yankov4 othersAneliya AngelovaLukas KovalikLộ39:48 AM | Daily - Platform...
|
CleanShot X
|
|
NULL
|
15408
|
|
15407
|
Meet - Daily - Platform
Close tab
New Tab
Open Goo Meet - Daily - Platform
Close tab
New Tab
Open Google Gemini (⌃X)
Tabs from other devices
Open history (⇧⌘H)
Open bookmarks (⌘B)
Customize sidebar
Nikolay Yankov (Presenting)
Nikolay Yankov (Presenting)
People
9
Take notes with Gemini
Take notes with Gemini
Gemini
Gemini
Pop out this video More screens are more fun. Play this video while you do other things.
Pop out this video
More screens are more fun. Play this video while you do other things.
Zoom in
Open in new window
Enter Full Screen
Pop out this video More screens are more fun. Play this video while you do other things.
Pop out this video
More screens are more fun. Play this video while you do other things.
Nikolay Ivanov
Pop out this video More screens are more fun. Play this video while you do other things.
Pop out this video
More screens are more fun. Play this video while you do other things.
Nikolay Yankov
Pop out this video More screens are more fun. Play this video while you do other things.
Pop out this video
More screens are more fun. Play this video while you do other things.
Aneliya Angelova
User profile picture User profile picture 4 others
4 others
Pop out this video More screens are more fun. Play this video while you do other things.
Pop out this video
More screens are more fun. Play this video while you do other things.
Lukas Kovalik
Others might see more of your background. Click to view your full video.
9:48
AM
Daily - Platform
Daily - Platform
Audio settings
Turn on microphone
Video settings
Turn off camera
Nikolay Yankov is presenting
Send a reaction...
|
Firefox
|
Meet - Daily - Platform — Work
|
meet.google.com/mie-gawc-dsi?authuser=lukas.kovali meet.google.com/mie-gawc-dsi?authuser=lukas.kovalik@jiminny.com...
|
15407
|
|
15406
|
Meet - Daily - Platform
Close tab
New Tab
Open Goo Meet - Daily - Platform
Close tab
New Tab
Open Google Gemini (⌃X)
Tabs from other devices
Open history (⇧⌘H)
Open bookmarks (⌘B)
Customize sidebar
Nikolay Yankov (Presenting)
Nikolay Yankov (Presenting)
People
FV faVsco.js°9 JY-20725-handle-HS-search-rateroledey© BatchSyncCollectolyhuospotsyncstrategybase.ongCachedcrmservicebecorator.onp© ProspectCache.phpe balchsynckealsseС Cпескапокetrукemotematch.ongc clientonec closeaDealstagess @ MatchacuivitycrmData.ong© ermactivilyservice.phgDealrielasservice.gc)Decorateacuivilv.or© FieldDefinitions.phrclass Cllent extends Baseclient 1mpLements HubspotclientintertaceM |A2 A65 X1X1AC) FieldT vpeconvertee Hubspotclientinterc) Hubspotlokenman© PayloadBuilder.phpC) RemotecrmobiectnP ResponseNormalizec) Service,onoC)SvncFieldAction.onC) SvncRelatedActivitC) WebhookSvncBatclv MintearationAorM Acceccors• D ConfigD DTO• M SiltersJobs• M ProcnectSearchStr.W service Iralts© DataClient.php© DecorateActivity.phc Localsearch.oneu LocalSearchintertac© RemoteSearch.phpc) Service.phpv W Listeners© ConvertLeadActivitc) PurceLookuocache> M Metadata> Miarationa Pioedrivev Salesforce• D Fields• M OnnortunitvMatcheMOnnortunitvSvneSt897 (> M ProsnectSearchStr:M ServiceTraitcC) Client nhr© DecorateActivity.ph. Delete@biectsTrait© FieldDefinitions.php© PayloadBuilder.php© Profile.php© QueryBuilder.phpoubuc tunction 1sunauthorizedzxcention Excention se: 000ureturn str contains(Smessage. "401 unauthorized')Istr contains(Smessage.'http 401') |1str_contains(Smessage, 'status code 401') |(orea match( pattern: • /\b401\b/* Smessage) &s str contains(Smessage. 'unauthorized')):* Validates and refreshes the access token if needed before API requests.* This ensures long-running processes don't fail due to token expiration.* @throws SocialAccountTokenInvalidExceptiony usagespublic function ensureValidToken: voidif (Sthis->oauthAccount === null) {Snewloken = sthis->tokenmanaqer->ensureval1dloken(sth1s->oauthaccount)rif (SnewToken !== null) {sthis-›accessloken = snewloken:public function getConfigoreturn Sthis->confia:returns onlv active (archived=false)9 usadespublic function get0wners: arrayreturn $this->getNewInstance()->crm()->owners()->getALL();* apanam bool Sarchived* dreturn arrau<ownens/rn1s usages100% • MOn 11 May 9.40.24AskJiminnyReportActivityServiceTest v D :+0 ..11 1l=custom.log ^=laravel.logA SF (jiminny@localhost]4 HS_local (jiminny@localhost]# console [PKob.# console leu)# console [slAGiNg)[2026-05-07 14:21:15] local.INF0: [Hubspot] DEBUG Getting headers {"neaders".?"Uace":L"Inu,or May 2020 14.21.15 6Ml"Jn"Transter-Encod1nq":"chunked")."Connection":"keep-alive""CF-Ray":L"9t80debödb60dcsa-S0F"J,"Strict-Transport-Secur1ty":"max-aqe=31536008* 1ncLudeSubDomains: preload")n"Vary":"orioin.accent-encodino""access-control-allow-credentials": ["false"]."server-timing": ["hcid;desc=\"019e02d0-6fd8-7812-bdba-885b7ccb3ee3\","x-hubspot-correlation-id":["019e02d0-6fd8-7812-bdba-885b7ccb3ee3"],"So+-Cookie"." c+hm-Stlirtd0aXVr.kSandas6hzVVKhzTn0BidvMaheCtm0V-1778163675-1.0.107-May-26 14:51:15 GMT; domain=.hubapi.com; Http0nly; Secure; SameSite=None"],"Report-To":["{"endpoints\":[{"unl".httns:la.nel.cloudflane.com./renon+W/v42c=NVA1cVTPQfVm32anS0#xVF/sd2RN\"group)":\"cf-nel\","max_age\":604800}"],"NEL":["{\"success_fraction\":0.01,reportto. "cr-nel,"max age":604800}"]"Server": ["cloudflare"]}} {"correlation_1d":"95256555-ec98-4541-b09za-adta/SboYeab"."trace_10":"C/AD8565-905t-4604-9405-0e5b551e5545I II1l-;CascadeHubspot Rate Limit Rej caten (eanecaea tas sextentan sexcepten) .)catch\Sentry:: captureException($exception);Sresponse = sthis→>response→>errorinternalError selt::MESSAGE GENERALEXCEPTIONSEARCHING=RateLimicexcepcion ecepczon excends excepcion = so it talls through to the last catch• Reports to Sentry as a 500 internal error (noisy!)• Returns errorInternalError to the client (extension shows "something went wrong")• The user has no idea this is transientThis is the wrong outcome for a transient 429. There's no retry, no backoff, no useful UX.Contirmed callersCrmController.php:84Sresponse = ScrmService->find(Sname, Sscopes):* Bul lhornSearchCommand (CLI debug only). So yes - fand() is essentially controller-only. It is a synchronous request driven by user typing in the ChromeWhat should hannen on rate limitThis is a cunchronous HTTD reauest — we canlt releace-and-retrv like a ich Ontions ordered hv what I'd recommend.(a) Translate RateLimitException → HTTP 429 with Retrv-After header. This is the standard wav.D php} catch (RateLimitException $e) {return Sthis->response->setStatusCode(429)»ertrortoomanynequessl ern search race-tamared, predse reury shorcty.eThe frontend then shows a friendly "too many searches, retry in N seconds" instead of a generic error. No Sentry noise.(b) Inside find(), retry once with a short bounded sleep() (similar to searchCallByRecordingURLToken). HubSpot's SECONDLY policy has retry_after = 1 . Asinale 1sln-reauest retry.wouldlahsorh.the.most.common.case//secondlvlhurst Can.retries.at=a.svnchronousHTiTD reauest.shouldnlfhlock 10s/for TEN_SECONDI( Dunit cachofalures, (achesitreaber wit T. 0 il o ech an exception, butit does cache sucestil empy arcys. The 8009 eacthias et fandlresults actually helps absorb pressure under typina/repeat searches — that's good, leave it.Recommendation: (a) + (b) combined. Catch RateLimitException inside find(), retry once after min(SretryAfter, 1) s, and if it still fails, let it bubble: controllermaps it to HTTP 429 with Retrv-After7. The Syictind cleen(1) Retrv in searchcall cForPeriodBvPade cearchcal BvRecordinauRLTokenCurrent code• Service.php:1584-15993 catch (Fycention Ceycention)Sthis->logger→>info('[HubSpot) Search calls for period failed'. [...1):OK lets make it extremely simple. Only consider eclient- phpffL220-229 for CHubspotPaginationservice.php#fL162-198 lwill remove it from finPo. 4 spac...
|
Firefox
|
Meet - Daily - Platform — Work
|
meet.google.com/mie-gawc-dsi?authuser=lukas.kovali meet.google.com/mie-gawc-dsi?authuser=lukas.kovalik@jiminny.com...
|
15406
|
|
15405
|
Meet - Daily - Platform
Close tab
New Tab
Open Goo Meet - Daily - Platform
Close tab
New Tab
Open Google Gemini (⌃X)
Tabs from other devices
Open history (⇧⌘H)
Open bookmarks (⌘B)
Customize sidebar
Nikolay Yankov (Presenting)
Nikolay Yankov (Presenting)
People
9
Take notes with Gemini
Take notes with Gemini
Gemini
Gemini
Pop out this video More screens are more fun. Play this video while you do other things.
Pop out this video
More screens are more fun. Play this video while you do other things.
Zoom in
Open in new window
Enter Full Screen
Pop out this video More screens are more fun. Play this video while you do other things.
Pop out this video
More screens are more fun. Play this video while you do other things.
Nikolay Ivanov
Pop out this video More screens are more fun. Play this video while you do other things.
Pop out this video
More screens are more fun. Play this video while you do other things.
Nikolay Yankov
Pop out this video More screens are more fun. Play this video while you do other things.
Pop out this video
More screens are more fun. Play this video while you do other things.
Aneliya Angelova
User profile picture User profile picture 4 others
4 others
Pop out this video More screens are more fun. Play this video while you do other things.
Pop out this video
More screens are more fun. Play this video while you do other things.
Lukas Kovalik
Others might see more of your background. Click to view your full video.
9:48
AM
Daily - Platform
Daily - Platform
Audio settings
Turn on microphone
Video settings
Turn off camera
Nikolay Yankov is presenting
Send a reaction
Turn on captions
Raise hand (ctrl + ⌘ + h)
More options
Leave call
Meeting details
Chat with everyone
Meeting tools...
|
Firefox
|
Meet - Daily - Platform — Work
|
meet.google.com/mie-gawc-dsi?authuser=lukas.kovali meet.google.com/mie-gawc-dsi?authuser=lukas.kovalik@jiminny.com...
|
15405
|
|
15404
|
+FirefoxProfilesToolsWindow(abl$FileEditViewHistor +FirefoxProfilesToolsWindow(abl$FileEditViewHistoryBookmarksHelpmeet.google.com/mie-gawc-dsi?authuser=[EMAIL] Yankov (Presenting)•G0 0C Jy 20451 Servic© PlanhaX Jmim8 PromoO. Attent0 Cals -Ca Transp* MCPIhttps://fiminny.atlassian.net/jira/software/c/projects/JY/boards/37?selectedissue=JY-204932 SSHE Datadog* Claude3 CircleciSentry*xIL tasкInsights & Coachin…0 DerPlatform Team %Q Search boardJT-50541 4 J7-20483Smart Instant Nudge Pre-filteringCode Review vAJ Panorama for CallScoring n oo(AUTOMATED AT ECORINGKeady torDUVA Jy-20301Xx Improve StoryDescriptionProblem:1390832E) Nudge Feature Performance Recommendations | Probiem #3: Instant Nudge Dispatch FloodSetup test coverage forProonorwocharMAINTENANCISBacklog# 3-19951Solution:™ Nudge Feature Performance Recommendations | Solution 2: Smart Instant Nudge Pre fitering (P1))1 ****= 3Record [EMAIL]:35-69For every AnalyticsConpletedEvent (one per new activity), the job loads every Activity\Search in trwone ternoorinooaicnes occhenoe winoucomoeireueesearch fiters.PrecessNudgeSeazchJob (ProcessHudgeSearchJob.php:42-98) then runs an ES onDenand$croll plus a DB dedup chunkloop (NudgeRunFactory.php:195-225 ). When 0 new activities are found it bails on line 75 - but only after the ES round-tripaweouoworkRecord VideoTS8 commits1 pull request2 bulldsdayse…owwXComponentsPlatformnod suowissAdd optionsLinked work itemsAdd linked work itemLabels| Daily - Platform • now100% CMon 11 May 9:48:21 •98• Mon 11 May 9:48• appіб:L Al BookmarxsGroup: QueriesAI Reports > Empty pagedesign and promotonAJREPORTSDeployedД -20572 |1 01 **** = ®JrOK Và ALUICД-20726 1 0 •*+=Allow users to delete SSand Panorama promptswhen those are used in a...AJREPORTSDeployed0 -207701 809000Release AJ PanoramaAJREPORTSR -20740 05 11 ...0:summary in the CRMStefka StoyanovaNikolay Yankov4 othersAneliya AngelovaLukas Kovalik9:48 AM | Daily - Platform...
|
CleanShot X
|
|
NULL
|
15404
|
|
15403
|
rv ravsco.s yWloleetyC) BatchSyncCollectoC) balchs rv ravsco.s yWloleetyC) BatchSyncCollectoC) balchsynckealsse,c closeaDealstagessC DealFieldsService.c)Decorateacuivily.or© FieldDefinitions.phtC) FieldT vpeConverte0 Hubspotclientinten(C) HubspotTokenman() ResponseNormalizeC) Service.ono.@ SvncFieldAction.oh(C) SvncRelatedActivitsC) WebhookSvncBatcv M intearationAodM Accoccord> DAp.> D Config|DTC> D Filters• U Joos• M ProsnectSearchStrW service lraitsDatacllent.onp© DecorateActivity.phc) Localsearch.one@ LocalSearchInterfa© RemoteSearch.phpC) Service.phpv W ListenersC) ConvertLeadActivitc) PurceLookuocache> M Metadata> D MiarationM Pipedrivev Salesforce• 7 Fields• M OnnortunitvMatcheOpportunitySvncSt• M ProsnectSearchStrC) Client.nhr© DecorateActivity.phT. Delete@biectsTraitl© FieldDefinitions.php© PayloadBuilder.php© Profile.php© QueryBuilder.phpclass Cllent extends Baseclient 1mplements HubspotcllentintertaceA2 A65 ×1 M1 ^oubuc tunction 1sunauthorizedexcention Excention se: 000lreturn str contains(Smessage. "401 unauthorized')1Ihttp 401') |1str contains(Smessage. "status code 401')Corea matche pat• /\6401\b/*, Smessage) &6 str contains(Smessaae.'unauthorized')):N1111=laravel.logA SF [jiminny@localhost]A HS_local [jiminny@localhost]# console [eu)A console [slAviNo)[2026-05-07 14:21:15] local.INF0: [Hubspot] DEBUG Getting headers {V.19 ^V"Uace".L"Inu,0/ May 2020 14.21.10 6Ml"J,"Transter-Encod1nq":|"chunked")"CF-Ray":"9t80deb8db60dcsa-S0F"J."Strict-Transport-Secur1ty":"max-aqe=31536000* 1ncLudeSubDomains: preload")naccent-encoding""server-timing": ["hcid;desc=\"019e02d0-6fd8-7812-bdba-885b7ccb3ee3\","x-hubsoot-correlation-id":"019e02d0-6fd8-7812-bdba-885b7ccb3ee3"l"Set-Cookip"."" c+hm-STlintd0aXVnikSAndaS6h7VVKhzTn0RidvMaheCtmQV-1778163675-1.0.107-May-26 14:51:15 GMT; domain=.hubapi.com; Http0nly; Secure; SameSite=None"),"Report-To":["{"endpoints\":[{"url\":\"https:|\/\\/a.nel.cloudflare.com\\/repcDraa to record a part of the screen. Press LW to select a window."Serven":["cloudflare"]}} {=31"trace_10":"C/AD8565-905t-4604-9405-0e50551e5545%-31* Validates and refreshes the access token if needed before API requests.* This ensures long-running processes don't fail due to token expiration.xactliows soc1alaccountlokenInvalidExcentiony usage:public function ensureValidToken(): voidif (Sthis->oauthAccount === null) {Snewloken = sth1s->tokenManager->ensureval1dloken(sth1s->oauthaccount)rif (SnewToken |== null) {sthis-›accessloken = snewloken:public function getconfigoreturn Sthis->confia:Ireturns onlv active (archived=false)Q usaaesipublic function get0wners): arrayreturn $this->getNewInstance()->crm()-›owners()->getAll() ;*cnanam nool Sanohavon* dretuen arrau<0wnens/r)13 usages1I11-HHubSpot Rate Limit Rj caren (cenviecaea tas excentean secepton) .. )catch (\Exception Sexception) ‹sentry:: captureexcepcion(sexcepcion);Sresponse = sth1s->response->errorinternalError(selt::MESSAGE GENERAL EXCEPTIONSEARCHING)Logicexcepczon excends (exception — so ittalls through to the last catch• Reports to Sentry as a 500 internal error (noisy!),This is the wrong outcome for a transient 429. There's no retry, no backoff, no useful UX!1 CrmController.oho:84lSresponse = ScrmService->find(Sname. Sscones):• Bul 1hornSearchCommand (CLI debug only). So yes - fand() is essentially controller-only. It is a synchronous request driven by user typing in the ChromeWhat should hannen on rate limitlThis is a synchronous HTTP request — we can't release-and-retry like a job. Options, ordered by what l'd recommend:(a) Translate RateLimitException → HTTP 429 with Retry-After header. This is the standard way:• php} catch (RateLimitFycention se) !»ertrortoonanyrequesesl emn search racemtamaced, predse recry shorcty.yThe frontend then shows a friendly "too many searches, retry in N seconds" instead of a generic error. No Sentry noise(b) Inside find(), retry once with a short bounded sleep() (similar to searchCallByRecordingURLToken). HubSpot's SECONDLY policy has retry_ after = 1. Aciinalle aln rectest retrwauldlahsarh the mast common case (secondlvhurst) Can retriec atFa sun chronoue HiiD reauest chanlnlhloa 10c for TEN CECONDT(c) Don't cache failures. Cache:: remember with TTL 300 will not cache an exception, but it does cache successful empty arrays. The 300s caching of find()results actually helps absorb pressure under typina/repeat searches — that's good, leave it!Recommendation: (a) + (b) combined. Catch RateLimitException inside find(), retry once after min(SretryAfter, 1) s, and if it still fails, let it bubble: controllermaps it to HTTP 429 with Retrv-After1. The Existind cleen(1) Retrv in searchcal sForPeriodBvPade / searchcall BvRecordinalRiTokenCurrent code• Service.php:1584-1599} catch (Fycention Seycention) !Sthis->logger->info('(HubSpot) Search calls for period failed'. [...1):Caletearchd lstorPeryoiypase/searchiealtforernoe /sarchCatty teo dinguiLroken), ih onat case we vil oniy tre 8 2l weas tre ered tofnd and other...
|
CleanShot X
|
|
NULL
|
15403
|
|
15402
|
Meet - Daily - Platform
Close tab
New Tab
Open Goo Meet - Daily - Platform
Close tab
New Tab
Open Google Gemini (⌃X)
Tabs from other devices
Open history (⇧⌘H)
Open bookmarks (⌘B)
Customize sidebar
FirefoxFileEditViewHistoryBookmarksProfilesToolsWindowHelplab→meet.google.com/mie-gawc-dsi?authuser=[EMAIL] Yankov (Presenting)| Daily - Platform • now100% <78• Mon 11 May 9:48:169+Platform Team %.Q Searchi boaraAJ Panorama for Callscoring n coAUTOMATEO AI EGORINGReady for DevA sy-20361Setup test coverage forProphet in SonarMASNTENANCEE 3Y-19951C Jy 20151 Servic© PlanhaX Jmim8 PromoO Attent0 Cals -https://yminny.atlassian.net/jira/software/c/projects/JY/boards/37?selectedissue=JY-20493D ProjectsE Datadog* ClaudeJY-70541 1 J7-40483Smart Instant Nudge Pre-filteringDescriptionProblem:E Nudge Festure Performaence Recommendstions | Probiem 85: Instart Noudge Dikpalen FloodSolution:E Nudge Feature Performance Recommendations | Solution 2: Smart Instant Nudge Pre fitering (P))[EMAIL]:35-69For every AnalyticsConpletedEvent (one per new activity), the job loads every Activity\Search in the team that has arweone tn noorenooichosocrercheetnoeWinoucomoinetemeweeiytsearch fiters.PrecessNudgeSeatcAJob (ProcessNudgeSearchJ0D.php:42-98) then runs an ES onDenand$croll plus a DB dedup chunkloop (NudgeRunFactozy-php:195-225 ). When 0 new activities are found il bails on line 75 - but onty after the ES round-tripaeoueworkno0 SUCwossLinked work itemsAdd linked work iter*0.Ca Transp3 CirclechSentryL tasкCode Review -K2 Improve StoryDetailsAssigneeNikolay IvanorAssign to meKwoortNikolay NkolovDevelopmentQ Open with VS Code1 branch8 commits1 pull request2 bulidsComponentsPlatformAdd optionsLabels© JmineX MCP0 Der3 days agoMon 11 May 9:48• эppіб:L Al BookmarxsGroup: QuenesAI Reports > Empty pagedesign and promotionAJREPORTSDeployed8 205721 1eaas=SFCK VA ALUIC8-2072618 %0=Allow users to aeiete SSand Panorama promptswhen those are used in a...AIREIORTSDecloyed020770 8 8800=Release AJ PanoramaAJREPORTSR-20740 05 11 .000:pummary in the CRMStefka StoyanovaNikolay Yankov4 othersAneliya AngelovaLukas Kovalik9:48 AM | Daily - Platform...
|
Firefox
|
Meet - Daily - Platform — Work
|
NULL
|
15402
|
|
15401
|
FV faVsco.js°9 JY-20725-handle-HS-search-rateroled FV faVsco.js°9 JY-20725-handle-HS-search-rateroledey© BatchSyncCollectolyhuospotsyncstrategybase.ongCachedcrmservicebecorator.onp© ProspectCache.phpe balchsynckealsseС Cпескапокetrукemotematch.ongc clientonec closeaDealstagess @ MatchacuivitycrmData.ong© ermactivilyservice.phgDealrielasservice.gc)Decorateacuivilv.or© FieldDefinitions.phrclass Cllent extends Baseclient 1mpLements HubspotclientintertaceM A2 A65 X1X1 AC) FieldT vpeconvertee Hubspotclientinterc) Hubspotlokenman© PayloadBuilder.phpC) RemotecrmobiectnP ResponseNormalizec) Service,onoC)SvncFieldAction.onC) SvncRelatedActivitC) WebhookSvncBatclv MintearationAorM AcceccorsConfigD DTO• M SiltersJobs• M ProcnectSearchStr.W service Iralts© DataClient.php© DecorateActivity.phcLocalsearch.oneu LocalSearchintertac© RemoteSearch.phpc) Service.phpv W Listeners© ConvertLeadActivitc) PurceLookuocache> M Metadata> Miarationa Pioedrivev Salesforce• D Fields• M OnnortunitvMatcheMOnnortunitvSvneSt897 (> M ProsnectSearchStr:M ServiceTraitcC) Client nhr© DecorateActivity.ph. Delete@biectsTrait© FieldDefinitions.php© PayloadBuilder.php© Profile.php© QueryBuilder.phpoubuc tunction 1sunauthorizedzxcention Excention se: 000ureturn str contains(Smessage. "401 unauthorized')Istr contains(Smessage.'http 401') |1str_contains(Smessage, 'status code 401') |(orea match( pattern: • /\b401\b/* Smessage) &s str contains(Smessage. 'unauthorized')):* Validates and refreshes the access token if needed before API requests.* This ensures long-running processes don't fail due to token expiration.* @throws SocialAccountTokenInvalidExceptiony usagespublic function ensureValidToken: voidif (Sthis->oauthAccount === null) {Snewloken = sthis->tokenmanaqer->ensureval1dloken(sth1s->oauthaccount)rif (SnewToken !== null) {sthis-›accessloken = snewloken:public function getConfigoreturn Sthis->confia:returns onlv active (archived=false)9 usadespublic function get0wners: arrayreturn $this->getNewInstance()->crm()->owners()->getALL();* apanam bool Sarchived* dreturn arrau<ownens/rn13 usages4 Dally - Platrorm100% • MOn 11 May 9.40.12AskJiminnyReportActivityServiceTest v D :+0 ..11 1l=custom.log ^=laravel.logA SF (jiminny@localhost]4 HS_local [jiminny@localhost]# console [PKob.# console leu)# console [slAGiNG)[2026-05-07 14:21:15] local.INF0: [Hubspot] DEBUG Getting headers {"neaders".?"Uace":L"Inu,or May 2020 14.21.15 6Ml"Jn"Transter-Encod1nq":"chunked")."Connection":"keep-alive""CF-Ray":L"9t80debödb60dcsa-S0F"J,"Strict-Transport-Secur1ty":"max-aqe=31536008* 1ncLudeSubDomains: preload")n"Vary"*"orioin.accent-encodino""access-control-allow-credentials": ["false"]."server-timing": ["hcid;desc=\"019e02d0-6fd8-7812-bdba-885b7ccb3ee3\","x-hubspot-correlation-id":["019e02d0-6fd8-7812-bdba-885b7ccb3ee3"],"So+-Cookie"." c+hm-Stlirtd0aXVr.kSandas6hzVVKhzTn0BidvMaheCtm0V-1778163675-1.0.107-May-26 14:51:15 GMT; domain=.hubapi.com; Http0nly; Secure; SameSite=None"],"Report-To":["{"endpoints\":[{"unl".httns:la.nel.cloudflane.com./renon+W/v42c=NVA1cVTPQfVm32anS0#xVF/sd2RN"group\":\"cf-nel\","max_age\":604800}"],"NEL": ["1\"success_fraction\":0.01,reportto. "cr-nel,"max age":604800}"]"Server": ["cloudflare"]}} {"correlation_1d":"95256555-ec98-4541-b09za-adta/SboYeab"."trace_10":"C/AD8565-905t-4604-9405-0e5b551e5545I IIllC;CascadeHubspot Rate Limit Rej caten (eanecaea tas sextentan sexcepten) .)catch\Sentry:: captureException($exception);Sresponse = sthis→>response→>errorinternalError selt::MESSAGE GENERALEXCEPTIONSEARCHING=RateLimicexcepcion excepczon excends excepcion = so it talls through to the last catch• Reports to Sentry as a 500 internal error (noisy!)• Returns errorInternalError to the client (extension shows "something went wrong")• The user has no idea this is transientThis is the wrong outcome for a transient 429. There's no retry, no backoff, no useful UX.Contirmed callersCrmController.php:84Sresponse = ScrmService->find(Sname, Sscopes):* Bul lhornSearchCommand (CLI debug only). So yes - fand() is essentially controller-only. It is a synchronous request driven by user typing in the ChromeWhat should hannen on rate limitThis is a cunchronous HTTD reauest — we canlt releace-and-retrv like a ich Ontions ordered hv what I'd recommend.(a) Translate RateLimitException → HTTP 429 with Retrv-After header. This is the standard wav.D php} catch (RateLimitException $e) {return Sthis->response->setStatusCode(429)»ertrortoomanynequessl ern search race-tamared, predse reury shorcty.eThe frontend then shows a friendly "too many searches, retry in N seconds" instead of a generic error. No Sentry noise.(b) Inside find(), retry once with a short bounded sleep() (similar to searchCallByRecordingURLToken). HubSpot's SECONDLY policy has retry_after = 1 . Asinale 1sln-reauest retry.wouldlahsorh.the.most.common.case//secondlvlhurst Can.retries.at=a.svnchronousHTiTD reauest.shouldnlfhlock 10s/for TEN_SECONDI( Dunit cachofalures, (achesitreaber wit T. 0 il o ech an exception, butit does cache sucestil empy arcys. The 8009 eacthias et fandlresults actually helps absorb pressure under typina/repeat searches — that's good, leave it.Recommendation: (a) + (b) combined. Catch RateLimitException inside find(), retry once after min(SretryAfter, 1) s, and if it still fails, let it bubble: controllermaps it to HTTP 429 with Retrv-After7. The Syictind cleen(1) Retrv in searchcall cForPeriodBvPade cearchcal BvRecordinauRLTokenCurrent code• Service.php:1584-15993 catch (Fycention Ceycention)Sthis->logger→>info('[HubSpot) Search calls for period failed'. [...1):OK lets make it extremely simple. Only consider eclient- phpffL220-229 for CHubspotPaginationservice.php#fL162-198 lwill remove it from finPo. 4 spac...
|
Notion Calendar
|
NULL
|
NULL
|
15401
|
|
15400
|
+FirefoxFileEditViewHistoryBookmarksProfilesToolsW +FirefoxFileEditViewHistoryBookmarksProfilesToolsWindowHelpahl→meet.google.com/mie-gawc-dsi?authuser=[EMAIL] Yankov (Presenting)7 Placte*© Jmine83 мCR51 Servicx JmimL Moeets11 Open83 PromsO Attent0 Cals -Ca Transp@ SSH|J croec.SentryJy 20493 smart instant nudge pre filtering #12053cikalerbiaisanser wants to merge 8 commits into saster trom JY-28493-snart-instant-nudse-pre-falteringpluckl users.3d=>LoArrayl):L Lasк•$вакусак толаино зсоредоase/Conponent./Nudor/Job/Process0rgantsation/mnediateNudoes.job.php (OutdatlSactivity - Activity:twith(['user*])->uvid(Sthis-activity0uid, false)-»firstorfa |sactivity • Activityssvithiluser.group')-uuid(sthis-vactivityUusd, false)->f1r|LakyLak 3.days. a99Both checkCategoryld and checkStageld methods call Sactivity->getCategory0 and Sactivity->getStage0.l unese re suonsn ps aren t eoger-loddeo, tarave wl exccute a new datsosse query tor evory creck insroethe loop.Sactivity • Activity: swith(['user.group", "category", "stage"])->uuid(sthis-nactivity0uis,Kesorve cottversasonLakyLak approved these changes 3 days agoView reviewed changes9:48 AM | Daily - Platform| Daily - Platform • nowAll-In-One( Capture AreaC.: Capture Previous Area• Capture FullscreenCapture Windowi Scrolling CaptureSelf-TimerAa Capture Text (OCR)Record ScreenHide Desktop Icons• Open...& Pin to the Screen...D Capture History...About CleanShot...Check for Updates...Settings...Quit100% C8• Mon 11 May 9:48:159• & 4•₴ 3TKTOTRTBoyanovaNikolay Yankov4 others28,AngelovaLukas Kovalik...
|
Notion Calendar
|
NULL
|
NULL
|
15400
|
|
15399
|
Meet - Daily - Platform
Close tab
New Tab
Open Goo Meet - Daily - Platform
Close tab
New Tab
Open Google Gemini (⌃X)
Tabs from other devices
Open history (⇧⌘H)
Open bookmarks (⌘B)
Customize sidebar
Nikolay Yankov (Presenting)
Nikolay Yankov (Presenting)
People
9
Take notes with Gemini
Take notes with Gemini
Gemini
Gemini
Pop out this video More screens are more fun. Play this video while you do other things.
Pop out this video
More screens are more fun. Play this video while you do other things.
Zoom in
Open in new window
Enter Full Screen
Pop out this video More screens are more fun. Play this video while you do other things.
Pop out this video
More screens are more fun. Play this video while you do other things....
|
Firefox
|
Meet - Daily - Platform — Work
|
meet.google.com/mie-gawc-dsi?authuser=lukas.kovali meet.google.com/mie-gawc-dsi?authuser=lukas.kovalik@jiminny.com...
|
15399
|
|
15398
|
Meet - Daily - Platform
Close tab
New Tab
Open Goo Meet - Daily - Platform
Close tab
New Tab
Open Google Gemini (⌃X)
Tabs from other devices
Open history (⇧⌘H)
Open bookmarks (⌘B)
Customize sidebar
Nikolay Yankov (Presenting)
Nikolay Yankov (Presenting)
People
9
Take notes with Gemini
Take notes with Gemini
Gemini
Gemini
Pop out this video More screens are more fun. Play this video while you do other things.
Pop out this video
More screens are more fun. Play this video while you do other things.
Zoom in
Open in new window
Enter Full Screen
Pop out this video More screens are more fun. Play this video while you do other things.
Pop out this video
More screens are more fun. Play this video while you do other things.
Stefka Stoyanova
Pop out this video More screens are more fun. Play this video while you do other things.
Pop out this video
More screens are more fun. Play this video while you do other things.
Nikolay Yankov
Pop out this video More screens are more fun. Play this video while you do other things.
Pop out this video
More screens are more fun. Play this video while you do other things.
Aneliya Angelova
User profile picture User profile picture 4 others
4 others
Pop out this video More screens are more fun. Play this video while you do other things.
Pop out this video
More screens are more fun. Play this video while you do other things.
Lukas Kovalik
Others might see more of your background. Click to view your full video.
9:48
AM
Daily - Platform...
|
Firefox
|
Meet - Daily - Platform — Work
|
meet.google.com/mie-gawc-dsi?authuser=lukas.kovali meet.google.com/mie-gawc-dsi?authuser=lukas.kovalik@jiminny.com...
|
15398
|
|
15397
|
Meet - Daily - Platform
Close tab
New Tab
Open Goo Meet - Daily - Platform
Close tab
New Tab
Open Google Gemini (⌃X)
Tabs from other devices
Open history (⇧⌘H)
Open bookmarks (⌘B)
Customize sidebar
Nikolay Yankov (Presenting)
Nikolay Yankov (Presenting)
People
9
Take notes with Gemini
Take notes with Gemini
Gemini
Gemini
Pop out this video More screens are more fun. Play this video while you do other things.
Pop out this video
More screens are more fun. Play this video while you do other things.
Zoom in
Open in new window
Enter Full Screen
Pop out this video More screens are more fun. Play this video while you do other things.
Pop out this video
More screens are more fun. Play this video while you do other things.
Stefka Stoyanova
Pop out this video More screens are more fun. Play this video while you do other things.
Pop out this video
More screens are more fun. Play this video while you do other things.
Nikolay Yankov
Pop out this video More screens are more fun. Play this video while you do other things.
Pop out this video
More screens are more fun. Play this video while you do other things.
Aneliya Angelova
User profile picture User profile picture 4 others
4 others
Pop out this video More screens are more fun. Play this video while you do other things.
Pop out this video
More screens are more fun. Play this video while you do other things.
Lukas Kovalik
Others might see more of your background. Click to view your full video.
9:48
AM
Daily - Platform
Daily - Platform
Audio settings
Turn on microphone
Video settings
Turn off camera
Nikolay Yankov is presenting
Send a reaction
Turn on captions
Raise hand (ctrl + ⌘ + h)
More options
Leave call
Meeting details
Chat with everyone
Meeting tools...
|
Firefox
|
Meet - Daily - Platform — Work
|
meet.google.com/mie-gawc-dsi?authuser=lukas.kovali meet.google.com/mie-gawc-dsi?authuser=lukas.kovalik@jiminny.com...
|
15397
|
|
15396
|
Meet - Daily - Platform
Close tab
New Tab
Open Goo Meet - Daily - Platform
Close tab
New Tab
Open Google Gemini (⌃X)
Tabs from other devices
Open history (⇧⌘H)
Open bookmarks (⌘B)
Customize sidebar
Nikolay Yankov (Presenting)
Nikolay Yankov (Presenting)
People
9
Take notes with Gemini
Take notes with Gemini
Gemini
Gemini
Pop out this video More screens are more fun. Play this video while you do other things.
Pop out this video
More screens are more fun. Play this video while you do other things.
Zoom in
Open in new window
Enter Full Screen
Pop out this video More screens are more fun. Play this video while you do other things.
Pop out this video
More screens are more fun. Play this video while you do other things.
Stefka Stoyanova
Pop out this video More screens are more fun. Play this video while you do other things.
Pop out this video
More screens are more fun. Play this video while you do other things.
Nikolay Yankov
Pop out this video More screens are more fun. Play this video while you do other things.
Pop out this video
More screens are more fun. Play this video while you do other things.
Aneliya Angelova
Galya Dimitrova
Steliyan Georgiev
Nikolay Nikolov
Pop out this video More screens are more fun. Play this video while you do other things.
Pop out this video
More screens are more fun. Play this video while you do other things.
Nikolay Ivanov
Pop out this video More screens are more fun. Play this video while you do other things.
Pop out this video
More screens are more fun. Play this video while you do other things.
Lukas Kovalik
Others might see more of your background. Click to view your full video.
9:48
AM
Daily - Platform
Daily - Platform
Audio settings
Turn on microphone
Video settings
Turn off camera
Nikolay Yankov is presenting
Send a reaction
Turn on captions
Raise hand (ctrl + ⌘ + h)
More options
Leave call
Meeting details
Chat with everyone
Meeting tools...
|
Firefox
|
Meet - Daily - Platform — Work
|
meet.google.com/mie-gawc-dsi?authuser=lukas.kovali meet.google.com/mie-gawc-dsi?authuser=lukas.kovalik@jiminny.com...
|
15396
|
|
15395
|
Meet - Daily - Platform
Close tab
New Tab
Open Goo Meet - Daily - Platform
Close tab
New Tab
Open Google Gemini (⌃X)
Tabs from other devices
Open history (⇧⌘H)
Open bookmarks (⌘B)
Customize sidebar
Nikolay Yankov (Presenting)
Nikolay Yankov (Presenting)
People
9
Take notes with Gemini
Take notes with Gemini
Gemini
Gemini
Pop out this video More screens are more fun. Play this video while you do other things.
Pop out this video
More screens are more fun. Play this video while you do other things.
Zoom in
Open in new window
Enter Full Screen
Pop out this video More screens are more fun. Play this video while you do other things.
Pop out this video
More screens are more fun. Play this video while you do other things.
Stefka Stoyanova
Pop out this video More screens are more fun. Play this video while you do other things.
Pop out this video
More screens are more fun. Play this video while you do other things.
Nikolay Yankov
Pop out this video More screens are more fun. Play this video while you do other things.
Pop out this video
More screens are more fun. Play this video while you do other things.
Aneliya Angelova
Galya Dimitrova
Steliyan Georgiev
Nikolay Nikolov
Nikolay Ivanov
Pop out this video More screens are more fun. Play this video while you do other things.
Pop out this video
More screens are more fun. Play this video while you do other things.
Lukas Kovalik
Others might see more of your background. Click to view your full video.
9:48
AM
Daily - Platform
Daily - Platform
Audio settings
Turn on microphone
Video settings
Turn off camera
Nikolay Yankov is presenting
Send a reaction
Turn on captions
Raise hand (ctrl + ⌘ + h)
More options
Leave call
Meeting details
Chat with everyone
Meeting tools...
|
Firefox
|
Meet - Daily - Platform — Work
|
meet.google.com/mie-gawc-dsi?authuser=lukas.kovali meet.google.com/mie-gawc-dsi?authuser=lukas.kovalik@jiminny.com...
|
15395
|