Articles in this section

RealTimeAccountActivity via SQS v/3.2

This service provides a way to simply and easily consume account activity data in real-time as events (clicks, opens, bounces, etc.) occur. This can be extremely useful for applications using MessageGears that need to capture their activity data more frequently than once a day (i.e. for a job dashboard). The data is formatted using exactly the same XML structure as the AccountActivity API results. The only difference is that the data will come from a queue in many small XML payloads.

Deprecated Versions

v3.1

Implementation

Amazon provides their Simple Queue Service as a way to easily and securely transfer data using their API.

Response Values

Common Response Elements (present for all activity types)
Element Name Description
ActivityItems The root element of the XML response.
AccountId The MessageGears account to which this item belongs.
RequestId The MessageGears request ID of the job of which the activity items belongs.
CorrelationId The correlation ID provided with the invocation of this job, if supplied. This field allows you to supply your own job ID. This ID is designed to make it easier to match events coming out of MessageGears with the job they belong to in your own system.
ActivityId The unique activity ID for an individual activity item.
Timestamp The time that the event/activity item occurred.
JobCategory The job category provided for this job (if supplied). This is a user-defined field and is provided as a convenience. Its purpose is to allow the user to categorize this request and the activity associated with it in internal reporting.
CampaignId The campaign ID for this activity (if supplied).
CampaignVersion The campaign version associated with this activity (if associated with a campaign).
EmailAddress The email address of the recipient associated with the activity item.
IpAddress

The IP address of the recipient that generated the activity. If the recipient is on a VPN, it may not be regionally accurate.

RecipientId

The recipient ID provided in the recipient XML (if supplied).

Click the Activity Types below to view more about each activity response, including example responses and complete response elements.

Click Activity Response

<ActivityItems>
	<ClickActivity>
		<RequestId>t25710-07bc4beb-34de-44d1-85b0-d27628a78b2c</RequestId>
		<CorrelationId>My Job Id: 101010</CorrelationId>
		<ActivityId>57e01e05-f10c-48aa-bd29-8a0912e72d40</ActivityId>
		<EmailAddress>joe@gmail.com</EmailAddress>
		<Timestamp>2010-09-14T15:50:19.491-04:00</Timestamp>
		<IpAddress>74.60.196.56</IpAddress>
		<UserAgent>Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_4; en-us) AppleWebKit/533.17.8 (KHTML, like Gecko) Version/5.0.1 Safari/533.17.8</UserAgent>
		<Url>http://www.mycompany.com</Url>
		<UrlName>Home Page</UrlName>
		<Microsite>true</Microsite>
	</ClickActivity>
</ActivityItems>
Element Name Description
ClickActivity The element containing all the click information. This is a repeating element, one for each click event for the specified day.
UserAgent The browser type (or email client) used to provide the event.
Url The URL of the clicked link.
UrlName The name (if any) of the link you provided in the template when the link was made trackable.
Microsite Will be set to "true" if this event originated from a microsite version of an email message.

Open Activity Response

<ActivityItems>
<OpenActivity>
<RequestId>t25710-07bc4beb-34de-44d1-85b0-d27628a78b2c</RequestId>
<CorrelationId>My Job Id: 101010</CorrelationId>
<ActivityId>57e01e05-f10c-48aa-bd29-8a0912e72d40</ActivityId>
<EmailAddress>joe@gmail.com</EmailAddress>
<Timestamp>2010-09-14T15:49:16.064-04:00</Timestamp>
<IpAddress>74.60.196.56</IpAddress>
<UserAgent>Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_4; en-us) AppleWebKit/533.17.8 (KHTML, like Gecko) Version/5.0.1 Safari/533.17.8</UserAgent>
<Microsite>true</Microsite>
</OpenActivity>
</ActivityItems>
Element Name Description
OpenActivity The element containing all the open information. This is a repeating element, one for each open event for the specified day.
UserAgent The browser type (or email client) used to provide the event.
Microsite Will be set to “true” if this event originated from a microsite version of an email message.

Delivery Activity Response

