The Real-Time Account Activity 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.
XSD Location
For a detailed list of all response values, refer to the XSD file below.
Deprecated Versions
v3.0 (unchanged in 3.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. |
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. |
EmailAddress | The email address of the recipient responsible for the activity item. |
IpAddress | The ip address that generated the activity. |
CorrelationId (Optional) | 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. |
RecipientId (Optional) | The Recipient ID for the recipient that generated an event. The Recipient ID is intended to be a unique identifier for each recipient in your source data, providing reporting metrics without the need to display PII. |
JobCategory (Optional) | The category for that job invocation, if supplied. The job category creates the opportunity for unique and aggregate job reporting using detailed event information. |
Click the Activity Types below to view more about each activity response, including example responses and complete response elements.
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();
}
}
}
Comments
Article is closed for comments.