klaviyo / php-klaviyo

PHP wrapper for the Klaviyo API
59 stars 47 forks source link

POST vs GET - Track Endpoint #67

Closed iBotPeaches closed 3 years ago

iBotPeaches commented 3 years ago

So I'm currently trying to implement this SDK and ran into some issues because I'm pushing far too much data that can be in a URL.

My snippet looked like:

    public function invitedUserEvent(User $user): void
    {
        $event = new EventModel([
            'event' => EventType::INVITED_USER,
            'customer_properties' => [
                '$email' => $user->email
            ],
            'properties' => [
              // email properties
            ]
        ]);

        $this->publicAPI->track($event);
    }

The docs say the GET version of this track method is not recommend, instead using the POST https://apidocs.klaviyo.com/reference/track-identify. However, outside of manually constructing the KlaviyoAPI class and passing in all parameters/configs to manually make the POST call - I'm not sure how to use the POST iteration of this.

ogsmith commented 3 years ago

Hello iBotPeaches, please use our new post method.

eg: $request = $client->publicAPI->track( $event, $post='POST' );

Thanks!

iBotPeaches commented 3 years ago

thanks @ogsmith, but I don't see that parameter in my copy. It must not be released yet.

iBotPeaches commented 3 years ago

All good in 2.3.3 now. Thanks!