Skip to main content
mattyboy
Contributor I
Contributor I
August 12, 2024
Solved

Using the API to track Received/Open Event For Specific Transactional Emails

  • August 12, 2024
  • 2 replies
  • 482 views

Hi

I have an metric called ‘Email: Connect Request’, this triggers a flow to send a transactional email. When I view a profile in Klaviyo I can see the ‘Email: Connect Request’ event as well as ‘Received Email’ & ‘Opened Email’ events, great.
If the same profile is sent another email using the ‘Email: Connect Request’, I see a 2nd ‘Received Email’ but not a 2nd ‘Opened Email’, fine, one of the emails was not opened. But, how do I tell which of the ‘Email: Connect Request’ emails was opened/not opened? 
I am using the API to pull in all events for the profile using - https://a.klaviyo.com/api/events/?filter=equals(profile_id,"profileId"), but I see no way to know which ‘Received Email’ & ‘Opened Email’ event is related to which ‘Email: Connect Request’ event. I would expect the event id for the ‘Email: Connect Request’ event to appear in the data returned about the ‘Received Email’ & ‘Opened Email’ events but there is not?

Surely there must be a way to do this with the API? Please help!

Cheers

Matt

    This topic has been closed for replies.
    Best answer by ArpitBanjara

    Hey @mattyboy 

    the API response does not directly provide a straightforward way to link these events, you can use the message_id to correlate events.

    Here's a step-by-step approach to achieve this:

    1. Retrieve Events for the Profile: First, you will retrieve all events for the specific profile using the API.

    2. Filter Relevant Events: Identify and filter out the Email: Connect Request, Received Email, and Opened Email events.

    3. Link Events using message_id: Each email event in Klaviyo should have a message_id. You can use this message_id to link Received Email and Opened Email events to the Email: Connect Request event.

    I hope this helps

    Cheers

    Arpit

    2 replies

    ArpitBanjara
    Principal User II
    Principal User II
    August 13, 2024

    Hey @mattyboy 

    the API response does not directly provide a straightforward way to link these events, you can use the message_id to correlate events.

    Here's a step-by-step approach to achieve this:

    1. Retrieve Events for the Profile: First, you will retrieve all events for the specific profile using the API.

    2. Filter Relevant Events: Identify and filter out the Email: Connect Request, Received Email, and Opened Email events.

    3. Link Events using message_id: Each email event in Klaviyo should have a message_id. You can use this message_id to link Received Email and Opened Email events to the Email: Connect Request event.

    I hope this helps

    Cheers

    Arpit

    Arpit Banjara - Lead Email Marketing Specialist at Flowium
    mattyboy
    Contributor I
    mattyboyAuthor
    Contributor I
    August 13, 2024

    Hi Arpit

     

    Thanks so much for responding. I have pasted the api responses for 6 events below, 2 for my metric ‘Email: Connect Request’ (I’ve stripped out all the event properties but this is all custom stuff sent by me), 2 for ‘Received Email’ and 2 for ‘Opened Email’. I see nothing unique here that allows me to connect which received/open event is for which ‘Email: Connect Request’ event (there is no message_id, there is a $message but this is not unique)?

    Am I missing something here? Cheers!

    Matt

     

     

    {

    type: 'event',

    id: '5sRVQiq5ZFZ',

    attributes: {

    timestamp: 1723459656,

    event_properties: {

    Subject: '{{event.subject}}',

    'Recipient Email Address': '***',

    'Email Domain': '***',

    '$message': 'WXQc7f',

    'Campaign Name': 'Connection Request',

    '$flow': 'VbqiAL',

    '$_cohort$message_send_cohort': '1723459592:WXQc7f',

    '$ESP': 2,

    'Inbox Provider': 'Gsuite',

    '$internal': { IpPool: 'high_4', 'Friendly From Domain': '***' },

    '$event_id': 'WXQc7f:217229476138749354436636033997187601776'

    },

    datetime: '2024-08-12T10:47:36+00:00',

    uuid: '494f9400-5898-11ef-8001-449b638c1aa0'

    },

    relationships: {

    profile: {

    data: { type: 'profile', id: '01J47M22YETQX69JSRY2PEYZJ3' },

    links: {

    self: 'https://a.klaviyo.com/api/events/5sRVQiq5ZFZ/relationships/profile/',

    related: 'https://a.klaviyo.com/api/events/5sRVQiq5ZFZ/profile/'

    }

    },

    metric: {

    data: { type: 'metric', id: 'VUm7Lw' },

    links: {

    self: 'https://a.klaviyo.com/api/events/5sRVQiq5ZFZ/relationships/metric/',

    related: 'https://a.klaviyo.com/api/events/5sRVQiq5ZFZ/metric/'

    }

    }

    },

    links: { self: 'https://a.klaviyo.com/api/events/5sRVQiq5ZFZ/' }

    }


     

    {

    type: 'event',

    id: '5sRUSQd6P2u',

    attributes: {

    timestamp: 1723459596,

    event_properties: {

    Subject: '{{event.subject}}',

    'Recipient Email Address': '***',

    'Email Domain': 'hovr.co',

    '$message': 'WXQc7f',

    'Campaign Name': 'Connection Request',

    '$flow': 'VbqiAL',

    '$_cohort$message_send_cohort': '1723459595:WXQc7f',

    '$message_interaction': 'WXQc7f',

    'Client Type': 'Browser',

    'Client OS Family': 'Windows',

    'Client OS': 'Windows',

    'Client Name': 'Chrome',

    _ip: '66.249.92.169',

    'Client Canonical': 'Chrome',

    '$ESP': 2,

    machine_open: false,

    'Inbox Provider': 'Gsuite',

    '$internal': {

    IpPool: 'high_4',

    'User Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.246 Mozilla/5.0',

    'Friendly From Domain': '***'

    },

    '$event_id': 'WXQc7f:217229476138749354436636033997187601776:1723459596'

    },

    datetime: '2024-08-12T10:46:36+00:00',

    uuid: '258c4e00-5898-11ef-8001-f4d0a1ce90db'

    },

    relationships: {

    profile: {

    data: { type: 'profile', id: '01J47M22YETQX69JSRY2PEYZJ3' },

    links: {

    self: 'https://a.klaviyo.com/api/events/5sRUSQd6P2u/relationships/profile/',

    related: 'https://a.klaviyo.com/api/events/5sRUSQd6P2u/profile/'

    }

    },

    metric: {

    data: { type: 'metric', id: 'XGLZgZ' },

    links: {

    self: 'https://a.klaviyo.com/api/events/5sRUSQd6P2u/relationships/metric/',

    related: 'https://a.klaviyo.com/api/events/5sRUSQd6P2u/metric/'

    }

    }

    },

    links: { self: 'https://a.klaviyo.com/api/events/5sRUSQd6P2u/' }

    }


     

    {

    type: 'event',

    id: '5sRUTWATiYC',

    attributes: {

    timestamp: 1723459589,

    event_properties: {

    id: 129,

    '$event_id': '1723459589'

    },

    datetime: '2024-08-12T10:46:29+00:00',

    uuid: '21603080-5898-11ef-8001-1fbc2794d3bf'

    },

    relationships: {

    profile: {

    data: { type: 'profile', id: '01J47M22YETQX69JSRY2PEYZJ3' },

    links: {

    self: 'https://a.klaviyo.com/api/events/5sRUTWATiYC/relationships/profile/',

    related: 'https://a.klaviyo.com/api/events/5sRUTWATiYC/profile/'

    }

    },

    metric: {

    data: { type: 'metric', id: 'QYBf4r' },

    links: {

    self: 'https://a.klaviyo.com/api/events/5sRUTWATiYC/relationships/metric/',

    related: 'https://a.klaviyo.com/api/events/5sRUTWATiYC/metric/'

    }

    }

    },

    links: { self: 'https://a.klaviyo.com/api/events/5sRUTWATiYC/' }

    }


     

    {

    type: 'event',

    id: '5sRVcDWz63u',

    attributes: {

    timestamp: 1723459574,

    event_properties: {

    Subject: '{{event.subject}}',

    'Recipient Email Address': '***',

    'Email Domain': '***',

    '$message': 'WXQc7f',

    'Campaign Name': 'Connection Request',

    '$flow': 'VbqiAL',

    '$_cohort$message_send_cohort': '1723459570:WXQc7f',

    '$message_interaction': 'WXQc7f',

    'Client Type': 'Browser',

    'Client OS Family': 'Windows',

    'Client OS': 'Windows',

    'Client Name': 'Chrome',

    _ip: '66.249.89.9',

    'Client Canonical': 'Chrome',

    '$ESP': 0,

    machine_open: false,

    'Inbox Provider': 'Gsuite',

    '$internal': {

    'User Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.246 Mozilla/5.0',

    'Friendly From Domain': '***'

    },

    '$event_id': 'WXQc7f:217229475742608541865314346029467850096:1723459574'

    },

    datetime: '2024-08-12T10:46:14+00:00',

    uuid: '186f5f00-5898-11ef-8001-ed438e6693f2'

    },

    relationships: {

    profile: {

    data: { type: 'profile', id: '01J47M22YETQX69JSRY2PEYZJ3' },

    links: {

    self: 'https://a.klaviyo.com/api/events/5sRVcDWz63u/relationships/profile/',

    related: 'https://a.klaviyo.com/api/events/5sRVcDWz63u/profile/'

    }

    },

    metric: {

    data: { type: 'metric', id: 'XGLZgZ' },

    links: {

    self: 'https://a.klaviyo.com/api/events/5sRVcDWz63u/relationships/metric/',

    related: 'https://a.klaviyo.com/api/events/5sRVcDWz63u/metric/'

    }

    }

    },

    links: { self: 'https://a.klaviyo.com/api/events/5sRVcDWz63u/' }

    }


     

    {

    type: 'event',

    id: '5sRVww8vKg2',

    attributes: {

    timestamp: 1723459572,

    event_properties: {

    Subject: '{{event.subject}}',

    'Recipient Email Address': '***',

    'Email Domain': '***',

    '$message': 'WXQc7f',

    'Campaign Name': 'Connection Request',

    '$flow': 'VbqiAL',

    '$_cohort$message_send_cohort': '1723459570:WXQc7f',

    '$ESP': 0,

    'Inbox Provider': 'Gsuite',

    '$internal': { 'Friendly From Domain': '***' },

    '$event_id': 'WXQc7f:217229475742608541865314346029467850096'

    },

    datetime: '2024-08-12T10:46:12+00:00',

    uuid: '173e3200-5898-11ef-8001-582f73d6d896'

    },

    relationships: {

    profile: {

    data: { type: 'profile', id: '01J47M22YETQX69JSRY2PEYZJ3' },

    links: {

    self: 'https://a.klaviyo.com/api/events/5sRVww8vKg2/relationships/profile/',

    related: 'https://a.klaviyo.com/api/events/5sRVww8vKg2/profile/'

    }

    },

    metric: {

    data: { type: 'metric', id: 'VUm7Lw' },

    links: {

    self: 'https://a.klaviyo.com/api/events/5sRVww8vKg2/relationships/metric/',

    related: 'https://a.klaviyo.com/api/events/5sRVww8vKg2/metric/'

    }

    }

    },

    links: { self: 'https://a.klaviyo.com/api/events/5sRVww8vKg2/' }

    }


     

    {

    type: 'event',

    id: '5sRUz3sdEA8',

    attributes: {

    timestamp: 1723459560,

    event_properties: {

    '$event_id': '1723459560'

    },

    datetime: '2024-08-12T10:46:00+00:00',

    uuid: '10172400-5898-11ef-8001-7165edda0ac7'

    },

    relationships: {

    profile: {

    data: { type: 'profile', id: '01J47M22YETQX69JSRY2PEYZJ3' },

    links: {

    self: 'https://a.klaviyo.com/api/events/5sRUz3sdEA8/relationships/profile/',

    related: 'https://a.klaviyo.com/api/events/5sRUz3sdEA8/profile/'

    }

    },

    metric: {

    data: { type: 'metric', id: 'QYBf4r' },

    links: {

    self: 'https://a.klaviyo.com/api/events/5sRUz3sdEA8/relationships/metric/',

    related: 'https://a.klaviyo.com/api/events/5sRUz3sdEA8/metric/'

    }

    }

    },

    links: { self: 'https://a.klaviyo.com/api/events/5sRUz3sdEA8/' }

    }