Passing program tokens to requestCampaign | Community
Skip to main content
August 22, 2013
Question

Passing program tokens to requestCampaign

  • August 22, 2013
  • 1 reply
  • 1260 views
I am trying to use the SOAP API to send emails using the requestCampaign method. I can't seem to get Marketo to replace the tokens in my programTokenList. I received the following error:

Parameters should be either (source, campaignId, leadList) or (source, programName, campaignName, leadList, programTokenList) (20114)

If I make the call and only pass the source, campaignId, and leadList parameters, it works, and sends the email as expected (with all of the default values for tokens). If I try the other method suggested in the error message, I get the same error.

I used the SOAP API getCampaignsForSource to get my campaign name, but I've also tried every other variation. For example, I have a program called Send Email via API, and a campaign called Send Email. I've tried passing those values to programName and campaignName, respectively, but also null for programName and Send Email via API.SendEmail for the campaignName. 

How can I pass the tokens correctly? The following is an example of the code I'm using:

var response = appBinding.requestCampaign(new ParamsRequestCampaign
                    {
                        campaignIdSpecified = false,
                        programName = "Send Email via API",
                        campaignName = "Send Email via API.Send Email",
                        source = ReqCampSourceType.MKTOWS,
                        leadList = new[]
                            {
                                new LeadKey
                                    {
                                        keyType = LeadKeyRef.IDNUM,
                                        keyValue = Convert.ToString(leadId)
                                    }
                            },
                        programTokenList = new[]
                            {
                                new Attrib
                                    {
                                        name = "{{my.Subject}}",
                                        value = saveCartUrl
                                    }
                            }
                    });
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

August 22, 2013
After some further analysis with fiddler, I found out I was still hitting the v1.7 endpoint, and not the 2.1 endpoint. After updating, everything worked as expected.
New Participant
September 2, 2022

How to hit the 2.1 endpoint? I am getting same error when adding programTokenList in XML request body

SanfordWhiteman
New Participant
September 2, 2022

I have to ask why you’re using the SOAP API, which is both deprecated and dangerous from a security standpoint, instead of the REST API?