Retreive JSON items Lasso 8.6 (Sparkpost)

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Retreive JSON items Lasso 8.6 (Sparkpost)

Laurent Gigon
Hi,

I need to extract bounces from my mailing list using JSON results from
Sparkpost.

How can I extract "msg_from" item from this result?

Here is a sample file :

[
 {
   "msys": {
     "message_event": {
       "type": "bounce",
       "bounce_class": "1",
       "campaign_id": "Example Campaign Name",
       "customer_id": "1",
       "delv_method": "esmtp",
       "device_token":
"45c19189783f867973f6e6a5cca60061ffe4fa77c547150563a1192fa9847f8a",
       "error_code": "554",
       "event_id": "92356927693813856",
       "friendly_from": "[hidden email]",
       "ip_address": "127.0.0.1",
       "ip_pool": "Example-Ip-Pool",
       "message_id": "000443ee14578172be22",
       "msg_from": "[hidden email]",
       "msg_size": "1337",
       "num_retries": "2",
       "rcpt_meta": {
         "customKey": "customValue"
       },
       "rcpt_tags": [
         "male",
         "US"
       ],
       "rcpt_to": "[hidden email]",
       "raw_rcpt_to": "[hidden email]",
       "rcpt_type": "cc",
       "raw_reason": "MAIL REFUSED - IP (17.99.99.99) is in black list",
       "reason": "MAIL REFUSED - IP (a.b.c.d) is in black list",
       "routing_domain": "example.com",
       "sending_ip": "127.0.0.1",
       "sms_coding": "ASCII",
       "sms_dst": "7876712656",
       "sms_dst_npi": "E164",
       "sms_dst_ton": "International",
       "sms_src": "1234",
       "sms_src_npi": "E164",
       "sms_src_ton": "Unknown",
       "subaccount_id": "101",
       "subject": "Summer deals are here!",
       "template_id": "templ-1234",
       "template_version": "1",
       "timestamp": "1454442600",
       "transmission_id": "65832150921904138"
     }
   }
 },
 {
   "msys": {
     "message_event": {
       "type": "spam_complaint",
       "campaign_id": "Example Campaign Name",
       "customer_id": "1",
       "delv_method": "esmtp",
       "event_id": "92356927693813856",
       "fbtype": "abuse",
       "friendly_from": "[hidden email]",
       "ip_pool": "Example-Ip-Pool",
       "message_id": "000443ee14578172be22",
       "rcpt_meta": {
         "customKey": "customValue"
       },
       "rcpt_tags": [
         "male",
         "US"
       ],
       "rcpt_to": "[hidden email]",
       "raw_rcpt_to": "[hidden email]",
       "rcpt_type": "cc",
       "report_by": "server.email.com",
       "report_to": "abuse.example.com",
       "sending_ip": "127.0.0.1",
       "subaccount_id": "101",
       "subject": "Summer deals are here!",
       "template_id": "templ-1234",
       "template_version": "1",
       "timestamp": "1454442600",
       "transmission_id": "65832150921904138",
       "user_str": "Additional Example Information"
     }
   }
 }
]


Laurent



#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Retreive JSON items Lasso 8.6 (Sparkpost)

Laurent Gigon
Hi,

I need to extract bounces from my mailing list using JSON results from
Sparkpost.

How can I extract "msg_from" item from this result?

Here is a sample file :

