Skip to main content

I’m trying to create an auto-suppression flow with a webhook using the steps in https://medium.com/klaviyo-developers/solution-recipe-9-use-klaviyo-flow-webhooks-to-automate-suppressions-using-segments-and-a-custom-d431c247e96d.

As far as I can tell, I set up everything correctly, but when I try a test, I get “Error: status code 401 received when sending webhook.” Any ideas?

Headers:

Authorization: Klaviyo-API-Key -my private key]

accept: application/json

content-type: application/json

revision: 2024-07-15

JSON body:

{
  "data": {
    "type": "profile-suppression-bulk-create-job",
    "attributes": {
      "suppressions":
        {
          "email": "{{ person.email }}"
        }
      ]
    }
  }
}

I have tried getting help through the chatbot and email, so this is my last hope:)

Hi ​@AnnaL

Thank you for reaching out to the community. 

Your settings looks right. Have you created a private API-key? 

Try adding this code snippet instead of the one you added:

{
  "data": {
    "type": "profile-suppression-bulk-create-job",
    "attributes": {
      "profiles": {
        "data":
          {
            "type": "profile",
            "attributes": {
              "email": "{{person.email}}"
            }
          }
        ]
      }
    }
  }
}
 

This guide also takes you through setting up the suppression webhook: https://www.klaviyo.com/blog/solution-recipe-9-use-klaviyo-flow-webhooks-to-automate-suppressions-using-segments-and-klaviyos-apis

 

Best of luck :-)


Hi Nicoline

thank you for your reply, thanks to it i noticed i had put in the wrong Api key, so my flow is now working


Hi Nicoline

thank you for your reply, thanks to it i noticed i had put in the wrong Api key, so my flow is now working

I am glad you found a solution. Sometimes it is trial and error. Can you share how you discovered that it was the wrong API-key? Is there something in the guide that could be optimized around this?