1 Reply Latest reply on Aug 22, 2013 10:40 AM by 18849

    Passing program tokens to requestCampaign

      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
                                               }
                                       }
                               });