Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upcoming API Transmission Endpoint changes #52

Open
laryn opened this issue Nov 3, 2017 · 10 comments
Open

Upcoming API Transmission Endpoint changes #52

laryn opened this issue Nov 3, 2017 · 10 comments

Comments

@laryn
Copy link
Contributor

laryn commented Nov 3, 2017

I got this info in an email from Sparkpost -- do these upcoming changes affect this extension?

https://www.sparkpost.com/blog/upcoming-api-transmission-endpoint-changes

@laryn
Copy link
Contributor Author

laryn commented Nov 3, 2017

FYI, in the Drupal module they say "Don't worry about it."

https://www.drupal.org/node/2920893

@danielstrum
Copy link

I would also like to know the answer to this question.

@freeform-sg
Copy link

freeform-sg commented Mar 19, 2018

This is not a big deal for the Drupal module as they're not doing much with bounces. In the case of CiviCRM, however, since the API update, we are seeing that the bounce callback not working means that records are not getting updated to indicate a bad email address, which means repetitive mail going to bad addresses unless one is manually reviewing the bounce report in Sparkpost and making the necessarycontact updates.

@nganivet
Copy link
Contributor

I have already sunk more than 50 hours of volunteer time developing this extension. I am asking for a very modest $40 contribution for using this extension - but have received less than one handful of donations so far Anyone willing to finance investigation and fix for this issue? Email me at [email protected]. Thanks.

@herbdool
Copy link
Contributor

herbdool commented Jul 4, 2019

@nganivet it's not clear why you closed this issue. I've reviewed the Transmission API and it seems that there is a potentially small tweak that needs to be made to the error response. I can probably provide a PR. It would look like this:

diff --git a/CRM/Sparkpost.php b/CRM/Sparkpost.php
index cfeda33..13e501e 100644
--- a/CRM/Sparkpost.php
+++ b/CRM/Sparkpost.php
@@ -151,11 +151,11 @@ class CRM_Sparkpost {
           case 420 :
             throw new Exception("Sparkpost error: Sending limits exceeded. Check your limits in the Sparkpost console.", CRM_Sparkpost::FALLBACK);
         }
-        //If we don't get an error code OR description, this error is a 404 response for checking the suppression list for an email that isn't on it. See https://developers.sparkpost.com/api/suppression-list/#suppression-list-get-retrieve-a-suppression
+        //If we don't get an error code OR message, this error is a 404 response for checking the suppression list for an email that isn't on it. See https://developers.sparkpost.com/api/suppression-list/#suppression-list-get-retrieve-a-suppression
         //In that case it's an expected workflow and we don't want to return a blank error response to the user just for checking
-        if (property_exists($error, 'code') && property_exists($error, 'description')) {
+        if (property_exists($error, 'code') && property_exists($error, 'message')) {
           // Don't have specifics, so throw a generic exception
-          throw new Exception("Sparkpost error: HTTP return code $curl_info[http_code], Sparkpost error code $error->code ($error->message: $error->description). Check https://support.sparkpost.com/customer/en/portal/articles/2140916-extended-error-codes for interpretation.");
+          throw new Exception("Sparkpost error: HTTP return code $curl_info[http_code], Sparkpost error code $error->code ($error->message). Check https://support.sparkpost.com/customer/en/portal/articles/2140916-extended-error-codes for interpretation.");
         }
       }
     }

This might be why an error message says: "Resource could not be found: " where there's nothing after the colon.

Sparkpost error: HTTP return code 404, Sparkpost error code (Resource could not be found: ). Check https://support.sparkpost.com/customer/en/portal/articles/2140916-extended-error-codes for interpretation.

@nganivet
Copy link
Contributor

nganivet commented Jul 6, 2019

@herbdool I have merged this pull request before closing the issue, so do not understand your comment. Maybe you could rephrase?

Merge: f1685df

@herbdool
Copy link
Contributor

herbdool commented Jul 6, 2019

I see. You didn't mention that previously in this thread so it wasn't clear. From your other message it seemed as if you were stopping all work on this.

The merged PR still refers to $error->description but from what I understand of the API change that seems to be merged into $error->message. So maybe the format should be updated a bit more?

@nganivet
Copy link
Contributor

nganivet commented Jul 8, 2019

@herbdool I will let you "update the format" to whatever is necessary and create another PR. Thanks.

@herbdool
Copy link
Contributor

herbdool commented Jul 8, 2019

From their blog post "The description field from Transmission API error response bodies will be removed, with the content from the description field moving to the message field." (https://www.sparkpost.com/blog/error-handling-transmissions-api/). I created a PR #83 to address that one change.

@herbdool
Copy link
Contributor

herbdool commented Jul 9, 2019

@nganivet thanks for merging

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants