SendGrid Web API scanned email header response

I send emails through SendGrid

with this insidex-smtpapi header

$json_string = array(
    'unique_args' => array (
        'email_id' => 1
    )
);

      

Everything seems to be sent ok, inside SendGrid I can view the "email_id" in the email under the "Unique args" section.

However, when I try to use the API to view this email, I cannot find a way to get these unique arguments from the API.

I am using this to try and get headers with returned messages.

$request = 'https://api.sendgrid.com/api/bounces.get.json&api_user=username&api_key=password'

      

All I get is just the bounced email addresses, not the header information (unique arguments)

I want to know if it is possible to get unique arguments from API

. I read it several times to no avail.

Hope this makes sense. Thanks to

+3


source to share


1 answer


There is currently no way to search for specific events unique_arg

using the Web API.

However, SendGrid Event Webhook will give you details on each event, such as bounce, how it happens. These Web site Event Webhook sent to your server every time the action is performed via e-mail (eg open

, click

, bounce

).

Once you receive it, you are responsible for storing it, although this is not a typical API, it provides very specific event data that you can then compile and redraw however you like.



To get started with webhook, you would do something like the following and send a SendGrid POST to the following script:

<?php
$data = file_get_contents("php://input");
$events = json_decode($data, true);

foreach ($events as $event) {
  // Here, you now have each event and can process them how you like
  process_event($event);
}

      

[Taken from the SendGrid Sample Code ]

+2


source







All Articles