klaviyo / klaviyo-php-sdk

PHP SDK for Klaviyo API
https://developers.klaviyo.com
MIT License
17 stars 9 forks source link

Question about which API key to use #3

Closed petehouston closed 2 years ago

petehouston commented 2 years ago

After reading the API Overview documentation, I wonder if I want to use both Profile API and Track API, do I have to create 2 Klaviyo\Client instances that is init with two different public/private API keys?

jon-batscha commented 2 years ago

Hey! Really appreciate you reaching out, and apologies for any lack of clarity, will add an FAQ section to the README, as you're not the first to raise this question.

As the SDK currently stands, you should instantiate the client with your private key. When sending a track or identify call (the only operations that require a public key), you should include the public key as part of the payload, as described in the corresponding section of our API Docs (e.g: track or identify).

Hopefully that clarifies your question, but please do follow up if I can add any additional color.

petehouston commented 2 years ago

Okay, I'm a bit confused about the public key, do I need to perform base64 encode? In this page, https://developers.klaviyo.com/en/docs/authenticate , it mentions to encode using base64, however, nowhere in this page suggests to encode https://developers.klaviyo.com/en/reference/track-post

jon-batscha commented 2 years ago

Apologies for the confusion, that first page you linked to is outdated and needs to be updated. You do not need to do any base64 encoding for the SDK, or for that POST endpoint in general.

petehouston commented 2 years ago

Thanks, your answers cleared out my questions.