<ActivityItems>
<DeliveredMessageActivity>
<RequestId>t25610-3147e501-c83f-42a5-b638-c476e1237a65</RequestId>
<CorrelationId>My Job Id: 101010</CorrelationId>
<ActivityId>57e01e05-f10c-48aa-bd29-8a0912e72d40</ActivityId>
<EmailAddress>joe@gmail.com</EmailAddress>
<Timestamp>2010-09-13T18:51:00.000-04:00</Timestamp>
<IpAddress>74.125.47.27</IpAddress>
</DeliveredMessageActivity>
</ActivityItems>
Element Name Description
DeliveredMessageActivity The element containing all the delivery information. This is a repeating element, one for each email delivered for the specified day.

Bounce Activity Response

<ActivityItems>
<BouncedMessageActivity>
<RequestId>t25610-2d7e1a55-f161-4af1-8f33-c994a0327a8b</RequestId>
<CorrelationId>My Job Id: 101010</CorrelationId>
<ActivityId>57e01e05-f10c-48aa-bd29-8a0912e72d40</ActivityId>
<EmailAddress>joe@gmail.com</EmailAddress>
<Timestamp>2010-09-13T19:10:54.000-04:00</Timestamp>
<Category>Invalid Recipient</Category>
<CategoryCode>10</CategoryCode>
<Details>550-5.1.1 The email account that you tried to reach does not exist.</Details>
<IpAddress>74.125.47.27</IpAddress>
</BouncedMessageActivity>
</ActivityItems>
Element Name Description
BouncedMessageActivity The element containing all the bounce information. This is a repeating element, one for each bounce event for the specified day.
Category A general category of the bounce.
CategoryCode A unique code that identifies the category of the bounce.
Details The detailed bounce message.

Bounce Categories

Please remove all bounces of type 10 and 30. Failure to do so may negatively impact your inbox performance with the various ISPs.
Category Category Code Description
Undetermined 1 The response text could not be identified.
Invalid Recipient 10 The recipient is invalid.
Soft Bounce 20 The message soft bounced.
DNS Failure 21 The message bounced due to a DNS failure.
Mailbox Full 22 The message bounced due to the remote mailbox being over quota.
Too Large 23 The message bounced because it was too large for the recipient.
Timeout 24 The message timed out.
Admin Failure 25 The message was failed by configured policies.
Generic Bounce: No RCPT 30 No recipient could be determined for the message.
Generic Bounce 40 The message failed for unspecified reasons.
Mail Block 50  The message was blocked by the receiver.
Spam Block 51 The message was blocked by the receiver as coming from a known spam source.
Spam Content 52 The message was blocked by the receiver as spam.
Prohibited Attachment 53 The message was blocked by the receiver because it contained an attachment.
Relay Denied 54 The message was blocked by the receiver because relaying is not allowed.
Transient Failure 70 Message transmission has been temporarily delayed.
Invalid Email Syntax 110 The message has a malformed/invalid email address.
Hardbounce Suppression 130 The message is a known-bad email address and has hard-bounces with a category 10 or 30 in the past. It was suppressed from sending to protect IP reputation with the ISP.
Unsubscribe Suppression 131 The recipient of the message has unsubscribed from a message from your account in the past. It was suppressed from sending to protect your sending reputation.
Fbl Suppression 132 The recipient of the message has filed a spam complaint with your account in the past. It was suppressed from sending to protect your sending reputation.
Complainer Suppression 133 The recipient of the message is a known complainer. It was suppressed from sending to protect your sending reputation.
Domain Suppression 134 The recipient domain is not allowed. It was suppressed from sending to protect your sending reputation.
Role Suppression 135 The recipient address is not allowed. It was suppressed from sending to protect your sending reputation.

Unsubscribe Activity Response

<ActivityItems>
<UnsubActivity>
<RequestId>t25810-eec987c5-085b-4d40-a4ce-24a5850638a5</RequestId>
<CorrelationId>My Job Id: 101010</CorrelationId>
<ActivityId>57e01e05-f10c-48aa-bd29-8a0912e72d40</ActivityId>
<EmailAddress>joe@gmail.com</EmailAddress>
<Timestamp>2010-09-15T16:14:46.878-04:00</Timestamp>
<IpAddress>128.234.11.12</IpAddress>
<UserAgent>Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_4; en-us) AppleWebKit/533.17.8 (KHTML, like Gecko) Version/5.0.1 Safari/533.17.8</UserAgent>
</UnsubActivity>
</ActivityItems>
Element Name Description
UnsubActivity The element containing all the unsub information. This is a repeating element, one for each open event for the specified day.
UserAgent The browser type (or email client) used to provide the event.
Microsite Will be set to “true” if this event originated from a microsite version of an email message.

