From 5450d512574670ea4c00fbb452b9877487aa0cef Mon Sep 17 00:00:00 2001 From: Bradley Schofield Date: Thu, 23 Nov 2023 12:44:52 +0000 Subject: [PATCH 1/2] Update list API to v3 --- src/Analytics/Adapter/HubSpot.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/Analytics/Adapter/HubSpot.php b/src/Analytics/Adapter/HubSpot.php index 14c0212..e8e3e40 100644 --- a/src/Analytics/Adapter/HubSpot.php +++ b/src/Analytics/Adapter/HubSpot.php @@ -319,11 +319,9 @@ public function syncAssociation(string $accountId, string $contactId, string $ro public function addToList(int $listId, int $contactId): bool { try { - $this->call('POST', '/contacts/v1/lists/'.$listId.'/add', [ + $this->call('PUT', '/crm/v3/lists/' . $listId . '/memberships/add', [ 'Content-Type' => 'application/json', - ], [ - 'vids' => [$contactId], - ]); + ], [$contactId]); return true; } catch (\Exception $e) { From abd0f8ae51bf4fec9bd37b3f73a28cd1f1a974bf Mon Sep 17 00:00:00 2001 From: Bradley Schofield Date: Thu, 23 Nov 2023 12:46:23 +0000 Subject: [PATCH 2/2] Run Linter --- src/Analytics/Adapter/HubSpot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Analytics/Adapter/HubSpot.php b/src/Analytics/Adapter/HubSpot.php index e8e3e40..7677398 100644 --- a/src/Analytics/Adapter/HubSpot.php +++ b/src/Analytics/Adapter/HubSpot.php @@ -319,7 +319,7 @@ public function syncAssociation(string $accountId, string $contactId, string $ro public function addToList(int $listId, int $contactId): bool { try { - $this->call('PUT', '/crm/v3/lists/' . $listId . '/memberships/add', [ + $this->call('PUT', '/crm/v3/lists/'.$listId.'/memberships/add', [ 'Content-Type' => 'application/json', ], [$contactId]);