You can then use the profile ID that gets returned to update the profile. Hope that helps.
Thank you, Jallain! That did exactly the trick
I am now trying to pass a variable into:
GET https://a.klaviyo.com/api/v1/person/{{ PERSON_ID }}
I keep getting 404 NOT FOUND response codes
This is my formatted URL
GET https://a.klaviyo.com/api/v1/person/{ticket.requester.integrationss83684].id}?api_key=XXXXXX
I believe this to be a GORGIAS issue, but any insight into what might be causing the problem from the klaviyo url standpoint?
@dlshaw9 it sounds like the request is working but the PERSON_ID you are providing is not one that exists in your Klaviyo account. Are you using the ID of the profile from Klaviyo or the ID from something else?
@dlshaw9 it sounds like the request is working but the PERSON_ID you are providing is not one that exists in your Klaviyo account. Are you using the ID of the profile from Klaviyo or the ID from something else?
The data in the GORGIAS import matches the ID in Klaviyo -- I must just not be pulling the variable address correctly
@dlshaw9 are you using the Klaviyo public API key or the Klaviyo private API key in your request? Make sure to use the private API key which begins with pk_
I removed a bit of my censoring:
GET https://a.klaviyo.com/api/v1/person/{ticket.requester.integrations[83684].id}?api_key=pk_4fXXXXXX
@dlshaw9 are you able to log the variable to ensure that it is the correct profile ID? Your request URL looks correctly structured and you are getting a response from the API so perhaps the ID is getting pulled incorrectly somehow?
That has to be the issue
Is a single set of curly brackets the correct syntax to pass that variable (it doesn’t trigger at all with double curlies)?
OK so I have confirmed via the Gorgias Macro tool that the variable pulls the right data -- for some reason it does not convert to a string when it passes the url
@dlshaw9 There should not be any curly braces in the actual request itself. The URL should look like this:
Even though I am attempting to pass a variable through?
For example, your earlier solution to my initial question to get the id worked with:
GET https://a.klaviyo.com/api/v2/people/search?email={{ticket.customer.email}}&api_key=pk_4f04XXXXXXXXXXXX
furthermore, I keep getting a 403 Error - "message": "You must specify an API key to make requests." when I try to pass API through header.
What’s the proper format for the api_key: pkXXXX
@dlshaw9 What I mean is that the final URL that the request is actually being sent to should not have any curly braces in it where the IDs are supposed to go. The curly braces are a part of whatever language you are using which is trying to interpolate the variable passed into it as part of the string. You may need to use a single or double curly brace to pass in a variable but the final URL string should not contain the curly braces.
The 403 error you are getting about the api_key not being specified is probably just a side effect of the URL not being constructed correctly. It is likely being cut off before the api_key is included at the end. You can test the URL by simply entering it into the URL address bar of your browser and if you include the correct profile ID and api_key you will see the JSON of the profile you are asking for.
I really appreciate your help! I can confirm the variable is correct -- the JSON just isn’t translating it to the url
I don’t see it mention that you can pass the api_key as a header to that API. I know other APIs of ours accept it as a header but this might only accept it as key=value pairs in the URL itself.
Excellent. Just making sure I wasn’t missing something -- thank you.
Do you know of anything in my URL that Klaviyo API requires for a variable.
For example in my successful variable URL:
GET https://a.klaviyo.com/api/v2/people/search?email={{ticket.customer.email}}&api_key=pk_4f04XXXXXXXXXXXX
it has the “search?email=” string -- I know I am just grasping at straws now, but it is driving me crazy haha
@dlshaw9 This URL has a similar structure to that one as well. It ends:
/person/AAAAA?api_key=pk_BBBBB
The AAAAA is the variable in this case for whatever profile ID you are trying to get. the BBBBB can be replaced with your API key.
Did you test the URL in the browser like I mentioned in a previous message? If you take the whole URL and enter it into the browser and hit enter are you seeing the JSON of the profile displayed? Here is an example of what I mean:
Yes I was -- I think everything on your end is functioning perfectly. It appears as if something is broken with the variable transformation of the JSON request in Gorgias.
Thank you for all of your help!
Hi @dlshaw9 hope you’re well, i’m looking for some help and you might be able to help :-)
It’s fairly simple: we want to implement a preferences form hosted by Klaviyo but we can’t pass the email address over from account to the form, so want to do a check to make sure the customer has entered the correct email and that they already exist as a profile in Klaviyo. From my research I can see this may be possible by creating a custom-built form and utilising the API to verify the email. Do you think that utilising person_ID might be a solution to this?
@dlshaw9 did you get this working in the end, i think i am trying to do the same thing as you. it is incredibly frustrating that you cant GET the person by email in just one call, do i take it that you have done two separate integrations, the first one to get the person_id via email and then the second one to get the person via the id
did you get the second one working, if so, pleasde could you share an obfuscated url example, using gorgias variables, thanks