Spam Complaint Activity Response

<ActivityItems>
<SpamComplaintActivity>
<RequestId>t25810-eec987c5-085b-4d40-a4ce-24a5850638a5</RequestId>
<CorrelationId>My Job Id: 101010</CorrelationId>
<ActivityId>57e01e05-f10c-48aa-bd29-8a0912e72d40</ActivityId>
<EmailAddress>joe@gmail.com</EmailAddress>
<Timestamp>2010-09-15T16:14:46.878-04:00</Timestamp>
<Isp>gmail.com</Isp>
</SpamComplaintActivity>
</ActivityItems>
Element Name Description
SpamComplaintActivity The element containing the Spam Complaint information. This is a repeating element, one for each complaint received for the specified day.
Isp The domain part of the recipient’s email address.

Job Error Activity Response

<ActivityItems>
<JobErrorActivity>
<RequestId>t25710-9540c8d8-aa5d-44d7-a9ef-a334072df515</RequestId>
<CorrelationId>My Job Id: 101010</CorrelationId>
<ActivityId>57e01e05-f10c-48aa-bd29-8a0912e72d40</ActivityId>
<Timestamp>2010-09-14T13:20:36.994-04:00</Timestamp>
<JobError>
<ErrorCode>Transfer Error</ErrorCode>
<ErrorMessage>AmazonClientException retrieving file: s3://mycompany/myfile.txt - The specified key does not exist.</ErrorMessage>
</JobError>
</JobErrorActivity>
</ActivityItems>
Element Name Description
JobErrorActivity The element containing theJob Error information. This is a repeating element, one for each job that failed to be processed for the specified day.
JobError A repeating element, one for each error that occurred.
ErrorCode A general error code for the failure.
ErrorMessage A detailed error description.

Render Error Activity Response

<ActivityItems>
<RenderErrorActivity>
<RequestId>t25610-0b74f4c6-fe21-411f-bba9-82818bf1c31b</RequestId>
<CorrelationId>My Job Id: 101010</CorrelationId>
<ActivityId>57e01e05-f10c-48aa-bd29-8a0912e72d40</ActivityId>
<EmailAddress>joe@gmail.com</EmailAddress>
<Timestamp>2010-09-13T19:13:46.220-04:00</Timestamp>
<RenderErrors>
<RenderError>
<ErrorCode>Template merge exception</ErrorCode>
<ErrorMessage>Error on line 1, column 10 in SUBJECT Expecting a string, date or number here, Expression Recipient.FirstNamex is instead a freemarker.ext.dom.NodeListModel</ErrorMessage>
</RenderError>
</RenderErrors>
</RenderErrorActivity>
</ActivityItems>
Element Name Description
RenderErrorActivity The element containing the error information regarding the rendering of an email message. This is a repeating element, one for each email that failed to be rendered for the specified day.
Erro Code A general error code for the failure.
ErrorMessage A detailed error description.

Programming Examples

Java SDK

package com.messagegears.sdk.examples;

import com.messagegears.sdk.v3_1.BouncedMessageActivity;
import com.messagegears.sdk.v3_1.ClickActivity;
import com.messagegears.sdk.v3_1.DeliveredMessageActivity;
import com.messagegears.sdk.v3_1.JobErrorActivity;
import com.messagegears.sdk.v3_1.OpenActivity;
import com.messagegears.sdk.v3_1.RenderErrorActivity;
import com.messagegears.sdk.v3_1.SpamComplaintActivity;
import com.messagegears.sdk.v3_1.UnsubActivity;
import com.messagegears.sdk.MessageGearsListener;
import com.messagegears.sdk.aws.MessageGearsAwsProperties;
import com.messagegears.sdk.aws.MessageGearsAwsQueuePoller;
import com.messagegears.sdk.output.ScreenWriter;

