proexchange / com.pesc.sparkpost

Integrates SparkPost to CiviCRM, so email can be sent out over the SparkPost service and bounces can be processed in CiviCRM
Other
9 stars 5 forks source link

date_filter confusing #28

Open norristh opened 7 years ago

norristh commented 7 years ago

I ran into problems with this, and I think a tweak to the documentation would help. In the Sparkpost message-event API, if you don't specify the "from" parameter, it defaults to one hour ago. (This isn't well documented at Sparkpost, but a SparkPost rep says so at https://stackoverflow.com/questions/32440217/how-to-get-bounce-emails-from-sparkpost-without-using-webhooks#comment53025488_32513656 )

So if the com.pesc.sparkpost date_filter isn't set, only bounces from the last hour will be pulled. As I was setting things up, I figured I didn't want to use date_filter=1 because I had already run the SparkPost Fetch Bounces cron job. It took me a long time to figure out why it wasn't pulling bounces from the mailing I sent earlier this week.

So where it says:

date_filter: If you have this set to 1, this will only query bounce events from SparkPost that have occurred since the scheduled job last ran successfully. This should make things run a little faster because there will be fewer results to parse through from SparkPost.

Delete the second sentence (or clarify that this is only true if the cron job is set to run more than once per hour.)

And add "If you have this set to 0, this will only query bounce events from SparkPost that have occurred in the last hour."

Thanks for this great extension!

mark-rodgers commented 7 years ago

Thanks for the input. I know in the last year or so SparkPost has expanded their API quite a bit. You quote a SparkPost rep who mentioned that if you don't include the froms parameter in your message-events API call that it only grabs the last hours worth.

While I do remember this being the case back when we first created this extension. After doing some very brief testing with the API right now and I'm not sure that this still the case. Looks like it's grabbing at least 6 hours worth of data when I don't set the parameter froms.

I will do some testing and get back to you.