move-coop / parsons

A python library of connectors for the progressive community.
Other
255 stars 125 forks source link

EveryAction: Add email endpoint methods to retrieve email stats from TargetedEmail #1003

Closed matthewkrausse closed 1 month ago

matthewkrausse commented 4 months ago

This pull request adds an email endpoint to the VANConnector class, allowing users to retrieve email messages and their stats. It also includes test cases for getting email messages and email stats.

matthewkrausse commented 4 months ago

For a little more context, the get_email_stats method uses the get_emails and get_email method in order to unpack a bunch of information. You need to get a list of all emails first with get_emails(). Then you use foreginMessageId with the get_email() method to get the stats. The data is nested because with any ab testing that was done. So for instance, inside the emailMessageContentDistributions section, there is a list of dictionary objects with email_A, email_B, email_c and the email_winner. The get_email_stats method combines all these to get the final open count, unsubs, etc.

matthewkrausse commented 4 months ago

Another thing to note, which I would take suggestions for, is that you need to request that this endpoint is turned on for your api key. They don't expose it by default. So we will want to document that somewhere.