Civicrm and Sendgrid email api v2-v3 upgrade fix

A client using Civicrm recently approached us with a problem: bounced emails, sent through the Sendgrid email service were no longer reporting as bounced. All emails, regardless of status, were reporting as being successful. Our custom module (D6 integration) was attempting to extract data from the post, thusly:


Unfortunately, the v2 to v3 upgrade changed the format of the POST request data to a nested json array, and required a little bit of tweaking to be properly extracted, and record bounces. The fix was fairly straightforward: get the contents of the request, and then run them through


The patch to be applied to our custom module (civicrm_sendgrid_events) is attached.

2017-03-31T06:19:57+00:00 Categories: Development, How-To|

Share this

About the Author:

Ethan Teague joined CivicActions in 2013. He channels his passion for solving code-related puzzles and his strong back- and front-end development skills into swift and tangible results.

Almost immediately upon joining CivicActions, Ethan impressed stakeholders and end users of a federal collaboration platform when he developed a custom module solution to enable file data sharing amongst multiple agencies. His many talents include rapid CSS development, Javascript / jQuery solutions, Drupal Contributed Module and Drupal Admin knowledge, and advanced experience with Views and Context, all of which he leverages to create out-of-the-box solutions and custom modules for our clients.

Before joining CivicActions, Ethan developed Destination and Marketing solutions for Miles Media and others, with a heavy focus on front-end development for responsively designed websites. He worked on multiple high volume regional and state level websites and did custom Drupal application development for Humana Insurance.
Ethan received a BA in English Literature from the University of Tennessee-Knoxville. When he’s not cracking code, he enjoys riding his bike, and playing bluegrass music with friends and family.