[
{
  "msys": {
    "message_event": {
      "type": "bounce",
      "bounce_class": "1",
      "campaign_id": "Example Campaign Name",
      "customer_id": "1",
      "delv_method": "esmtp",
      "device_token":
"45c19189783f867973f6e6a5cca60061ffe4fa77c547150563a1192fa9847f8a",
      "error_code": "554",
      "event_id": "92356927693813856",
      "friendly_from": "[hidden email]",
      "ip_address": "127.0.0.1",
      "ip_pool": "Example-Ip-Pool",
      "message_id": "000443ee14578172be22",
      "msg_from": "[hidden email]",
      "msg_size": "1337",
      "num_retries": "2",
      "rcpt_meta": {
        "customKey": "customValue"
      },
      "rcpt_tags": [
        "male",
        "US"
      ],
      "rcpt_to": "[hidden email]",
      "raw_rcpt_to": "[hidden email]",
      "rcpt_type": "cc",
      "raw_reason": "MAIL REFUSED - IP (17.99.99.99) is in black list",
      "reason": "MAIL REFUSED - IP (a.b.c.d) is in black list",
      "routing_domain": "example.com",
      "sending_ip": "127.0.0.1",
      "sms_coding": "ASCII",
      "sms_dst": "7876712656",
      "sms_dst_npi": "E164",
      "sms_dst_ton": "International",
      "sms_src": "1234",
      "sms_src_npi": "E164",
      "sms_src_ton": "Unknown",
      "subaccount_id": "101",
      "subject": "Summer deals are here!",
      "template_id": "templ-1234",
      "template_version": "1",
      "timestamp": "1454442600",
      "transmission_id": "65832150921904138"
    }
  }
},
{
  "msys": {
    "message_event": {
      "type": "spam_complaint",
      "campaign_id": "Example Campaign Name",
      "customer_id": "1",
      "delv_method": "esmtp",
      "event_id": "92356927693813856",
      "fbtype": "abuse",
      "friendly_from": "[hidden email]",
      "ip_pool": "Example-Ip-Pool",
      "message_id": "000443ee14578172be22",
      "rcpt_meta": {
        "customKey": "customValue"
      },
      "rcpt_tags": [
        "male",
        "US"
      ],
      "rcpt_to": "[hidden email]",
      "raw_rcpt_to": "[hidden email]",
      "rcpt_type": "cc",
      "report_by": "server.email.com",
      "report_to": "abuse.example.com",
      "sending_ip": "127.0.0.1",
      "subaccount_id": "101",
      "subject": "Summer deals are here!",
      "template_id": "templ-1234",
      "template_version": "1",
      "timestamp": "1454442600",
      "transmission_id": "65832150921904138",
      "user_str": "Additional Example Information"
    }
  }
}
]


Laurent

#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: Retreive JSON items Lasso 8.6 (Sparkpost)

Brad Lindsay
Here’s some untested sample code that should point you in the right direction.

local('responses') = decode_json('[{"msys": { ...');
iterate(#responses, local('response'));
    #response->find('msys')->find('msg_from');
/iterate;

Brad



On May 12, 2016 at 11:07:48 AM, Laurent ([hidden email]) wrote:

> Hi,
>  
> I need to extract bounces from my mailing list using JSON results from
> Sparkpost.
>  
> How can I extract "msg_from" item from this result?
>  
> Here is a sample file :
>  
> [
> {
> "msys": {
> "message_event": {
> "type": "bounce",
> "bounce_class": "1",
> "campaign_id": "Example Campaign Name",
> "customer_id": "1",
> "delv_method": "esmtp",
> "device_token":
> "45c19189783f867973f6e6a5cca60061ffe4fa77c547150563a1192fa9847f8a",
> "error_code": "554",
> "event_id": "92356927693813856",
> "friendly_from": "[hidden email]",
> "ip_address": "127.0.0.1",
> "ip_pool": "Example-Ip-Pool",
> "message_id": "000443ee14578172be22",
> "msg_from": "[hidden email]",
> "msg_size": "1337",
> "num_retries": "2",
> "rcpt_meta": {
> "customKey": "customValue"
> },
> "rcpt_tags": [
> "male",
> "US"
> ],
> "rcpt_to": "[hidden email]",
> "raw_rcpt_to": "[hidden email]",
> "rcpt_type": "cc",
> "raw_reason": "MAIL REFUSED - IP (17.99.99.99) is in black list",
> "reason": "MAIL REFUSED - IP (a.b.c.d) is in black list",
> "routing_domain": "example.com",
> "sending_ip": "127.0.0.1",
> "sms_coding": "ASCII",
> "sms_dst": "7876712656",
> "sms_dst_npi": "E164",
> "sms_dst_ton": "International",
> "sms_src": "1234",
> "sms_src_npi": "E164",
> "sms_src_ton": "Unknown",
> "subaccount_id": "101",
> "subject": "Summer deals are here!",
> "template_id": "templ-1234",
> "template_version": "1",
> "timestamp": "1454442600",
> "transmission_id": "65832150921904138"
> }
> }
> },
> {
> "msys": {
> "message_event": {
> "type": "spam_complaint",
> "campaign_id": "Example Campaign Name",
> "customer_id": "1",
> "delv_method": "esmtp",
> "event_id": "92356927693813856",
> "fbtype": "abuse",
> "friendly_from": "[hidden email]",
> "ip_pool": "Example-Ip-Pool",
> "message_id": "000443ee14578172be22",
> "rcpt_meta": {
> "customKey": "customValue"
> },
> "rcpt_tags": [
> "male",
> "US"
> ],
> "rcpt_to": "[hidden email]",
> "raw_rcpt_to": "[hidden email]",
> "rcpt_type": "cc",
> "report_by": "server.email.com",
> "report_to": "abuse.example.com",
> "sending_ip": "127.0.0.1",
> "subaccount_id": "101",
> "subject": "Summer deals are here!",
> "template_id": "templ-1234",
> "template_version": "1",
> "timestamp": "1454442600",
> "transmission_id": "65832150921904138",
> "user_str": "Additional Example Information"
> }
> }
> }
> ]
>  
>  
> Laurent
>  
> #############################################################
>  
> This message is sent to you because you are subscribed to
> the mailing list Lasso [hidden email]
> Official list archives available at http://www.lassotalk.com
> To unsubscribe, E-mail to:  
> Send administrative queries to  
>  


#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: Retreive JSON items Lasso 8.6 (Sparkpost)

Laurent Gigon
Thanks Brad, tested, it works :)