public class ActivityFeedExample implements MessageGearsListener {

public static final String MY_AWS_ACCOUNT_ID = "place your aws account id here";
public static final String MY_AWS_SECRET_KEY = "place your aws secret key here";
public static final String MY_AWS_QUEUE = "place your sqs queue url here";

public static void main (String[] args) {
// Create the AWS properties object
MessageGearsAwsProperties props = new MessageGearsAwsProperties();
props.setMyAwsAccountKey(MY_AWS_ACCOUNT_ID);
props.setMyAwsSecretKey(MY_AWS_SECRET_KEY);
props.setMyAwsEventQueueUrl(MY_AWS_QUEUE);

// Create an object of this listener class and start the poller passing in the listener
ActivityFeedExample listener = new ActivityFeedExample();
MessageGearsAwsQueuePoller poller = new MessageGearsAwsQueuePoller(props, listener);
poller.start();
}

public void onOpen(OpenActivity activity) {
ScreenWriter.print(activity);
}

public void onClick(ClickActivity activity) {
ScreenWriter.print(activity);
}

public void onBounce(BouncedMessageActivity activity) {
ScreenWriter.print(activity);
}

public void onDelivery(DeliveredMessageActivity activity) {
ScreenWriter.print(activity);
}

public void onSpamComplaint(SpamComplaintActivity activity) {
ScreenWriter.print(activity);
}

public void onJobError(JobErrorActivity activity) {
ScreenWriter.print(activity);
}

public void onRenderError(RenderErrorActivity activity) {
ScreenWriter.print(activity);
}

public void onUnsub(UnsubActivity activity) {
ScreenWriter.print(activity);
}
}

C# SDK

using System;

using MessageGears.Model.Generated;
using MessageGears.EventQueue;

