Opened trigger discuss

i have done trigger openned
when the email recipient open → get event
when i open (open the email i sent) → still get event
is there any way to distinguish who opened

@quan20112002 Here’s the schema for message.opened Notification schemas | Nylas Docs

You can use the ip field from the recents field.

"recents": [        
{          
"ip": "<IP ADDR>",          
"opened_id": 0,          
"timestamp": 1695480567,          
"user_agent": "Mozilla/5.0"        
},
]

Based on IP, how can we distinguish it?

@Blag can you help me ?

I still don’t quite understand
I want to ask in detail
how to do as your instructions

@Blag please help me

@quan20112002 You need to get your own IP address. I’m not sure which SDK are you using but for example in Python you can do:

import socket

hostname = socket.gethostname()
local_ip = socket.gethostbyname(hostname)

print(f"Local IP address: {local_ip}")

Or in Ruby:

require 'socket'

local_ip = Socket.ip_address_list.detect(&:ipv4_private?).ip_address
puts "Local IP address: #{local_ip}"

Then you would to compare the value from:

"recents": [        
{          
"ip": "<IP ADDR>",          
"opened_id": 0,          
"timestamp": 1695480567,          
"user_agent": "Mozilla/5.0"        
},
]

If they are the same, then you opened…otherwise it was the recipient :slight_smile:

[
  {
    ip: '66.249.84.226, 167.82.142.87, 34.54.200.201, 35.191.19.97',
    opened_id: 0,
    timestamp: 1726591509,
    user_agent: 'Mozilla/5.0 (Windows NT 5.1; rv:11.0) Gecko Firefox/11.0 (via ggpht.com GoogleImageProxy)'
  },
  {
    ip: '66.249.84.224, 167.82.142.29, 34.54.200.201, 130.211.0.192',
    opened_id: 1,
    timestamp: 1726591514,
    user_agent: 'Mozilla/5.0 (Windows NT 5.1; rv:11.0) Gecko Firefox/11.0 (via ggpht.com GoogleImageProxy)'
  },
  {
    ip: '66.249.84.225, 167.82.142.70, 34.54.200.201, 130.211.1.32',
    opened_id: 2,
    timestamp: 1726591580,
    user_agent: 'Mozilla/5.0 (Windows NT 5.1; rv:11.0) Gecko Firefox/11.0 (via ggpht.com GoogleImageProxy)'
  },
  {
    ip: '66.249.84.225, 167.82.142.55, 34.54.200.201, 130.211.1.36',
    opened_id: 3,
    timestamp: 1726591627,
    user_agent: 'Mozilla/5.0 (Windows NT 5.1; rv:11.0) Gecko Firefox/11.0 (via ggpht.com GoogleImageProxy)'
  },
  {
    ip: '66.249.84.224, 167.82.142.38, 34.54.200.201, 35.191.59.5',
    opened_id: 4,
    timestamp: 1726591665,
    user_agent: 'Mozilla/5.0 (Windows NT 5.1; rv:11.0) Gecko Firefox/11.0 (via ggpht.com GoogleImageProxy)'
  }
]

this is my Data
and my Ip is: 192.168.31.139
and i cannot find it here
@Blag

Hello @quan20112002 I just requested support from the platform team…will get back to you as soon as they answer me…

hey @Blag how is it going