Skip to main content

Currently when querying the Query Campaign Values endpoint the API returns the campaign id in both the campaign_id and campaign_message_id grouping fields. 

Is this intended behavior and / or is there a way to break this out by message_id.

 

"groupings": {

"send_channel": "email",

"campaign_id": "01JN90402FKR82WKZ7P1QZTR44",

"campaign_message_id": "01JN90402FKR82WKZ7P1QZTR44"

Yes, it’s expected behavior for the `campaign_id` and `campaign_message_id` to return the same value, as both fields typically reference the same campaign or message within Klaviyo. 

 

However, if you're looking to break them out separately based on a `message_id`, you may need to refine your query or data processing logic. Klaviyo doesn’t inherently provide a separate `message_id` in the response of the `Query Campaign Values` endpoint, as the campaign and message are often tightly coupled.

 

To differentiate the data, you could try one of the following:

 

1. API Documentation: Double-check if there’s a more detailed endpoint or query parameter to fetch individual messages within a campaign.

   

2. Post-processing: After fetching the data, handle the distinction of `campaign_id` and `campaign_message_id` based on your business logic if the API doesn’t offer a separate message ID.

 

If this doesn’t fully resolve the issue, contacting Klaviyo support could help clarify if there’s a different approach or newer feature that better suits your needs.


@Ojuade Peace -- Not sure that logic makes sense -- they are independent fields in Klaviyo.

  • If i pull details on a recent email campaign that has an AB test, that campaign has 2 associated message_ids -- independent from the campaign_id
  • If I run the query campaign values report only 1 value is returned for the campaign with both the campaign_id and message_id fields referencing the campaign_id. The metrics are aggregated.
  • If I filter the query campaign values report on the campaign_id, that works fine. If I filter on campaign_message_id with an actual message id that returns nothing.

Perhaps breaking out performance by campaign_message isnt the intention of this endpoint. If thats the case -- is the best endpoint query metric aggregates (despite that data not 1:1 matching UI values)?


Hi ​@JanW ! 

Thank you for reaching out to the Community. As ​@Ojuade Peace stated, it is expected behavior for the campaign_id and campaign_message_id to return the same value.

If you are looking for a specific conversion from a campaign, then you can use our Query Metric Aggregates endpoint, which allows you to look at an entire metric, and filter by campaign ID or version ID. 

I hope this helps, and let me know if you have any follow up questions!