Articles in this section

TransactionalCampaignSubmit v3.1

TransactionalCampaignSubmit is used to send a single email to a single email address. To send a transactional message based on a campaign, first a Campaign must be created by following the instructions here. The Campaign contains most of the information necessary to render the message, except the recipient data needed to render and send the message. The TransactionalCampaignSubmit API requires that a CampaignId be provided with the request, as well as the recipient data used to render and send the message.

Deprecated Versions

(none)

Required Parameters

Parameter Personalizable Description
Action   TransactionalCampaignSubmit
AccountId    The MessageGears account id to which this item belongs.
ApiKey    A secret key only known by you. Keep this key confidential.
CampaignId    The CampaignId of the campaign to be used to render the message. This Id is displayed when creating and promoting a campaign.
RecipientXml   The XML for a single recipient supplied in the prescribed format.

Optional Parameters

Parameter Personalizable Description
ContextDataXml   This field is used to supply data to the template that is not directly related to the recipient. For example, this field could contain data about weekly airfare specials by city. The template could then select only the fares that originated from the same city as the recipients home. This helps make it easy to create templates with relevant data for each recipient.
NotificationEmailAddress    If this value is specified, any errors that are encountered in processing the job are emailed to this address. This can be very helpful for initial development and testing.
CorrelationId    This field allows you to supply your own job id. This Id will be returned with all reporting data (including the real-time data feed) and can make it much easier to match events coming out of MessageGears with the job they belong to in your own system.
AttachmentUrl.n  

The URL where the attachment file is located. As many as 5 attachments can be supplied. Each attachment must have the appropriate suffix (i.e. .1, .2, .3, .4, .5).

AttachmentContent.n  

The base64 encoded string containing the attachment content. As many as 5 attachments can be supplied. Each attachment must have the appropriate suffix (i.e. .1, .2, .3, .4, .5).

AttachmentName.n   The name displayed in the email message for the attached file. This is an optional field and if not provided, the name of the file is used as the attachment name.
AttachmentContentType.n   The content type associated with the attachment.

Programming Examples

REST

Request

https://api.messagegears.net/3.1/WebService
?Action=TransactionalCampaignSubmit
&AccountId=123456789
&ApiKey=8bb6118f8fd6935ad0876a3be34a717d32708ffd
&CampaignId=22222222
&RecipientXml=<Recipient><EmailAddress>john.doe@aol.com</EmailAddress></Recipient>

Response

<TransactionalJobSubmitResponse>
<RequestId>t23110-a9e77b7c-c980-4ff5-8ede-546fbe0bad66</RequestId>
<Result>REQUEST_SUCCESSFUL</Result>
</TransactionalJobSubmitResponse>

Java SDK

Click here for more information on using the MessageGears Java SDK
package com.messagegears.sdk.examples;

import com.messagegears.sdk.v3_1.TransactionalJobSubmitResponse;
import com.messagegears.sdk.MessageGearsClient;
import com.messagegears.sdk.MessageGearsProperties;
import com.messagegears.sdk.model.request.TransactionalJobSubmitRequest;
import com.messagegears.sdk.output.ScreenWriter;

public class TransactionalJobSubmit {

public static final String MY_EMAIL_ADDRESS = "place your email address here";
public static final String MY_MESSAGEGEARS_ACCOUNT_ID = "place your MessageGears account id here";
public static final String MY_MESSAGEGEARS_API_KEY = "place your MessageGears api key here";

public static void main(String[] args) {
// Create the properties object containing the necessary properties
MessageGearsProperties properties = new MessageGearsProperties();
properties.setMyMessageGearsAccountId(MY_MESSAGEGEARS_ACCOUNT_ID);
properties.setMyMessageGearsApiKey(MY_MESSAGEGEARS_API_KEY);

// Create the main client object
MessageGearsClient client = new MessageGearsClient(properties);

// Create a transactional job request
TransactionalCampaignSubmitRequest request = new TransactionalCampaignSubmitRequest();

// Create the XML that represents the email recipient
// (the Recipient and EmailAddress elements are required)
request.setRecipientXml("<Recipient><EmailAddress>" +
MY_EMAIL_ADDRESS + "</EmailAddress><FirstName>You</FirstName></Recipient>");

// Set the campaign id
request.setCampaignId(12345);

// Execute the request
TransactionalJobSubmitResponse response = client.transactionalCampaignSubmit(request);

// Print the result (success or failure)
ScreenWriter.printResponse(response);
}

}

C# SDK

Click here for more information on using the MessageGears .Net SDK
using System;
using MessageGears;
using MessageGears.Model;
using MessageGears.Model.Generated;

namespace MessageGears.Sample
{
public class TransactionalSample
{
// Replace this value with your email address
public const String MY_EMAIL_ADDRESS = "place your email address here";
public const String MY_MESSAGEGEARS_ACCOUNT_ID = "place your MessageGears account id here";
public const String MY_MESSAGEGEARS_API_KEY = "place your MessageGears api key here";

public static void Main ()
{
// Create the properties object containing the necessary properties
MessageGearsProperties props = new MessageGearsProperties();
props.MyMessageGearsAccountId = MY_MESSAGEGEARS_ACCOUNT_ID;
props.MyMessageGearsApiKey = MY_MESSAGEGEARS_API_KEY;

// Create the main client object
MessageGearsClient client = new MessageGearsClient(props);

// Create a transactional campaign request
TransactionalCampaignSubmitRequest request = new TransactionalCampaignSubmitRequest();

// Create the XML that represents the email recipient
// (the Recipient and EmailAddress elements are required)
request.RecipientXml = "<Recipient><EmailAddress>" +
MY_EMAIL_ADDRESS + "</EmailAddress><FirstName>John</FirstName></Recipient>";

// Set the campaign id
request.CampaignId = "12345";

// Execute the request
TransactionalJobSubmitResponse response = client.TransactionalCampaignSubmit(request);

// Print the result (success or failure)
client.PrintResponse(response);
}
}
}
Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Article is closed for comments.