namespace MessageGears.Examples
{
public class ActivityFeedExample : MessageGearsListener
{
public const String MY_AWS_ACCOUNT_ID = "place your aws account id here";
public const String MY_AWS_SECRET_KEY = "place your aws secret key here";
public const String MY_AWS_QUEUE = "place your sqs queue url here";

public static void Main ()
{
// Create the AWS properties object
MessageGearsAwsProperties props = new MessageGearsAwsProperties();
props.MyAWSAccountKey = MY_AWS_ACCOUNT_ID;
props.MyAWSSecretKey = MY_AWS_SECRET_KEY;
props.MyAWSEventQueueUrl = MY_AWS_QUEUE;

// Create an object of this listener class and start the poller passing in the listener
ActivityFeedExample listener = new ActivityFeedExample();
MessageGearsAwsQueuePoller poller = new MessageGearsAwsQueuePoller(props, listener);
poller.Start();
}

public void OnOpen(OpenActivity activity)
{
Console.WriteLine("***** Open Event Received");
Console.WriteLine("ActivityId: " + activity.ActivityId);
Console.WriteLine("CorrelationId: " + activity.CorrelationId);
Console.WriteLine("EmailAddress: " + activity.EmailAddress);
Console.WriteLine("IpAddress: " + activity.IpAddress);
Console.WriteLine("RecipientId: " + activity.RecipientId);
Console.WriteLine("RequestId: " + activity.RequestId);
Console.WriteLine("Timestamp: " + activity.Timestamp);
Console.WriteLine("UserAgent: " + activity.UserAgent);
Console.WriteLine();
}

public void OnClick(ClickActivity activity)
{
Console.WriteLine("***** Click Event Received: " + activity.ActivityId);
Console.WriteLine("ActivityId: " + activity.ActivityId);
Console.WriteLine("CorrelationId: " + activity.CorrelationId);
Console.WriteLine("EmailAddress: " + activity.EmailAddress);
Console.WriteLine("IpAddress: " + activity.IpAddress);
Console.WriteLine("RecipientId: " + activity.RecipientId);
Console.WriteLine("RequestId: " + activity.RequestId);
Console.WriteLine("Timestamp: " + activity.Timestamp);
Console.WriteLine("Url: " + activity.Url);
Console.WriteLine("UrlName: " + activity.UrlName);
Console.WriteLine("UserAgent: " + activity.UserAgent);
Console.WriteLine();
}

public void OnBounce(BouncedMessageActivity activity)
{
Console.WriteLine("***** Bounce Event Received");
Console.WriteLine("ActivityId: " + activity.ActivityId);
Console.WriteLine("Category: " + activity.Category);
Console.WriteLine("CategoryCode: " + activity.CategoryCode);
Console.WriteLine("CorrelationId: " + activity.CorrelationId);
Console.WriteLine("Details: " + activity.Details);
Console.WriteLine("EmailAddress: " + activity.EmailAddress);
Console.WriteLine("IpAddress: " + activity.IpAddress);
Console.WriteLine("MessageSize: " + activity.MessageSize);
Console.WriteLine("RecipientId: " + activity.RecipientId);
Console.WriteLine("RequestId: " + activity.RequestId);
Console.WriteLine("Timestamp: " + activity.Timestamp);
Console.WriteLine();
}

public void OnDelivery(DeliveredMessageActivity activity)
{
Console.WriteLine("***** Delivery Event Received");
Console.WriteLine("ActivityId: " + activity.ActivityId);
Console.WriteLine("CorrelationId: " + activity.CorrelationId);
Console.WriteLine("EmailAddress: " + activity.EmailAddress);
Console.WriteLine("IpAddress: " + activity.IpAddress);
Console.WriteLine("MessageSize: " + activity.MessageSize);
Console.WriteLine("RecipientId: " + activity.RecipientId);
Console.WriteLine("RequestId: " + activity.RequestId);
Console.WriteLine("Timestamp: " + activity.Timestamp);
Console.WriteLine();
}

public void OnSpamComplaint(SpamComplaintActivity activity)
{
Console.WriteLine("***** Spam Complaint Event Received");
Console.WriteLine("ActivityId: " + activity.ActivityId);
Console.WriteLine("CorrelationId: " + activity.CorrelationId);
Console.WriteLine("EmailAddress: " + activity.EmailAddress);
Console.WriteLine("IpAddress: " + activity.IpAddress);
Console.WriteLine("Isp: " + activity.Isp);
Console.WriteLine("RecipientId: " + activity.RecipientId);
Console.WriteLine("RequestId: " + activity.RequestId);
Console.WriteLine("Subject: " + activity.Subject);
Console.WriteLine("Timestamp: " + activity.Timestamp);
Console.WriteLine();
}

public void OnJobError(JobErrorActivity activity)
{
Console.WriteLine("***** Job Error Event Received");
Console.WriteLine("ActivityId: " + activity.ActivityId);
Console.WriteLine("CorrelationId: " + activity.CorrelationId);
Console.WriteLine("JobError: " + activity.JobError);
Console.WriteLine("RequestId: " + activity.RequestId);
Console.WriteLine("Timestamp: " + activity.Timestamp);
Console.WriteLine();
}

public void OnRenderError(RenderErrorActivity activity)
{
Console.WriteLine("***** Render Error Event Received");
Console.WriteLine("ActivityId: " + activity.ActivityId);
Console.WriteLine("CorrelationId: " + activity.CorrelationId);
Console.WriteLine("EmailAddress: " + activity.EmailAddress);
Console.WriteLine("RecipientId: " + activity.RecipientId);
Console.WriteLine("RenderErrors: " + activity.RenderErrors);
Console.WriteLine("RequestId: " + activity.RequestId);
Console.WriteLine("Timestamp: " + activity.Timestamp);
Console.WriteLine();
}

public void OnUnsub(UnsubActivity activity)
{
Console.WriteLine("***** Unsub Event Received");
Console.WriteLine("ActivityId: " + activity.ActivityId);
Console.WriteLine("CorrelationId: " + activity.CorrelationId);
Console.WriteLine("EmailAddress: " + activity.EmailAddress);
Console.WriteLine("IpAddress: " + activity.IpAddress);
Console.WriteLine("RecipientId: " + activity.RecipientId);
Console.WriteLine("RequestId: " + activity.RequestId);
Console.WriteLine("Timestamp: " + activity.Timestamp);
Console.WriteLine("UserAgent: " + activity.UserAgent);
Console.WriteLine();
}
}
}
Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Article is closed for comments.