Skip to main content

Subscribing a Profile doesn't add it to the list


Forum|alt.badge.img+2

Hello everyone!

I am encountering a weird issue trying to subscribe an email through the API. I have a custom form created on a NextJS application, and whenever a user adds their email, i post the email to https://a.klaviyo.com/api/profile-subscription-bulk-create-jobs/ with all the required options (code further down.) I get back a 202 response with the status “Accepted”, but, the email cannot be found in a list, or anywhere for that matter.

The list has the “Double opt in” disabled.

 

Im saying its weird because a week ago everything worked without any issue and no change to the code happened since. And also the response seems ok. 

 

Here is the code i am using: 

async function subscribe(request, response) {
  const { email, listId } = JSON.parse(request.body);
  const options = {
    method: "POST",
    headers: {
      accept: "application/json",
      revision: "2023-02-22",
      "content-type": "application/json",
      Authorization: `Klaviyo-API-Key ${APIKey}`,
    },
    body: JSON.stringify({
      data: {
        type: "profile-subscription-bulk-create-job",
        attributes: {
          list_id: listId,
          custom_source: "Marketing Website",
          subscriptions: [
            {
              channels: { email: ["MARKETING"] },
              email,
            },
          ],
        },
      },
    }),
  };

  try {
    const res = await fetch(
      "https://a.klaviyo.com/api/profile-subscription-bulk-create-jobs/",
      options
    );
    response.json({
      response: res,
    });
  } catch (error) {
    response.json({
      error
    });
  }
}

Ive triple checked the list id exists and is sent correctly, triple checked the API key is correct. 

Ive tried creating a brand new list and still doesn't work. 

Ive ran out of options so any ideas would be helpful. 

Thank you!

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

3 replies

chloe.strange
Community Manager
Forum|alt.badge.img+42
  • Community Manager
  • 436 replies
  • March 28, 2023

Hi @stardiodev

Thanks for being a part of our community! We recently made a change that may have positively impacted this issue (blocked IPs). Can you please confirm that you are still missing these users?I look forward to hearing back from you soon!

~Chloe


Forum|alt.badge.img
  • Contributor I
  • 2 replies
  • August 17, 2023

Hey @chloe.strange , i have the same issue . Could you please guide me if there are any setup i need to change ? 


David To
Klaviyo Employee
Forum|alt.badge.img+60
  • Klaviyo Employee
  • 2456 replies
  • August 21, 2023

Hello @Anatta,

If you’re encountering a similar behavior as @stardiodev, there’s a good chance you may have hit Klaviyo’s list bombing prevent system

I’ve explained this behavior in several Community posts before - which I’ve included below:

I hope this helps!

David