Looking for help building HTTP Request for Klaviyo

Looking to build a workflow for Klaviyo that can take information from a previous node (i.e Google Sheet) and sends that information via an HTTP Request to Klaviyo. The goal would be to kick off an email with a premade template that replaces the name and a dynamic link based on information from Google Sheets.

And the email of course would be provided to kick off the initial email.

All I’m getting in the last node (HTTP Request) is just data [0] so it doesn’t look like anything is being passed to Klaviyo and I don’t see any sends on Klaviyo’s end so something is broken.

  1. Currently I’m built a simple workflow with a Webhook so I can send the data via Postman (name, email and URL).

  2. Workflow: n8n.io - Workflow Automation

  3. Output:
    | — | — |

Information on your n8n setup

  • n8n version: Latest?
  • Database (default: SQLite): Unsure
  • n8n EXECUTIONS_PROCESS setting (default: own, main): Unsure
  • Running n8n via: n8n cloud
  • **Operating system: Mac **

Hi @First_Spark_Digital, welcome to the community!

I am afraid the link you have shared requires a login. Perhaps you can copy the workflow from your n8n instance by first selecting all relevant nodes, then copy them using Ctrl+C? After redacting anything confidential you can then post the workflow here on the forum.

In addition, to make sure you’re using the latest version of n8n’s ai-beta image and make sure we’re on the same page, can you head over to your n8n cloud dashboard and click the Restart workspace button at the bottom?

Thanks for the welcome.

I’ve pasted the code below as requested. Let me know if that works.

So from testing, you’re definitely sending a valid HTTP Request here, I quickly tested this using webhook.site and a slightly modified version of your workflow without the webhook node:

This is what’s arriving on the server:

So I very much suspect this is just a minor issue with the data being sent in the wrong format or something along these lines.

Do you have a the request you’re making in the HTTP Request node working outside of n8n (for example curl or Postman) by any chance? If so, can you share it using the cURL format (of course with redacted data again to avoid sharing anything secret)?

If not, can you share a link to the respective API documentation?

Nevermind @First_Spark_Digital , I think I found it. They seem to expect the data in a single data field in the body of your request rather than through query parameters.

This should work like so in n8n:

This comes through in my free Klaviyo account as expected (using a valid public API key of course):

Keep in mind that the response is supposed to be more or less empty as per their docs, so you wouldn’t get much in n8n unless you enable the “Include Response Headers and Status” option of the HTTP Request node:

Hope this helps :slight_smile:

Much appreciated! And apologies for the delayed response.

And nice work! Can you explain what you mean by the response should be empty?

Also wondering if it’s possible with this HTTP Request leverage to send an email from an existing workflow.

Because my end goal is to send an email from the workflow (a templated design) which leverages a dynamic variables name and url in each email.

Oh, I just mean their API isn’t very talkative. Kind of what you have seen when you encountered your { "data": 0 } error response. Nothing to worry about, but definitely something to keep in mind when working with it.

Also wondering if it’s possible with this HTTP Request leverage to send an email from an existing workflow.

Looks like it. Klaviyo document how to trigger a campaign to send asynchronously here:

You can copy the curl request they provide in their docs and import it in n8n’s HTTP Request node using the Import cURL button:


Super helpful! Thank you. Need to just sort out the Code (prior node) to pull in the data from the Google Sheets node so I can have it pull dynamically the name and URL.

Glad to hear this helps! You wouldn’t need the Code node to read data from a previous node, a simple expression should hopefully do the job as well :slight_smile:

Realized I didn’t even need to have the node kick start a workflow. Simply adding to a list is the easiest way to get them in a workflow.

However now I’m running into an issue where it keeps saying:

ERROR: Authorization failed - please check your credentials

401 - “{"errors":[{"id":"ebf1dad3-0c08-4fd1-ad01-33aeb1be51c7","status":401,"code":"not_authenticated","title":"Authentication credentials were not provided.","detail":"Missing or invalid authorization scheme. Please use Klaviyo-API-Key.","source":{"pointer":"/data/"}}]}”

I looked at the flow you did and it’s slightly different than what the API docs say to use for the subscribing a new user. When I import the cURL it wants me to use “https://a.klaviyo.com/api/lists/[LISTID]/relationships/profiles/

And then Authorize (see image) with my API. But I’m copying my API exactly and it’s still giving me this error.

Hi @First_Spark_Digital, you might need to remove the Authorization value from your “Header Parameters” list if you’re also sending an Authorization header through your credentials.

Also, can you confirm you are sending a value like Klaviyo-API-Key your-private-api-key for your Authorization header? This private key is different from the public key previously used and would need to be created explicitly on the respective Klaviyo screen:

1 Like

That was the missing piece! I didn’t have Klaviyo-API-Key then the private key. I just had the private key.

Much appreciated!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.