sendgrid / sendgrid-python

The Official Twilio SendGrid Python API Library
https://sendgrid.com
MIT License
1.55k stars 714 forks source link

Replicating Email Activity Report via Python #1012

Closed HydroPupper closed 2 years ago

HydroPupper commented 3 years ago

Hey,

I've been trying to figure out how to create a script that will pull data similar to an Email Activity report. Right now, our current process involves identifying transactional ID, then downloading all client's email activity linked to that ID. Is there a way I'd be able to do so using Python?

Really, what I'm trying to do is pull data from a specific single send and see what the users did (processed, clicked, opened, etc). Is that possible?

JenniferMah commented 3 years ago

Hi @HydroPupper! You should be able to use the tracking settings to see how recipients interact with your email. Here's some example documentation of how to the tracking could be used.

ElizabethRF commented 3 years ago

Hello! Is there a way to retrieve Email activity from python? I am trying to filter emails by subject and I do not see how to do that with the tracking api

shwetha-manvinkurke commented 3 years ago

@ElizabethRF here's an example of how you would do this -

params = {}
params["query"] = "query goes here"
params["limit"] = 1

response = sg.client.messages.get(query_params=params)
print(response.status_code)
print(response.body)
print(response.headers)
JenniferMah commented 2 years ago

Closing due to inactivity. Please open a new github issues if you need any additional help.