- Tweet
- Share0
- +1
- LinkedIn0
Imagine you want to automate your call center follow-up emails. After your support rep speaks with a customer, you would like to automatically send an email thanking them for contacting your company. Let’s take this a step further, and say you want to include the specific conversation topic discussed with the customer that you track in your CRM. You can do this from Marketo using the requestCampaign SOAP API to send an email with dynamic content.
The requestCampaign API allows you to pass in a lead or leads. It also allows you to pass in Program Tokens that can be used with an existing Campaign to send dynamic content. The requestCampaign SOAP API requires the email recipient to exist in Marketo. So before calling the requestCampaign API, use the getLead API to verify if the email exists in Marketo.
We’ll show you first how to create a Smart Campaign, second how to set up a trigger to send a campaign via the API, third how to create an email that accepts dynamic content via Program Tokens, fourth how to define an email as part of a flow action, and fifth a code sample that would be used to execute this campaign.
How to Create a New Smart Campaign in Marketo
Smart Campaigns in Marketo execute all of your marketing activities. You can set up a series of automated actions to take on a smart list of contacts. In the case of sending transactional emails, you set up a trigger in the campaign, as shown below, to send emails using the API. First let’s set up the Smart Campaign.
1. In Marketing Activities, choose a Program and then under the New dropdown, click on New Local Asset
2. Click on Smart Campaign
3. Enter smart campaign name and click Create
Add Triggers to a Smart Campaign
Adding Triggers to a Smart Campaign allows you to make a Smart Campaign run on one person at a time based on a live event, which in this case is a request via the requestCampaign API.
1. Search for the “Campaign is Requested” trigger and then drag and drop it to the canvas.
2. In the trigger, select “is” and “Web Service API.”
How to Pass in Dynamic Content Using the API
In Marketo, My Tokens are variables that you can use in your Program. My Tokens enable you to enter information pertaining to your Program in one place, replace that information with a value you specify, and retrieve this information in other parts of the application, such as an email template.
Using the requestCampaign SOAP API, you can pass an array of Program Tokens, which will override existing tokens. After the campaign runs, the tokens are discarded.
You create My Tokens at either the Campaign folder level, or at the Program level. My Tokens at the Campaign folder level will inherit down to all Programs contained within the Campaign folder. If you create My Tokens at the Campaign folder level, you can overwrite the inherited value at the Program level. For example, if you define tokens for the Program Date and the Program Description at the Campaign folder level, you can overwrite these values at the individual Program level. Here’s how to do this.
1. From the Marketing Activities tree, select the Campaign folder or Program where you want to create the tokens. From the top menu bar, select My Tokens. Then the My Tokens canvas will display. From the right hand side tree, drag a Token Type to the canvas, which in this case is “Text.” In the Token Name field, highlight My Token and enter a unique Token Name, which in this case is “my.conversationtopic.” In the Value field, enter a relevant Value for the token, which in this case is “Thank you for calling us today.” Note by using the API we will override the default My Token value. Click “Save” to save the custom token.
2. Create a New Email by clicking New. Then click on New Local Assets and select Email. Next fill out the relevant fields to name your email. When drafting your email, click the Token icon to include tokens in your email. Now that you have created your template email with Tokens, we will add the email as a flow action for the Campaign in the subsequent step. So when you call the campaign via the API, the email will be sent out.
How to Create Email Flow Action on a Campaign
The association of an email with a Smart Campaign allows marketers to manage how they want an email to look, and allows the third-party application to determine who receives it and when.
After creating an email as a new Local Asset, you can set it as a flow action in a campaign.
Find and select the email you want to send.
Code Sample to Call the requestCampaign API
After setting up the campaign and triggers in the Marketo interface, we will show you how to use the API to send an email. The first sample is a XML request, the second is a XML response, and the final one is a Java code sample that can be used to generate the XML request. We also show you how to find the campaign ID that is used when making a call to the requestCampaign API.
The API call also requires you to know the ID of the Marketo campaign beforehand. You can determine the campaign ID using either of the following methods:
1. Use the getCampaignsForSource API
2. Open the Marketo campaign in a browser and look at the URL address bar. The campaign ID (represented as a 4-digit integer) can be found immediately following “SC”. For example, https://app-stage.marketo.com/#SC1025A1. The bolded portion is the campaign ID – “1025.”
SOAP Request for requestCampaign
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 | <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.marketo.com/mktows/"> <SOAP-ENV:Header> <ns1:AuthenticationHeader> <mktowsUserId>demo17_1_809939944BFABAE58E5D27</mktowsUserId><requestSignature>48397ad47b71a1439f13a51eea3137df46441979</requestSignature><requestTimestamp>2013-08-01T12:31:14-07:00</requestTimestamp> </ns1:AuthenticationHeader> </SOAP-ENV:Header> <SOAP-ENV:Body> <ns1:paramsRequestCampaign> <source>MKTOWS</source> <campaignId>4496</campaignId> <leadList> <leadKey> <keyType>EMAIL</keyType> <keyValue>lead@company.com</keyValue> </leadKey> </leadList> <programTokenList> <attrib> <name>{{my.conversationtopic}}</name> <value>Thank you for calling about adding a line of service to your current plan.</value> </attrib> </programTokenList> </ns1:paramsRequestCampaign> </SOAP-ENV:Body> </SOAP-ENV:Envelope> |
SOAP Response for requestCampaign
1 2 3 4 5 6 7 8 9 10 | <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.marketo.com/mktows/"> <SOAP-ENV:Body> <ns1:successRequestCampaign> <result> <success>true</success> </result> </ns1:successRequestCampaign> </SOAP-ENV:Body> </SOAP-ENV:Envelope> |
See below a sample Java program that executes the scenario described above.
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 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | import com.marketo.mktows.*; import java.net.URL; import javax.xml.namespace.QName; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; import javax.crypto.Mac; import javax.crypto.spec.SecretKeySpec; import org.apache.commons.codec.binary.Hex; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBElement; import javax.xml.bind.Marshaller; public class RequestCampaign { public static void main(String[] args) { System.out.println("Executing Request Campaign"); try { URL marketoSoapEndPoint = new URL("CHANGE ME" + "?WSDL"); String marketoUserId = "CHANGE ME"; String marketoSecretKey = "CHANGE ME"; QName serviceName = new QName("http://www.marketo.com/mktows/", "MktMktowsApiService"); MktMktowsApiService service = new MktMktowsApiService(marketoSoapEndPoint, serviceName); MktowsPort port = service.getMktowsApiSoapPort(); // Create Signature DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ"); String text = df.format(new Date()); String requestTimestamp = text.substring(0, 22) + ":" + text.substring(22); String encryptString = requestTimestamp + marketoUserId ; SecretKeySpec secretKey = new SecretKeySpec(marketoSecretKey.getBytes(), "HmacSHA1"); Mac mac = Mac.getInstance("HmacSHA1"); mac.init(secretKey); byte[] rawHmac = mac.doFinal(encryptString.getBytes()); char[] hexChars = Hex.encodeHex(rawHmac); String signature = new String(hexChars); // Set Authentication Header AuthenticationHeader header = new AuthenticationHeader(); header.setMktowsUserId(marketoUserId); header.setRequestTimestamp(requestTimestamp); header.setRequestSignature(signature); // Create Request ParamsRequestCampaign request = new ParamsRequestCampaign(); request.setSource(ReqCampSourceType.MKTOWS); ObjectFactory objectFactory = new ObjectFactory(); JAXBElement<Integer> campaignId = objectFactory.createParamsRequestCampaignCampaignId(4496); request.setCampaignId(campaignId); ArrayOfLeadKey leadKeyList = new ArrayOfLeadKey(); LeadKey key = new LeadKey(); key.setKeyType(LeadKeyRef.EMAIL); key.setKeyValue("lead@company.com"); leadKeyList.getLeadKeies().add(key); JAXBElement<ArrayOfLeadKey> arrayOfLeadKey = objectFactory.createParamsRequestCampaignLeadList(leadKeyList); request.setLeadList(arrayOfLeadKey); ArrayOfAttrib aoa = new ArrayOfAttrib(); Attrib attrib = new Attrib(); attrib.setName("{{my.conversationtopic}}"); attrib.setValue("Thank you for calling about adding a line of service to your current plan."); aoa.getAttribs().add(attrib); JAXBElement<ArrayOfAttrib> arrayOfAttrib = objectFactory.createParamsRequestCampaignProgramTokenList(aoa); request.setProgramTokenList(arrayOfAttrib); SuccessRequestCampaign result = port.requestCampaign(request, header); JAXBContext context = JAXBContext.newInstance(SuccessRequestCampaign.class); Marshaller m = context.createMarshaller(); m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); m.marshal(result, System.out); } catch(Exception e) { e.printStackTrace(); } } } |
After you make a call via the requestCampaign API, you can confirm it by checking to see if the Smart Campaign has run in Marketo.
*This article contains code used to implement custom integrations. Due to its customized nature, The Marketo Technical Support team is unable to troubleshoot custom work. Please do not attempt to implement the following code sample without appropriate technical experience, or access to an experienced developer.
FAQs
How do I send a dynamic email in Marketo? ›
- Go to Marketing Activities.
- Select your email and click Edit Draft.
- In this example we're making the Subject Line dynamic. Click in the Subject field, then click the Make Dynamic button. ...
- Enter the Segmentation name, select it, and click Save.
All you need to do is create a default program in Marketo. From there, add in a smart campaign with a smart list that listens for your desired action (fills out form, clicks link, visits webpage) and then use the send email flow step to send your email. Of course, you'll need to build the email before you can send it.
How do I add dynamic content to Marketo? ›- Step One: Create a token. Navigate to the program where you want to use the token. Click My Tokens. Double click on Email Script. Then name this token. ...
- Step Two: Reference the token in the email template. Note the name of the token. Navigate to your email draft. Include the token.
- Build your email list. ...
- Collect information about your subscribers. ...
- Group your subscribers. ...
- Create dynamic email content. ...
- Add email personalization. ...
- Preview for both targeted and non-targeted recipients.
Gmail supports dynamic email, messages with interactive content. Dynamic email is sometimes called AMP for email. You can interact with dynamic email like you would a website. For example, you can reply to an event invitation, or respond to comments in a Google Doc, without leaving Gmail.
What is dynamic content in Marketo? ›What is dynamic content? Dynamic content is content that displays differently to the lead based on rules that are set by the user. Content that does not display differently based on rules is called static content. Page 3.
How do I send an email through API? ›- Step 1: Create a project at Google API Console.
- Step 2: Enable Gmail API.
- Step 3: Credentials and authentication with OAuth 2.0.
- Step 4: Pick a quickstart guide.
- Step 5: API client library.
- Step 6: Access to Gmail. Go. Java. Ruby. .NET. Node.js. PHP. Python. ...
- Step 7: Create an email.
- Step 8: Send an email.
Use the Send Mail (v1) REST API to send an email to specified recipients, optionally attaching files from EPM Cloud. You can attach any file up to 10 MB in size, other than a snapshot, that is available in EPM Cloud environments.
How do I send an email through Web API? ›- Step #1 – Create an ASP.NET Core Web API project.
- Step #2 – Integrate your ASP.NET Core project with Swagger UI.
- Step #3 – Add the MailKit library.
- Step #4 – Add your SMTP server & email account details to the appsettings.json file.
- Step #5 – Make the SMTP server & email account details readable at runtime.
- Newsletters and Emails. Both newsletters and emails are probably the most basic and classic forms of dynamic content being presented. ...
- Landing Pages. ...
- Articles. ...
- Forms and Purchases. ...
- Product Pages. ...
- Website Ads. ...
- Understand Your Customer and Users First. ...
- Use Data to Monitor Your Content.
What is the difference between dynamic content and snippets in Marketo? ›
Dynamic content and Snippets are the same in that they both work by using your pre-built segmentations. Once you select the segmentation you want to personalize, you can create a message for each group. Dynamic content works better where you might want to change content one time.
How do I make dynamic content accessible? ›- Consider whether each feature will cause unexpected changes for users.
- Provide updates to inform users when content will change.
- Make sure update notifications have a suitable priority — don't interrupt screen reader users unless the update is critical.
Mail->Settings->General->Check for new messages: you can set this option for a number of settings. 'Automatically' is the default.
How do I make my email content responsive? ›Responsive email design best practices
Stick to a single column layout. Less shifting and moving makes it easier for your audience to read your content. At minimum, use 13- or 14-pt font for the body text and no smaller than 20-pt for the titles. This will make your email much more readable on a small screen.
Examples of dynamic content include personalized product recommendations on an e-commerce site, dynamic pricing that changes based on supply and demand, real-time updates on stock prices or sports scores, live chat features that provide instant customer support, interactive quizzes and surveys that adapt to user ...
What is a dynamic email template? ›A dynamic email is a type of generic email that includes variables to personalize the content for each individual recipient. A simple example of this is using the {$name} variable to add the recipient's name.
Why use dynamic content in email? ›Dynamic email content helps your team create personalized experiences at scale. No more crafting separate campaigns for different audience segments. Instead of creating a different email to talk to your leads, customers, and advocates, you can develop 1 email and switch the content based on the specific segment.
Is dynamic content faster than Static? ›Static Website Advantages
With knowledge of HTML and CSS, you can code up a decent one without too much effort or cost. Static websites also tend to be faster than dynamic websites on the user's end.
Find and select your email, then click Edit Draft. Click the Email Actions drop-down and select Save as Template. Click the Folder drop-down, select where you want the template to live, and click Save. And that's it!
What is the difference between dynamic content and personalization? ›The difference between content personalization and dynamic content personalization is automation. Dynamic personalization responds in real-time, using first-party data to serve content that's more appealing or more likely to convert. Web content personalization, by contrast, tends to respond to the last action taken.
How does dynamic content work? ›
Dynamic content is a web-page or email component that changes. Typically, changes are based on user signals that include in-session behavior, user data, and user-characteristics. In-session behavior- Adapt content based on what pages they visit, which products they add to cart, and how long they spend on site.
How to send attachment through API? ›- Open the Attachments panel and click Add Attachment. Click the image to enlarge it.
- Select the file you want to send. ReadyAPI will ask you if want to cache it in the request. ...
- Open the Request editor and set the request media type as multipart/form-data or multipart/mixed .
Transferring Files with APIs
When passing large documents “via” APIs the ideal scenario is to utilize a link to the large file and pass that link in JSON payloads, only touching the file when an application, archival system or some persistent store needs the file contents stored locally.
- Enter the URL of the API endpoint. ...
- Select the appropriate HTTP method. ...
- Enter your credentials in the Authorization tab. ...
- Click Send to submit your API request.
- It already has an API. Your system already has an API. ...
- It Will Break. Your API will break. ...
- It Will Change. Ha! ...
- It Will Be Slow. Your API will be slow. ...
- It Will Be Hard To Parse. ...
- 6: It Will Not Make You Money. ...
- Conclusion.
API is the method of communication used by different platforms or applications. SMTP allows your computer to create and send messages to the server. API is the window to send another code or utility. Comparatively, SMTP is more popular, which makes it easy to integrate and use.
How to send data through REST API? ›To send data to the REST API server, you must make an HTTP POST request and include the POST data in the request's body. You also need to provide the Content-Type: application/json and Content-Length request headers. Below is an example of a REST API POST request to a ReqBin API endpoint.
How to validate email address using API? ›- SendGrid Validation API. SendGrid is an excellent cloud-based email marketing platform that helps you send massive marketing campaigns across the world. ...
- Mailgun Email Validation. ...
- ZeroBounce. ...
- DeBounce. ...
- NeverBounce. ...
- Clearout. ...
- Hunter.
- Select 'POST' as method.
- Add Content-Type header with the value 'application/json'
- Add the value which you want to add in the list in Body and press 'SEND' button.
- In the response header, you can see the http status code and message '201 Created'
Depending on which of these is returned, Web API uses a different mechanism to create the HTTP response. Convert directly to an HTTP response message. Call ExecuteAsync to create an HttpResponseMessage, then convert to an HTTP response message. Write the serialized return value into the response body; return 200 (OK).
What are the 4 steps to create dynamic content? ›
- Step 1: Assemble your sources and identify relevant drivers & challenges. ...
- Step 2: Verify your insights & assumptions via social media. ...
- Step 3: Match your solutions to the needs of your market and test. ...
- Step 4: Develop content. ...
- Step 5: Monitor changes & adapt.
- With a layout view active, on the Insert tab, in the Graphics and Text group, click the Dynamic Text button . ...
- Choose a dynamic text tag from the gallery.
- In the layout view, click and drag a box in the desired location to create the dynamic text element.
The Array.map() method is used to render a dynamic list of components based on values in an array.
What are snippets used for Marketo? ›Snippets are reusable HTML components which can be embedded into Emails and Landing Pages and which can be segmented for dynamic content. Snippets don't have associated templates, and can be created and deployed within other assets within Marketo.
What is dynamic content insertion? ›What is dynamic content insertion? Dynamic content insertion lets you add keywords and information to pages in order to match them more closely with your visitors, ads, email campaigns and so on to make them more relevant. This is also known as symmetric messaging.
What do you need to have in place to utilize dynamic content *? ›To set up dynamic content on your website, you'll need to use a website builder that uses a content management software (CMS) – a place where you can collect and monitor user data. Most website builders such as Wix, WordPress, and Squarespace have this feature.
Where is dynamic content stored? ›Dynamic webpages are not stored as static HTML files. Instead, server-side scripts generate an HTML file in response to events, such as user interactions or user logins, and send the HTML file to the web browser. Because dynamic content is generated server-side, it is typically served from origin servers, not a cache.
How do I display dynamic content in HTML? ›Wrap each one of your dynamic content sections in a DIV and add a class called dynamic-content. Also, give each DIV a unique ID.
How do I send an auto generated email? ›- On your computer, go to Gmail .
- At the top left, click Compose.
- Create your email.
- At the bottom left next to "Send," click the Down arrow .
- Click Schedule send.
Open Preferences (on the Mac) or Tools | Options (on Windows) Click on Privacy. Select the checkbox for "Allow remote content in messages"
What is a responsive email format? ›
A responsive template will automatically adapt to any screen size, so whether the email is opened on a smartphone, tablet, or computer, it will look great, function well, and be easy for the recipient to read.
What is the best way to email sensitive information? ›- On your computer, go to Gmail.
- Click Compose.
- In the bottom right of the window, click Turn on confidential mode . Tip: If you've already turned on confidential mode for an email, go to the bottom of the email, then click Edit.
- Set an expiration date and passcode. ...
- Click Save.
- Pre-set the preview text. ...
- Write clear and clickable subject lines. ...
- Keep your emails concise. ...
- Include one call-to-action button per email. ...
- Add alt text to your CTA image. ...
- Hyperlink your emails' images. ...
- Include noticeable text links. ...
- Place at least one clickable item above the fold.
Popular dynamic programming languages include JavaScript, Python, Ruby, PHP, Lua and Perl.
What is the best example of dynamic? ›- Earthquake.
- Moving a Car.
- Hitting a Cricket Ball.
- Inflating a Balloon.
- Stretching a Band.
- Throwing an Object.
- Playing with a Dough.
- Churning Milk.
In addition to HTML, CSS, and JavaScript, a dynamic website uses a server-side scripting language like PHP or Python. This enables connection with the database to allow for interactive features and content changes.
Can Marketo send transactional emails? ›A common use case for the Marketo API is to trigger the sending of transactional emails to specific records via the Request Campaign API call.
How do I send an automated marketing email? ›- Install an email marketing tool. To start, you'll need easy-to-use email automation software (like Omnisend).
- Build and segment an email list. ...
- Set up an automation trigger. ...
- Create email campaigns. ...
- Activate the automation.
There are a few ways to answer this question: Content and purpose: A transactional email contains information about an action the recipient has already taken, while a marketing email intends to drive the recipient toward an action you want them to take.
What is the difference between transactional email and bulk email? ›Transactional emails facilitate a commercial transaction or relationship or provide an individual customer with the information necessary for a transaction or relationship. Bulk emails, which are sent from one sender to multiple recipients, are for marketing purposes.
Can Marketo send text messages? ›
Add SMS to Marketo, and grow campaign revenue
Text messages offer an average open rate of 98%, far more than any other channel. Use Marketo lifecycle triggers to send your message to the right people at the right time. Seamlessly integrate SMS into simple and advanced Marketo workflows with webhooks and Email to SMS.
Email automation is a way to create emails that reach the right people with the right message at the right moment—without doing the work every time, sending automated messages leveraging a marketing automation tool.
How do you send automated messages to customers? ›- Sign Up for an Automated Text Message Service.
- Upload Your Opted-in Contacts.
- Build Your Text Marketing List with Keywords and Sign Up Forms.
- Create Your Automated Text Message.
- Schedule and Send Automated Text Messages.
Examples of email automation: Seasonal offers promoted
Seasonal occasions such as Christmas, Thanksgiving, and Halloween are great times to send automated emails. Setting these up prior to the day or period allows you to target customers when they're most in the mood to spend their cash.
Dynamic content in email marketing describes any email content that changes based on the subscribers' data, preferences, and behaviors. So, you'd send out a marketing email to your entire database, but certain content modules within that email would be dynamic, changing based on a characteristic you determine.
How to insert dynamic values from custom entities in an email template? ›Insert dynamic text
On the template editor, place your cursor where you want the personalized content to appear. Select Insert dynamic text. Select the Record type and Field name. The category that you specified when you created the email template determines the record types you can choose.