Skip to main content
Solved

Api and campaign links - How to use ?


Forum|alt.badge.img

Hello,

 

I’am a new in this API, but I can get all working fine in this as JSON responce, but I would like to use this link to show this campaing in my website. Only problem is that this link is not working due no authorize.  How to get this visual ?

},

    "links": {

        "self": "https://a.klaviyo.com/api/campaigns/xxxxxxxxxxxxxxxx"

    }

Best answer by MANSIR2094

Hello ​@kkontti , It looks like you're trying to display the campaign from Klaviyo on your website, but the link isn’t working because it's not authorized. To show the campaign visually on your site, you'll need to use an API key to authenticate the request.

Here's how you can do it:

  1. Get an API Key: Go to your Klaviyo account settings and generate an API key.
  2. Add Authorization: When making the request to the campaign link, make sure you include the API key in the headers for authorization.
  3. Display the Campaign: Once the request is authorized, you can use the campaign data (usually in HTML format) to display it on your website.

If you’re unsure how to implement this, I recommend reaching out for help with setting up the authorization and embedding the campaign on your site.

View original
Did this topic or the replies in the thread help you find an answer to your question?

3 replies

Christiannoerbjerg
Expert Problem Solver II
Forum|alt.badge.img+12

Hi ​@kkontti 

Thank you for posting in the Community!

Could you possibly elaborate? Would love to help! :-) 

Christian Nørbjerg Enger
Partner & CPO
Web: Segmento.dk
LinkedIn: @christianfromsegmento
Voldbjergvej 22b, 8240 Risskov


Amos Peace
Problem Solver III
Forum|alt.badge.img+5
  • Problem Solver III
  • 47 replies
  • January 18, 2025

Hi ​@kkontti,

The issue you're encountering is because the Klaviyo API link requires proper authentication to access campaign details. Without authentication, you won't be able to retrieve or display the campaign information on your website.

 

Here's how you can resolve it:

  1. Generate an API Key

    • In Klaviyo, go to Account Settings > API Keys and create a private key with the required permissions.
  2. Set Up a Backend Server

    • Use a backend (e.g., Node.js) to securely fetch campaign data from Klaviyo.
  3. Fetch Data on the Frontend

    • Call your backend endpoint from your website.
  4. Secure the API Key

    • Store the API key in environment variables and never expose it in frontend code.

By setting up a backend to handle the API request, you can securely display campaign data on your site.

Let me know if you need help.

 

 

 

Best Regards,

+2349023453575

 


MANSIR2094
Problem Solver IV
Forum|alt.badge.img+13
  • Problem Solver IV
  • 174 replies
  • Answer
  • January 18, 2025

Hello ​@kkontti , It looks like you're trying to display the campaign from Klaviyo on your website, but the link isn’t working because it's not authorized. To show the campaign visually on your site, you'll need to use an API key to authenticate the request.

Here's how you can do it:

  1. Get an API Key: Go to your Klaviyo account settings and generate an API key.
  2. Add Authorization: When making the request to the campaign link, make sure you include the API key in the headers for authorization.
  3. Display the Campaign: Once the request is authorized, you can use the campaign data (usually in HTML format) to display it on your website.

If you’re unsure how to implement this, I recommend reaching out for help with setting up the authorization and embedding the campaign on your site.