Laurent
Le 13 mai 2016 14:24, "Brad Lindsay" <[hidden email]> a écrit :

> Here’s some untested sample code that should point you in the right
> direction.
>
> local('responses') = decode_json('[{"msys": { ...');
> iterate(#responses, local('response'));
>     #response->find('msys')->find('msg_from');
> /iterate;
>
> Brad
>
>
>
> On May 12, 2016 at 11:07:48 AM, Laurent ([hidden email]) wrote:
> > Hi,
> >
> > I need to extract bounces from my mailing list using JSON results from
> > Sparkpost.
> >
> > How can I extract "msg_from" item from this result?
> >
> > Here is a sample file :
> >
> > [
> > {
> > "msys": {
> > "message_event": {
> > "type": "bounce",
> > "bounce_class": "1",
> > "campaign_id": "Example Campaign Name",
> > "customer_id": "1",
> > "delv_method": "esmtp",
> > "device_token":
> > "45c19189783f867973f6e6a5cca60061ffe4fa77c547150563a1192fa9847f8a",
> > "error_code": "554",
> > "event_id": "92356927693813856",
> > "friendly_from": "[hidden email]",
> > "ip_address": "127.0.0.1",
> > "ip_pool": "Example-Ip-Pool",
> > "message_id": "000443ee14578172be22",
> > "msg_from": "[hidden email]",
> > "msg_size": "1337",
> > "num_retries": "2",
> > "rcpt_meta": {
> > "customKey": "customValue"
> > },
> > "rcpt_tags": [
> > "male",
> > "US"
> > ],
> > "rcpt_to": "[hidden email]",
> > "raw_rcpt_to": "[hidden email]",
> > "rcpt_type": "cc",
> > "raw_reason": "MAIL REFUSED - IP (17.99.99.99) is in black list",
> > "reason": "MAIL REFUSED - IP (a.b.c.d) is in black list",
> > "routing_domain": "example.com",
> > "sending_ip": "127.0.0.1",
> > "sms_coding": "ASCII",
> > "sms_dst": "7876712656",
> > "sms_dst_npi": "E164",
> > "sms_dst_ton": "International",
> > "sms_src": "1234",
> > "sms_src_npi": "E164",
> > "sms_src_ton": "Unknown",
> > "subaccount_id": "101",
> > "subject": "Summer deals are here!",
> > "template_id": "templ-1234",
> > "template_version": "1",
> > "timestamp": "1454442600",
> > "transmission_id": "65832150921904138"
> > }
> > }
> > },
> > {
> > "msys": {
> > "message_event": {
> > "type": "spam_complaint",
> > "campaign_id": "Example Campaign Name",
> > "customer_id": "1",
> > "delv_method": "esmtp",
> > "event_id": "92356927693813856",
> > "fbtype": "abuse",
> > "friendly_from": "[hidden email]",
> > "ip_pool": "Example-Ip-Pool",
> > "message_id": "000443ee14578172be22",
> > "rcpt_meta": {
> > "customKey": "customValue"
> > },
> > "rcpt_tags": [
> > "male",
> > "US"
> > ],
> > "rcpt_to": "[hidden email]",
> > "raw_rcpt_to": "[hidden email]",
> > "rcpt_type": "cc",
> > "report_by": "server.email.com",
> > "report_to": "abuse.example.com",
> > "sending_ip": "127.0.0.1",
> > "subaccount_id": "101",
> > "subject": "Summer deals are here!",
> > "template_id": "templ-1234",
> > "template_version": "1",
> > "timestamp": "1454442600",
> > "transmission_id": "65832150921904138",
> > "user_str": "Additional Example Information"
> > }
> > }
> > }
> > ]
> >
> >
> > Laurent
> >
> > #############################################################
> >
> > This message is sent to you because you are subscribed to
> > the mailing list Lasso [hidden email]
> > Official list archives available at http://www.lassotalk.com
> > To unsubscribe, E-mail to:
> > Send administrative queries to
> >
>
>
> #############################################################
>
> This message is sent to you because you are subscribed to
>   the mailing list Lasso [hidden email]
> Official list archives available at http://www.lassotalk.com
> To unsubscribe, E-mail to: <[hidden email]>
> Send administrative queries to  <[hidden email]>

#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>