This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.
Working with Campaigns in Marketo
Overview
The following operations allow you to work with campaigns. Click an operation name to see details on how to use it.
For a sample proxy service that illustrates how to work with campaigns, see Sample configuration.
Operation | Description |
---|---|
getCampaignById | Retrieves a campaign for a given Marketo campaign Id |
getMultipleCampaigns | Retrieves multiple campaigns. |
scheduleCampaign | Schedules a batch Smart Campaign to run either immediately or at a future date. |
requestCampaign | Runs an existing Marketo lead in a Marketo Smart Campaign. |
Operation Details
This section provides further details on the operations related to campaigns.
Get Campaign by Id
The getCampaignById
operation retrieves a campaign for a given Marketo campaign Id.
<marketo.getCampaignById> <campaignIds>{$ctx:campaignIds}</campaignIds> </marketo.getCampaignById>
properties
campaignId
: Comma separated campaign ids to be retrieved.
Sample request
Following is a sample REST/JSON request that can be handled by the getCampaignById
 operation.
{ "marketoInstanceURL":"https://Abc-def-029.mktorest.com", "clientSecret":"Vgo6rzIiJyXXXXXXXP3Zr56tK2hv8fJd", "clientId":"01f22a42-0f05-4e7f-b675-550b6XXXXXXX1", "campaignIds":"1034,1035" }
Related Marketo documentation
http://developers.marketo.com/documentation/rest/get-campaign-by-id/
Get Multiple Campaigns
The getMultipleLists
 operation retrieves multiple campaigns.
<marketo.getMultipleCampaigns> <campaignIds>{$ctx:campaignIds}</campaignIds> <names>{$ctx:names}</names> <programNames>{$ctx:programNames}</programNames> <workspaceNames>{$ctx:workspaceNames}</workspaceNames> <batchSize>{$ctx:batchSize}</batchSize> <nextPageToken>{$ctx:nextPageToken}</nextPageToken> </marketo.getMultipleCampaigns>
properties
campaignIds
: Comma separated list of campaign ids.names
: Comma separated list of campaign names.programNames
: Comma separated list of program names.workspaceNames
: Comma separated list of workspace names.batchSize
: The number of results to be returned in a single call.nextPageToken
: Used to paginate through large result sets.
Sample Request
Following is a sample REST/JSON request that can be handled by the getMultipleCampaigns
operation.
{ "marketoInstanceURL":"https://Abc-def-029.mktorest.com", "clientSecret":"Vgo6rzIiJyXXXXXXXP3Zr56tK2hv8fJd", "clientId":"01f22a42-0f05-4e7f-b675-550b6XXXXXXX1", "campaignIds":"1034,1035" }
Related Marketo documentation
http://developers.marketo.com/documentation/rest/get-multiple-campaigns/
Schedule Campaign
The scheduleCampaign
operation schedules a batch Smart Campaign to run either immediately or at a future date.
<marketo.scheduleCampaign> <campaignId>{$ctx:campaignId}</campaignId> <runAt>{$ctx:runAt}</runAt> <tokens>{$ctx:tokens}</tokens> </marketo.scheduleCampaign>
properties
campaignId
: The Marketo id of the campaign.runAt
: The time to run the scheduled campaign.tokens
: An array of name/value pair for the token.
Sample Request
Following is a sample REST/JSON request that can be handled by the  scheduleCampaignÂ
operation.
{ "marketoInstanceURL":"https://Abc-def-029.mktorest.com", "clientSecret":"Vgo6rzIiJyXXXXXXXP3Zr56tK2hv8fJd", "clientId":"01f22a42-0f05-4e7f-b675-550b6XXXXXXX1", "campaignId":"1034", "runAt": "2015-03-26T18:04:10+0000", "tokens" : [ { "name": "{{my.num}}", "value": 897 } ] }
Related Marketo documentation
http://developers.marketo.com/documentation/rest/schedule-campaign/
Request Campaign
The requestCampaign
runs an existing Marketo lead in a Marketo Smart Campaign.
<marketo.requestCampaign> <campaignId>{$ctx:campaignId}</campaignId> <leadIds>{$ctx:leadIds}</leadIds> <tokens>{$ctx:tokens}</tokens> </marketo.requestCampaign>
properties
campaignId
: The Marketo id of the campaign.leadIds
: Comma separated list of leads.tokens
: An array of name/value pair for the token.
Sample requestÂ
Following is a sample REST/JSON request that can be handled by the requestCampaign
 operation.
{ "marketoInstanceURL":"https://Abc-def-029.mktorest.com", "clientSecret":"Vgo6rzIiJyXXXXXXXP3Zr56tK2hv8fJd", "clientId":"01f22a42-0f05-4e7f-b675-550b6XXXXXXX1", "leadIds": "399", "tokens" : [ { "name": "{{my.num}}", "value": 897 } ] }
Related Marketo documentation
http://developers.marketo.com/documentation/rest/request-campaign/
Sample Configuration
Following is a sample proxy service that illustrates how to connect to Marketo with the init operation and use the
scheduleCampaign
 operation. The sample request for this proxy can be found in  scheduleCampaign sample request. You can use this sample as a template for using other operations in this category.
<proxy xmlns="http://ws.apache.org/ns/synapse" name="scheduleCampaign" transports="https,http" statistics="disable" trace="disable" startOnLoad="true"> <target> <inSequence> <property name="marketoInstanceURL" expression="json-eval($.marketoInstanceURL)"/> <property name="clientId" expression="json-eval($.clientId)"/> <property name="clientSecret" expression="json-eval($.clientSecret)"/> <property name="campaignId" expression="json-eval($.campaignId)"/> <property name="runAt" expression="json-eval($.runAt)"/> <property name="tokens" expression="json-eval($.tokens)"/> <marketo.init> <marketoInstanceURL>{$ctx:marketoInstanceURL}</marketoInstanceURL> <clientId>{$ctx:clientId}</clientId> <clientSecret>{$ctx:clientSecret}</clientSecret> </marketo.init> <marketo.scheduleCampaign> <campaignId>{$ctx:campaignId}</campaignId> <runAt>{$ctx:runAt}</runAt> <tokens>{$ctx:tokens}</tokens> </marketo.scheduleCampaign> <respond/> </inSequence> <outSequence> <log/> <send/> </outSequence> </target> <description/> </proxy>