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.

Prior 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.

Click here for more information.

Optional Parameters

Parameter Personalizable Description
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.
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.

Click here for more information.

Programming Examples

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>

Click here to see more details about using the MessageGears Java SDK
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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);
    }
 
}
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);
    }

}

Click here to see more details about using the MessageGears .Net SDK
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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);
        }
    }
}
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);
 		}
 	}
}