Journey Builder for Apps



Similar documents
How to select the right Marketing Cloud Edition

MENDIX FOR MOBILE APP DEVELOPMENT WHITE PAPER

SendGrid. Delivery. Simplified.

Veeam MarketReach User Guide. Automate Your Marketing. Grow Your Business.

Zendesk + Salesforce. Step-by-Step Guide to Integrating Zendesk and Salesforce.

Appscend Mobile Platform Whitepaper

Platform Overview

THE MOBlLE APP. REVOLUTlON. 8 STEPS TO BUlLDING MOBlLE APPS FAST ln THE CLOUD

ISVforce Guide. Version 35.0, Winter

Gathering customer information from a mobile application James Adams, SAS Institute Inc.

KICK-START CLOUD VENTURES

Leaving Money On The Table

Using WhatCounts Publicaster Edition To Send Transactional s

CAMPAIGNS...5 LIST BUILDER FORMS...

What the Financial & Insurance Industries Can Learn from Retailers

IBM Campaign Version-independent Integration with IBM Engage Version 1 Release 3 April 8, Integration Guide IBM

Managing Existing Mobile Apps

7 Ways Predictive Intelligence Can Elevate Your Marketing

Multi-Channel Benchmarking Guide H2, March 2013 Version 1.1

Power your customer journeys with the leading 1:1 digital marketing platform. 5 Things You Should Know about the ExactTarget Marketing Cloud

Campaign Manager 2.0 for Sitecore CMS 6.6

MARKETING MODULE OVERVIEW ENGINEERED FOR ENGAGEMENT

Getting Started Guide

How To Use Salesforce Identity Features

SimplyCast emarketing User Guide

Mailing List Growth Strategies. A guide to increasing the size of your mailing list. November 2012 Version 0.2

Protect, License and Sell Xojo Apps

Power your customer journeys with the leading 1:1 digital marketing platform. 5 Things You Should Know About Salesforce Marketing Cloud

Mass customization: The next step in the evolution of marketing.

The Beginner s Guide to G-Lock WPNewsman Plugin for WordPress: Installation and Configuration

Choosing the Best Mobile Backend

Journeys CONSUMER-CENTRIC MARKETING PROGRAMS THAT MATTER. The Lifecycle Marketing Agency. Marketing Cloud Gold Partner Partner Advisory Council

Salesforce Customer Portal Implementation Guide

Marketing. Send beautiful campaigns, track the results and manage your subscribers. For further information, call or

Sitecore Experience PlatformTM. Know every customer. Shape every experience.

Adobe Marketing Cloud Adobe Mobile Services

Feature Guide. Want to talk it through? pure360.com call: Work With Data. Work With Messages

IBM Campaign and IBM Silverpop Engage Version 1 Release 2 August 31, Integration Guide IBM

My Stuff Everywhere Your Content On Any Screen

Kore Bots Platform Competitive Comparison Overview Kore Bots Platform Competitive Comparison Overview

Wave 4.5. Wave ViewPoint Mobile 2.0. User Guide

Basic Guide to SMS Marketing 1 2 way SMS is only available in some countries. Contact us to see if your country is supported.

Pinpointe User s Guide

Lead Management CRM Marketing Automation Powerful. Affordable. Intuitive. gold-vision

Here s your full marketing OS. Reimagined.

Installation & Configuration Guide Professional Edition

Your donors and supporters are increasingly multi-channel and they expect to get information that is relevant to their lives and interests

AgilOne + Responsys. Personalizing and measuring your Responsys campaigns just got a whole lot easier.

G-Lock WPNewsman WordPress Plugin Reviewer s Guide

Intelligent Business Solutions MALLSFORCE. Mall Management System

Middleware- Driven Mobile Applications

Transforming Customer Engagement with Mobile

IMAGINE... Everything You Expect From CRM Integrated Marketing. And More! marketing campaigns that...

Advanced Training Reliance Communications, Inc.

Using icontact The Preiss Company

5.2.3 Thank you message Bounce settings Step 6: Subscribers 6.1. Creating subscriber lists 6.2. Add subscribers Manual add 6.2.

LICENTIA. Nuntius. Magento Marketing Extension REVISION: SEPTEMBER 21, 2015 (V1.8.1)

TOP TIPS TO A TIP TOP

The VerticalResponse API Guide

31 Examples of how Microsoft Dynamics CRM Integrates with Marketing Automation

Mobile Marketing Best Practices

10 Steps To Getting Started With. Marketing Automation

MODERN MARKETING ESSENTIALS GUIDE. MOBILE MARKETING A Prescriptive Guide Fortified to Build Stronger Marketing

Experience Business Success Invest in Microsoft CRM Today

Vodafone Plus. User Guide for Windows Mobile

See What's Coming in Oracle Service Cloud

Strategy Guide: Using Mobile Marketing Automation to Optimize the Customer Lifecycle

Setting Up Person Accounts

Chatter Answers Implementation Guide

6 A/B Tests You Should Be Running In Your App

Comprehensive Guide to Marketing Like Starbucks

Build Your Mobile Strategy Not Just Your Mobile Apps

Digital Marketing Center

User s Guide Microsoft Social Engagement 2015 Update 1

Software Solutions Digital Marketing Business Services. SugarCRM Community Edition for Small & Medium Enterprises

SAP Digital CRM. Getting Started Guide. All-in-one customer engagement built for teams. Run Simple

Marketo s, Automation, and Drip Campaigns User Guide

KEY PHASES. In Creating a Successful Mobile App

Grow. How to Authentically Grow Your List

Cisco Enterprise Mobility Services Platform

ActivityView Meeting room information and dynamic directions made easy.

tibbr Now, the Information Finds You.

Why Traditional ESPs Aren t Cutting It for Marketers Results of an Adobe Study Conducted Across DMA Members

SWISSVBS LEARNING CLOUD (SLC)

Nonprofit Technology Collaboration. Marketing

Messagepoint Business user content and rule management

Aspire Systems - Experience in Digital Marketing and Social Media

INTRODUCTION TO THE LEADING EVENT MOBILE APP PLATFORM A PRODUCT OF

Create, attract, retain and delight customers, profitably. HubSpot Connector

end to end marketing automation

How To Convert A Lead In Sugarcrm

Opt It Get Started Guide

The Digital Marketing Heavyweight

MARKETING BEST PRACTICES.

OMNI-CHANNEL MARKETING. Top 9 Questions

Transcription:

Essentials for Service Excellence Journey Builder for Apps A Step-by-Step Guide on Using Journey Builder to Create 1:1 Customer Journeys With Mobile Apps Version 1.0.1 Written by Ian Murdock Quinton Wall With contributions from Kelly Andrews Benjamin Dean Dave Helms Dale McCrory Dan Sheehan Ryan Williams Doug Wilson Last updated 10/2/2014

CONTENTS Chapter 1: The App Revolution...1 The Eight Stages of Successful App Journeys... 2 Discovery... 2 Start... 3 Context... 3 First Interaction... 3 Fulfillment... 4 Abandonment... 4 Nurture... 5 Share... 5 A For App Strategy... 5 Chapter 2: How Is This Book Structured?... 7 Salesforce1 Platform... 7 ExactTarget Marketing Cloud... 8 Journey Builder... 9 ExactTarget Fuel... 9 Chapter 3: An Introduction to Customer Touchpoints... 11 Relevancy Drives Engagement... 11 Data Drives Relevancy... 12 Every Event Improves Relevancy... 12 The Importance of Permission... 13 Apps as New Customer Touchpoint... 14 Chapter 4: Sending Your First Email... 17 Logging in to the ExactTarget Marketing Cloud... 17 Defining the Subscriber Data Model... 18 Creating a List... 19 Adding a Subscriber to the List... 20 Creating an Email... 21 Sending the Email to the List... 23

Contents Viewing Tracking Event Data... 25 Going Further with Data Extensions... 26 Chapter 5: Setting Up Your Development Environment... 29 Code@ExactTarget... 29 Fuel Client Libraries... 29 App Center... 30 Connect your App to an Account... 32 Give your App Access to Account Features... 32 Get your App s OAuth Credentials... 33 Chapter 6: Using the API to Populate the Data Extension... 35 Using a Client Library... 35 Using the API Directly... 39 Getting an Access Token... 39 Refreshing the Access Token... 40 Important considerations when using the API directly... 40 Chapter 7: Creating Your First Interaction... 41 Journey Builder Basic Concepts... 42 Creating Your Content in the Email App... 42 Setting Up the Contact Model Using Contact Builder... 44 Creating your First Interaction in Journey Builder... 47 Defining the trigger... 48 Adding activities to the canvas... 49 Activating the overall interaction... 51 Testing the Interaction... 51

ABOUT THE GETTING STARTED WITH FUEL WORKBOOK Contents Chapter 8: Engaging with the Customer in the Mobile App... 53 Sending Push Messages... 53 Using Location within Push Messages... 54 Sample Journey Builder for Apps Workflow... 54 Journey Builder for Apps SDK Configuration... 55 Create production and development versions of your app in App Center:... 55 Review and download the Journey Builder for Apps SDK:... 59 Journey Builder for Apps SDK Versions... 59 SDKs... 59 Provision the app to use Apple or Google push messaging services:... 60 ios:... 60 How to Bootstrap the Journey Builder for Apps SDK in your ios Mobile App... 68 How to Implement Analytics in your ios Mobile App... 70 How to Implement Tags in your ios Mobile App... 71 How to Implement Attributes in your ios Mobile App... 71 How to Implement Message Notifications in your ios Mobile App... 71 How to Add Audio to your ios Mobile App... 72 How to Manage Badge Count in your ios Mobile App... 72 How to Implement OpenDirect functionality in your ios Mobile App... 73 How to Process Custom Keys in your ios Mobile App... 73 How to Implement Location Capabilities in your ios Mobile App... 74 How to Add ios 8 Support for Push in your ios Mobile App... 74 Android:... 76 How to Provision your Android Mobile App... 77 How to Provision Your Amazon Android Mobile App... 82 How to Bootstrap the Journey Builder for Apps SDK in your Android Mobile App... 87 How to Implement Analytics in your Mobile App... 90 How to Implement Tags in your Mobile App... 92 How to Implement Attributes in your Mobile App... 93 How to Implement Message Notifications in your Mobile App... 93

Contents Launch an Activity to Handle the Notifcation Tap... 93 Specify an Action and URI for the Launch Intent When Notification Receives a Tap... 94 Implement Full Customization of Intent and PendingIntent... 94 How to Add Audio to your Mobile App... 95 How to Implement OpenDirect functionality in your Mobile App... 97 How to Process Custom Keys in your Mobile App... 98 How to Implement Location Capabilities in your Mobile App... 98 How to Implement the EventBus in your Mobile App... 100 Integrate the Journey Builder for Apps SDK and any additional functionality into your mobile app:... 102 Background Push (push content to your mobile app without notifications, such as a subscription to a newsletter)... 102 How to Send Background Push Messages... 102 Why Use the Cordova Plug-In?... 102 How to Use the Cordova Plug-In... 103 How to Bootstrap for ios... 104 How to Bootstrap for Android... 106 Creating a MobilePush Message in the ExactTarget Marketing Cloud... 107 Welcome Message... 108 Location-Based Message... 109 Integrate your MobilePush messages with Journey Builder...110 API Calls... 111 Epilogue: The Future Of Marketing Is Now...113 Additional Resources...115

Chapter 1: The App Revolution In this chapter The Eight Stages of Successful App Journeys A For App Strategy We live in the midst of an app revolution. Every industry, from healthcare to manufacturing to retail and more, has been disrupted. The explosion of smartphones and tablets over the past several years may have been the catalyst of this revolution, but it is not the technology that is the disruptor it is you, the customer behind every app. The world s leading brands are increasingly using technology to build stronger, more personal relationships with their customers. And they are doing so by understanding that each of those customers is in a unique journey with their brand. Their goal is to take what they know about each customer and guide the customer through that journey step by step, from discovery to initial engagement, to repeat business, and beyond. Apps play an increasingly critical role in nurturing the relationship between brand and customer. Yet customer journeys rarely start with the app they start with initial discovery. For years, marketers have known the importance of discovery on a mass media level, blasting out one-size-fits-all messages via billboards, radio, and television. It is through the app revolution, however, that marketing can truly become personal. The smart marketer knows this and thinks in terms of customer journeys, not batch and blast. Until now, there has been no easy way for marketers to plan this journey and incorporate it in an app. Journey Builder changes everything. Journey Builder solves the problem of disconnected customer journeys and engaging apps. Journey Builder gives you a revolutionary tool to define a series of paths to interact with a customer directly through the app. We call these paths journeys. Marketers can define journeys that consist of activities such as emails or mobile push events to reach out to the customer without a single line of code, and they can define interactions that require more complex solutions that developers must implement. Journey Builder is not a solution disconnected from the rest of your business. It sits atop the ExactTarget Marketing Cloud, and integrates seamlessly with the Salesforce1 Platform for developers to create custom interactions in any language they like. By building atop the world s leading platform, marketers and developers can deliver highly personal and engaging apps faster than ever before. 1

Chapter 1: The App Revolution The Eight Stages of Successful App Journeys So why do we need a book about building journeys for apps? Because you need to make your journeys move beyond discovery and build apps that create sustainable relationships between your customer and your brand. Journeys make your customer feel important. To create this relationship, marketers and developers must understand the stages of highly successful app journeys. Figure 1: The Eight Stages of Successful App Journeys Discovery Most app journeys start with discovery in some form, such as a friend s recommendation or an advertisement. Generally, brand discovery occurs via a mass medium. This process probably includes personal information, and it might include emails and promotions that include generic preferences. For existing customers, journeys should include activities and products based on personal preferences (such as size and any previous order history) to make new products more easily discoverable. Journey Builder, and the ability to leverage the Salesforce1 platform, makes it possible for you to define a interaction that retrieves customer information from Force.com (such as past order history and integration with backend ERP systems). Journey Builder can also integrate easily with user preferences (using many leading customer-facing apps developed on Heroku) to create highly personalized interactions automatically triggered when new products are received in the warehouse. 2

Chapter 1: The App Revolution Start As soon as a customer chooses to participate in your Journey (via the installation of the app, or logging into a website), marketers should begin a getting started journey to help nurture the customer through the various steps of engagement. Personal driver apps like Lyft or Uber do a great job implementing this getting started journey. A start journey would walk you through the one-time process of adding your credit card details to get you ready for the next step, for example. Other apps provide a quick tutorial where the customer swipes through a few introductory steps to orient themselves with the features of the app. Journey Builder can help your getting started experience become much more personal by establishing an interaction based on how the customer uses the app. For example, a customer uses an app like Trunk Club where personal stylists select clothes. The customer signs up, fills out the basic profile information, and starts using the app. Marketers can use a customized communication to follow up with the customer with personalized messages about the benefits of completing additional profile information, such as favorite color. As the app collects more personal preference information, marketers can provide a more personalized journey. In our Trunk Club example, you now know the customer s favorite color and can help the stylist select clothes the customer would more likely select. Marketers can subtly change the communications to include these personal color preferences. Context The rise of geo-location and mobile apps provides incredible opportunities to interact more frequently and proactively with your customers, moving them further along the journey the marketing team has established. FourSquare, for example, uses contextual stages very effectively to promote products based on both geo-location and past purchase history. Once a journey has been created within Journey Builder triggers are established (based on location, for example), developers can quickly create an implementation on Heroku using any language to integrate events raised from the app (customer location changed), and third-party services (FourSquare APIs indicate the customer is within 200 feet of a coffee shop) and send this information back to Journey Builder. Once the app fires an event to Journey Builder, associated interactions can begin to engage with customers via push notification activities with a few clicks of the interface. First Interaction The customer s first engagement with your app represents an important milestone, one worthy of a highly personal interaction in the customer journey. This first interaction may involve placing an order, taking the first ride, downloading a song, or any other initial action. A customer has indicated that they trust your business and your brand. First interactions present an excellent example of the importance of marketers and app developers working closely together. Journey Builder allows marketers to define the journey and app interaction points. It is these app interaction points that developers must implement as part of their app. 3

Chapter 1: The App Revolution The app revolution resulted in an incredible growth of modern languages, frameworks, and platforms. The Salesforce1 platform, and especially the Journey Builder for Apps SDK, make it possible for developers to build engagement directly into their app with a few lines of code. These apps previously disconnected with marketing - can now play pivotal roles in the overall customer journey. Fulfillment Fulfillment refers to the step in a customer s app journey when their interaction completes. This step may include when a package is delivered, a ride is completed, a course is finished, or a service case is created. However, fulfillment does not always represent a specific point of time. Fulfillment often covers an extended period of time during which existing business processes complete. Journeys must consider the interactions with the customer during this period. The majority of customer complaints with companies occur due to poor communication during the fulfillment cycle. From a developer perspective, fulfillment often represents the most complicated phase of app development. This phase typically requires integration with third-party systems, partners, and suppliers. These integrations are made more complex by the fact that a company may not maintain direct control of these systems. Marketers should expose Journey Builder actions to take into account the multiple steps required to co-ordinate fulfillment logistics and establish actions for developers to implement as events occur. This process will result is a higher level of customer communication and visibility throughout the fulfillment phase. Abandonment A perfect journey where customers are highly engaged and feel personally connected to a brand via apps would translate to little or no abandonment of interactions, such as adding items to shopping carts. Unfortunately, this concept is not entirely realistic. Highly successful brands plan for abandonment and establish a journey to nurture the customer through to fulfillment. The best customer experience goes even further by offering additional features within the app to support the way customers want to work. For example, Amazon provides a wish list feature where customers can add items they are not ready to buy just yet. Pinterest s model of pinning items to a virtual scrapbook allows customers to organize and share their inspirations, and then allows marketers to sell to customers. Effective marketers can utilize Journey Builder to create multiple journeys for their customers. These journeys may span multiple apps to support the growing trend of smaller, more focused apps, as demonstrated with Facebook Messages, FourSquare Swarm, and SalesforceA. A Journey Builder for Apps strategy, discussed in more detail throughout this book, enables marketers to create a vision for the entire customer engagement lifecycle, and enable the developer to create the killer app for the optimal experience. 4

Chapter 1: The App Revolution Nurture Highly engaging apps keep customers coming back with a combination of app stickiness and intelligent nurturing. Depending on the type of app, this line between app and nurture blurs. Consider apps like Farmville or Candy Crush. These highly addictive consumer games nurture activities focused on competing with friends. We see a similar stickiness in the enterprise with Salesforce1 and Chatter that offer nurture activities by following records and supporting approvals and actions directly within the social feed. Marketers can utilize Journey Builder to create independent nurture journeys based on how the customer interacts with the brand. Sticky apps where users regularly log in can nurture users via in-app push notifications. Apps users utilize as required may require email promotions or contextual app notification, such as geo-location triggers. Share Just as a customer journey begins prior to ever using an app, customer perception of an organization s brand continues long after that customer close down the app. Make it easy for customers to share their experiences across social networks. Smart marketers even incent customers to do so by using reward points, leaderboards, badges, and other gamification strategies. When creating journeys with Journey Builder, marketers can create actions for developers to implement the ability to share experiences to Twitter, Facebook, Pinterest, and other social networks. In addition, marketers can create employee-facing apps that track this influence to ensure that marketers reward highly supportive customers. A For App Strategy Journey Builder for Apps helps marketers and developers get started creating highly personal and engaging apps. Journey Builder provides an incredibly powerful tool for building customer journeys, and the for Apps part represents an even more fundamental concept to the success of every organization of the future. Tomorrow s marketing plans must recognize the important role apps play in customer engagement and provide marketing-orientated services and hooks for developers to extend their apps for seamless interactions. As the app revolution continues, we will continue to see the level of abstraction of services for apps rise to a point where marketers can define entire activities within a customer journey and consume business activities (including joining a customer community or requesting real-time support) provided by multiple apps and cloud app platforms. We have already seen the incredible productivity improvement higher levels of abstract offer in PaaS versus IaaS. Journey Builder, and a solid app strategy, signals the next wave of abstraction for business services and app composition. Every journey starts at the beginning. Your journey to building amazing customer apps starts right now. We hope you enjoy reading this book as much as we enjoyed writing it. 5

Chapter 2: How Is This Book Structured? In this chapter Salesforce1 Platform ExactTarget Marketing Cloud Journey Builder ExactTarget Fuel This book introduces you to the ExactTarget Marketing Cloud and Journey Builder and helps you more deeply engage with your customers through mobile apps. We assume no previous knowledge of the ExactTarget Marketing Cloud, Journey Builder, and a typical developer s level of marketing knowledge. If you are already familiar with the basic operation of the ExactTarget Marketing Cloud, you can skip ahead to Setting Up Your Development Environment. Salesforce1 Platform The Salesforce1 Platform provides a comprehensive suite of services and APIs for customers, partners, admins, developers, and business users to create employee-facing and customer facing-apps. Figure 2: The Salesforce1 Platform The Salesforce1 Platform consists of the following core services: Force.com: Force.com provides highly productive visual builders, powerful programatic tools and runtimes, and standards-based identity services for creating employee apps fast. Apps developed on force.com become instantly mobile via the Salesforce1 enterprise mobile app and allow organizations to run their business on their phone. Force.com includes a massively scalably multi-tenant database service that many of the world s largest brands rely on to create a single view of their customers. 7

Chapter 2: How Is This Book Structured? Heroku: Heroku provides the leading cloud app platform for developers to build customer-facing apps in any language using integrated git-based workflow, and automated scaling. It also includes a rich ecosystem for third-party add-ons, such as caching, databases, and more. Using HerokuConnect (an additional service available on Heroku) developers can now synchronize customer data from force.com in near real-time effectively, eliminating data silos between customer and employee apps. ExactTarget Fuel: ExactTarget Fuel, described in further detail below, provides the ability for developers to embed customer touchpoints directly into the apps and use this information to drive deeper, more personal engagement with the app user. Platform API & UI Services: Sitting atop the three core services of Force.com, Heroku, and ExactTarget Fuel, the Salesforce1 Platform provides powerful APIs for connecting to anything using standards-based RESTful interfaces. The Salesforce1 platform also offers revolutionary UI services for composing mobile and desktop apps. Marketers and developers receive a unique and comprehensive view of customer data and engagement activities when you create apps on the Salesforce1 Platform and compose them using the core services, platform APIs, and UI services. Salesforce1 platform apps remain highly targeted and relevant to the user without complicated integration processes, which often result from disconnect services and technologies. ExactTarget Marketing Cloud The ExactTarget Marketing Cloud is a platform for marketers to create, manage, and automate customer journeys. The ExactTarget Marketing Cloud includes a digital marketing platform designed to empower the businesses to listen and engage with customers across every channel, including email, mobile, social media, and the web. You can automate and manage every campaign, publish content, analyze results, and optimize as you go to deliver just the right message at just the right moment. The ExactTarget Marketing Cloud delivers marketing services for apps allowing you to embed and integrate customer interactions wherever they occur. Throughout this book, we will refer to the ExactTarget Marketing Cloud (and a primary product set of Journey Builder and ExactTarget Fuel) as the tool for creating comprehensive and highly personalized customer journeys. Figure 3: The ExactTarget Marketing Cloud 8

Chapter 2: How Is This Book Structured? Journey Builder Journey Builder provides a revolutionary tool for engaging customers throughout the marketing, sales, and services life-cycle. Think of Journey Builder as your control panel for creating a roadmap for customer success. We designed Journey Builder with apps in mind. Marketers can create interaction points (often referred to as customer touchpoints) for developers to implement in their custom apps via the the ExactTarget Fuel APIs. Figure 4: Implementing a Journey Builder For Apps Strategy ExactTarget Fuel The foundation of the ExactTarget Marketing Cloud, ExactTarget Fuel opens the Marketing Cloud to third-party development, enabling our customers and partners to customize, extend, and integrate with the industry s leading 1:1 digital marketing platform. Key components of ExactTarget Fuel include: APIs: Fuel provides both SOAP and REST APIs to support both cloud and enterprise development scenarios. Client Libraries: Fuel includes client libraries for Java,.NET, Node.js, and PHP that enable developers to integrate with Fuel s APIs using native language constructs. Fuel UX: Fuel UX is the user interface toolkit used by the Marketing Cloud and ExactTarget s Marketing Cloud apps. Based on leading open-source JavaScript technologies including Bootstrap, jquery, and RequireJS, Fuel UX makes it easy to build apps that deeply integrate with the look and feel of the Marketing Cloud. Data extensions: Data extensions are flexible tables of almost any type of data and can be used for personalization, segmentation, or as a sending data source. Data extensions can be thought of as cloud-based, relational marketing databases. 9

Chapter 2: How Is This Book Structured? Contacts: Contacts represent a single view of your customers, consolidating information gathered from multiple sources into a single place and making that information actionable in your customer journeys. You can associate any type of data with a contact, including contact information that spans multiple channels, interests and preferences, engagement history, and data from third-party sources. AMPscript: AMPscript is the Marketing Cloud s content scripting language and can be used to programmatically personalize the content of an email, SMS message, or landing page. AMPscript can interact with data extensions, so you can read data from data extensions in your messages and write data to data extensions in your landing pages. Single sign-on: Fuel provides a single sign-on environment for the Marketing Cloud and its applications secured by multiple technologies including two-factor authentication, IP whitelisting, IP blocking, and real-time alerting and monitoring. What can you do with ExactTarget Fuel? As a customer, you can use Fuel to automate entire marketing campaigns, customize the Marketing Cloud to your exact needs, or integrate the Marketing Cloud with a variety of CRM, analytics, and other business software. As a partner, you can use Fuel to build or extend marketing applications and take those applications to market via one of our platform-related partner programs. In this book, we re going to focus on how to use Journey Builder for Apps to more deeply engage with your customers through mobile apps. We ll be playing the role of a fictional wearable device company wanting to drive post-purchase customer engagement by encouraging new customers to download our mobile app and, once installed, encourage consistent usage of it. We ll show how to use both push notifications and in-app features like geolocation and geofencing to drive engagement. In the process, we ll highlight key ExactTarget Marketing Cloud and Journey Builder concepts, as well as ExactTarget Fuel tools and techniques, that you can apply to this use case and beyond. Before we begin, though, you need to understand a few basic concepts, starting with the concept of a customer touchpoint. 10

Chapter 3: An Introduction to Customer Touchpoints In this chapter Relevancy Drives Engagement Data Drives Relevancy Every Event Improves Relevancy The Importance of Permission Apps as New Customer Touchpoint Every email sent, every SMS delivered, and every notification is different the message could be a simple receipt or shipping notification, or it could be just a single component of a sophisticated multi-channel marketing campaign designed to sell an automobile. Yet as different as they are, all messages have something in common: they all touch customers, either existing or prospective. As such, you should think of every message as a customer touchpoint an opportunity to influence your customers and prospects. Unfortunately, these opportunities are often lost managing customer touchpoints at scale is, after all, a very complex business. Even worse, if you re not careful, you can manage to negatively influence your customers and prospects. The ExactTarget Marketing Cloud helps marketers take maximum advantage of customer touchpoints. This section discusses the keys to maximizing the impact of each customer touchpoint from a developer s perspective. Those keys revolve around permission, personalization, and maximizing the value of each interaction. Relevancy Drives Engagement Your customers are inundated with messages of all types email in the inbox, printed material in the mailbox, billboards on highways, SMS and push messages on mobile devices. To be effective, your marketing campaigns have to stand out, and to stand out, they have to be highlytargeted and relevant. Highly-targeted, relevant communication is as much a technology problem as it is a marketer s dilemma the most successful marketing campaigns involve highly sophisticated interactions across multiple channels driven by data from multiple sources tied to precise audience segments, all designed to deliver just the right message at just the right moment. As such, marketers routinely require technical help to accomplish their goals, giving developers the opportunity to innovate alongside them. 11

Chapter 3: An Introduction to Customer Touchpoints Data Drives Relevancy To help marketers build more relevant communications, the ExactTarget Marketing Cloud enables large amounts of data to be synchronized across multiple systems through a flexible data model called data extensions and multiple integration methods. This data from multiple sources can be used at the point of customer interaction using AMPscript the Marketing Cloud s scripting language for messaging to create unique messages for each customer. For example, you might create a data extension that maps zip codes to city names and use that mapping dynamically in your communications via the following AMPscript: %%=Lookup( PostalCode, City, PostalCode,postalcode)=%% We ll say much more about data extensions in the section Going Further with Data Extensions. Every Event Improves Relevancy Event-driven architectures are critical for scaling real-time systems and applications, especially as we enter the era of the Internet of Things. Each event, whether generated by a server, a web browser or a mobile application, represents an opportunity to interact with a customer and provides insight into that customer through his or her response to the event insight that can be used to make later interactions more relevant and timely. Figure 5: The more targeted the email, the more effective the campaign 12

Chapter 2: An Introduction to Customer Touchpoints What could a marketer do with additional insight on customer interactions? A customer event like Requested More Information might lead directly to a specific message being sent to the customer. Or a customer event like Purchased a Product might represent an opportunity to move the customer to the next ideal step in his or her journey with the company based on what the company knows about the customer and all customers collectively (e.g., when product A is purchased, customers often purchase product B shortly thereafter). Figure 6: An interaction in a customer journey For example, a movie rental service might send receipts to customers that also asks them to rate the movie they just returned or provides incentives to rent another movie. Using ExactTarget Fuel, this action might trigger a Returned Movie event in Journey Builder with an associated activity to send an email receipt to the customer. The customer s interaction with that email receipt (opened it, clicked on a link in it, rated the movie, rented another movie) might trigger a number of other events, all designed to take that customer along the next ideal step of that customer s journey. The Importance of Permission If you re not careful about how you manage your customer touchpoints, your email could be considered unsolicited commercial email a.k.a. spam. In the United States, CAN-SPAM is a law passed in 2003 that mandates the addition of an unsubscribe mechanism to all emails and requires the sender to comply with customer opt-out requests within ten days. Many other countries have similar laws in place to protect consumers. CAN-SPAM draws a distinction between commercial email (email designed to advertise or promote a commercial product or service) and transactional email (email triggered as the result of an event or that contains information about a specific transaction, such as password reset emails and purchase confirmation emails). 13

Chapter 3: An Introduction to Customer Touchpoints A common mistake companies make is sending commercial email to a list of email addresses they have either accumulated over time or been purchased. If that list is old or includes a large number of subscribers who flag your message as spam because it is not relevant to them, your ability to send email successfully in the future will be impeded by a negative reputation applied to your sending IP address. The key to successfully managing your customer touchpoints is permission. The ExactTarget Marketing Cloud helps you manage the complexity of permission by persisting communication preferences associated with customers (e.g., whether they have opted in or opted out to a particular communication) and allowing message sends to be specified as commercial or transactional. If the type of send is commercial, the Marketing Cloud will validate your email content for opt-out links to ensure that subscribers have a way to express their desire to opt-in or opt-out of future communications as required by CAN-SPAM. For all the possibilities for technology and marketing to intersect using the ExactTarget Marketing Cloud, you should always focus on the customer and how to successfully manage customer touchpoints within the constraints of permission. The Marketing Cloud allows you to innovate in critical ways to build and retain customers or create systems that help others do the same thing. The technologies exposed through ExactTarget Fuel, in conjunction with the ExactTarget Marketing Cloud and its applications, enable developers to innovate and add value to their organization at the individual customer level. The technologies exposed reach out to customers and are accessible by marketers allowing the Marketing Cloud to be a conduit for business growth and innovation. Apps as New Customer Touchpoint All of the above could have been written five or ten years ago indeed, all of the above has been core to ExactTarget s approach to digital marketing since the company was founded in 2001. What s different today? The app revolution. The explosion of smartphones in recent years has resulted in customers being more connected than ever before. Now, along with email and other traditional customer touchpoints, marketers must recognize the importance of apps as a new customer touchpoint. Arguably, apps are now the primary customer touchpoint. Think about it. Uber and Lyft are apps that happen to have highly coordinated networks of drivers behind it ready to respond to your in-app request for a ride at a moment s notice. Delta (or your favorite airline) is an app that happens to have a fleet of aircraft behind it where you book tickets, check in, get notifications about flight delays, scan your boarding pass, and otherwise interact with the Delta brand. Your bank is an app where you check your balance and pay your bills without ever having to write a check. And on and on. With the ExactTarget Marketing Cloud, marketers and developers can participate in the app revolution by ensuring their marketing campaigns include for app touchpoints. A typical for app strategy might include the following touchpoints: 14

Chapter 2: An Introduction to Customer Touchpoints For App Touchpoint Marketing Strategy For App Opportunity First sign-in Send welcome note Use in-app message to display Credit card stored Order placed Incentivize customer to make their first purchase Begin personalized fulfillment communications Connect app with payment system like square or Visa and offer $5 credit Add track my order feature in app with push notifications on updates Customer needs support Provide real-time support Implement SOS-type functionality within app to reach a representative in realtime Reschedule delivery Arriving at a venue Put the customer first on delivery preferences Exceptionally personalized customer service Allow customer to change delivery address by dropping a pin on map and integrating directly with FedEx/UPS APIs Geo-location allows highly personalized and contextual message such as alerting venue staff of a VIP arrival This book is all about how to use the ExactTarget Marketing Cloud and Journey Builder to implement your own for apps strategy. Before we begin, though, let s start with the basics: How to create your first customer touchpoint using ExactTarget Email. 15

Chapter 4: Sending Your First Email In this chapter Logging in to the ExactTarget Marketing Cloud Defining the Subscriber Data Model Creating a List Adding a Subscriber to the List Creating an Email Sending the Email to the List Viewing Tracking Event Data Going Further with Data Extensions Email is still one of the most common ways customers interact with brands, especially in the early stages of the customer journey. Indeed, one of the most common uses of the ExactTarget Marketing Cloud is to send emails that initiate customer journeys. This section walks you through the process of using the ExactTarget Marketing Cloud to send an email to a list of subscribers (Figure 7). This example illustrates many of the basic concepts and techniques involved in using the ExactTarget Marketing Cloud for 1:1 digital marketing. Later in the book, we will expand on this example to show how email can be used to drive installation of an app that offers additional engagement opportunities. Figure 7: A summary of the objects used to send email in the ExactTarget Marketing Cloud Logging in to the ExactTarget Marketing Cloud To get started, log in to the ExactTarget Marketing Cloud via https://mc.exacttarget.com by entering your username and password. If you do not have a username and password, you can create a free Developer Edition account at http://code.exacttarget.com/ developer-edition. 17

Chapter 4: Sending Your First Email Once you are logged in, you should see a screen similar to that shown in Figure 8. Figure 8: The ExactTarget Marketing Cloud The ExactTarget Marketing Cloud is an application container for all Marketing Cloud apps that provides a set of services to those apps, including common calendaring, campaign management, and analytics (Pulse). Take a minute to look around, then launch the ExactTarget Email app. You can get back to the app menu at any time by hovering your mouse over the ExactTarget Marketing Cloud logo. Defining the Subscriber Data Model In ExactTarget Email, customers are represented by subscribers. Subscribers have an email address and status (active, held, or unsubscribed). If a subscriber is active, the Marketing Cloud will allow email to be sent to that email address. If a subscriber is unsubscribed, the Marketing Cloud will prevent email from being sent to that email address. A held subscriber indicates that previous attempts to send email to that email address bounced. In addition to email address and status, ExactTarget Email allows marketers to extend the subscriber data model through profile attributes. Profile attributes are arbitrary key/value pairs associated with each subscriber. For example, you might use a profile attribute to store the subscriber s first name so you can personalize email to the subscriber in a salutation (e.g., Dear Marc ). Profile attributes apply to all lists. You can create up to 200 profile attributes in an account. 18

Chapter 4: Sending Your First Email Figure 9: Creating a profile attribute to hold the subscriber s first name Our first task is to define the subscriber data model. To do that, navigate to Profile Management under Subscribers. As you can see, ExactTarget Email includes several system-defined profile attributes, including the email address and full name. To extend the subscriber data model, add a profile attribute for the subscriber s first name so you can personalize email to the subscriber. To do that, click Create and name your new profile attribute FirstName (Figure 9). Creating a List Our next task is to create a list. Lists contain subscribers and are the simplest way to send email to multiple subscribers. To create a list, navigate to Lists under Subscribers; then, click Create, name the list, and specify an external key. The ExactTarget Marketing Cloud includes this property on every object, and you can use it to attach your own identifier to the object. This identifier makes it easier to integrate the Marketing Cloud with your existing infrastructure. You will use external key in later chapters to reference the list when you use the API (Figure 10). 19

Chapter 4: Sending Your First Email Figure 10: Creating a list Note the area labeled Campaign Association. Campaigns allow you to group items from across the ExactTarget Marketing Cloud together for tracking and analytics purposes. Campaign management is beyond the scope of this book, so campaign associations can be ignored for now. Adding a Subscriber to the List Our next task is to add a subscriber to the list we just created. To do that, click on the list name, then click Create and add yourself to the list using the wizard (Figure 11). 20

Chapter 4: Sending Your First Email Figure 11: Adding a subscriber to the list Creating an Email Now that we ve set up our subscriber data model, created a list, and added ourselves to the list, we are ready to create the email to send to the list. To do that, navigate to Emails under Content, then click Create and select HTML Paste from the dropdown menu. Then, specify an email name and subject and click Save (Figure 12). Note that the email subject in our example contains the text %%FirstName%%. ExactTarget Email replaces this substitution string with the value of the profile attribute specified between the percent symbols. Substitution strings represent just one of the ways you can personalize email subject lines using ExactTarget Email and can help drive engagement. 21

Chapter 4: Sending Your First Email Figure 12: Creating an email Finally, paste the following in as the email body and click Save: <html> <body> <p> Hello, %%FirstName%%! </p> <small> <p>this email was sent by:</p> <p> %%Member _ Busname%% <br /> %%Member _ Addr%% <br /> %%Member _ City%%, %%Member _ State%% %%Member _ PostalCode%% <br /> %%Member _ Country%% </p> <a href= %%profile _ center _ url%% >Profile Center</a> </small> <custom name= opencounter type= tracking > </body> </html> 22

Chapter 4: Sending Your First Email Note that the email body contains additional substitution strings beyond the %%FirstName%% substitution string we included in our email subject. In addition to user-defined substitution strings like %%FirstName%%, ExactTarget Email automatically resolves system-defined substitution strings to help ensure your email complies with CAN-SPAM laws for commercial sending. To help marketers comply with CAN-SPAM, ExactTarget requires that every email contain the following substitution strings: %%Member _ Busname%% %%Member _ Addr%% %%Member _ City%% %%Member _ State%% %%Member _ PostalCode%% %%Member _ Country%% These substitution strings contain the elements of the sending organization s physical address as required by CAN-SPAM. The ExactTarget Marketing Cloud automatically fills in these strings based on the account information. In addition, ExactTarget requires every email to contain a link to a profile center that manages subscription preferences, including whether the recipient of the email would like to opt out of future communications. The ExactTarget Marketing Cloud builds and hosts these profile centers. To comply with CAN-SPAM, just include the following substitution string: %%profile _ center _ url%% Finally, a customer opening an email represents an important touchpoint. To allow ExactTarget Email to track when customers open HTML email, we ve added the following tag to the email body: <custom name= opencounter type= tracking > Once the subscriber opens your email, the content of the email will determine whether or not the recipient will engage (e.g. buy a product) or disengage (e.g. unsubscribe). In addition to substitution strings, ExactTarget provides many features to help you innovate and make your content more relevant, including the AMPscript content scripting language, HTTPGet content scraping, and sophisticated dynamic content functionality (see Code@ExactTarget for additional details). Also note that ExactTarget Email provides a number of tools for you to preview and validate your content before sending it. These tools include the ability to send a test email, preview the email against a sending data source, and validate the email against a number of criteria including whether or not the email contains the information required by CAN-SPAM. Sending the Email to the List We are now ready to send our first email! From the Emails screen, select Guided Send from the Send dropdown menu (Figure 13). 23

Chapter 4: Sending Your First Email Figure 13: Sending the email to the list Walk through the wizard, selecting the list we just created as the recipient and accepting the defaults for the other steps (exclusion and suppression lists, send options, etc.). On the Send Email step, choose Immediately, verify the information is correct, then click Send. If all goes well, you should receive your email shortly (Figure 14). Figure 14: Your first email! 24

Chapter 4: Sending Your First Email Viewing Tracking Event Data Retrieving tracking event data from the ExactTarget Marketing Cloud allows you to measure the success of each of your customer touchpoints. The ExactTarget Marketing Cloud captures a variety of tracking events for each send. Delivery events related to the send enable you to know if you provided good quality data. These events include the following statistics: SentEvent indicates whether the ExactTarget Marketing Cloud rendered and sent the email BounceEvent indicates that the email bounced (did not send successfully) either synchronously or asynchronously. Engagement events related to the send enable you to know how a customer engaged with your email content. These events include the following statistics: OpenEvent indicates the recipient opened the email. Note that this method only works for HTML emails that include the tracking pixel mentioned previously and after the subscriber allows images to be loaded. ClickEvent indicates the recipient clicked on a link in the emai. Note that this only works if ExactTarget wraps the links. UnsubEvent indicates the recipient unsubscribed from the list either by spam complaint, reply mail management (sending a response to an email with an unsubscription request), or the profile center. You can access tracking data by navigate to Emails under Content, then selecting the send from the list (Figure 15). Figure 15: Viewing tracking event data 25

Chapter 4: Sending Your First Email In this case, you can see that I have opened the email twice, that only one of those is unique (because I opened it twice), and that there have been no link clicks. Going Further with Data Extensions Congratulations! You just sent your first email using the ExactTarget Marketing Cloud! While it might not feel like a huge accomplishment, you actually took the first step of your first customer journey, and you did so in a measurable way that tells you something about your customers through how they interacted with your email (opened it, clicked on a link in it, etc.). Now that you started the journey, you can extend that journey by leveraging what you just learned to more deeply engage with those customers. Think of emails as the first sentence in a conversation these messages set the tone and begin a dialogue. As described in Data Drives Relevancy, you can use what you learn about your customers during each step of the journey to tailor that dialogue to their unique interests and preferences. In order to go further, we need to introduce some more advanced ExactTarget Marketing Cloud concepts. You can easily set up and use lists and profile attributes, which is why we used them to send your first email. However, that simplicity makes them inherently limited. For example, lists and profile attributes can only hold subscriber data, and they use a flat structure that cannot express the complex relationships between data sets often found in more involved scenarios. The Marketing Cloud offers a powerful construct called a data extension that can store arbitrary data of almost any type. You can use this data for personalization, segmentation, or as a sending data source much like a list. Data extensions can be thought of as cloud-based, relational marketing databases. Those familiar with Force.com will find data extensions very similar to custom objects. Let s duplicate your subscriber data model in a data extension. This first step moves toward building a common view of our customers, which we will extend in later chapters to include additional channels beyond email. To create your data extension, follow the steps below: 1. Navigate to Data Extensions under Subscribers. 2. Click Create and select Standard Data Extension. 3. Give your data extension the name and external key subscribers. 4. Ensure your data extension is marked Is Sendable?. As the name implies, sendable data extensions can be used like lists to send email. 5. Click Next. 6. Specify no data retention policy in the second step of the wizard. This ensures the data extension keeps all data until you explicitly delete it. 7. Click Next. 26

Chapter 4: Sending Your First Email 8. Add the following fields to your data extension (Figure 16): EmailAddress EmailAddress, primary key FullName Text, nullable FirstName Text, nullable LastName Text, nullable HasAppInstalled Boolean, nullable 9. Set Send Relationship to map EmailAddress to Subscriber Key (this step enables you to use the email address as a unique identifier for the subscriber). 10. Click Create. This step will take you back to the main data extensions screen. Figure 16: Creating a data extension Finally, we need to add a subscriber to our data extension. You can perform this action in several ways, including importing from a CSV file uploaded via FTP (see Additional Resources) or using the API. Since this is a book for developers, we ll use the API and take advantage of that opportunity to show you how the API works. Before we can make any API calls, though, we need to set up our development environment. 27

Chapter 5: Setting Up Your Development Environment In this chapter Code@ ExactTarget Fuel Client Libraries App Center Connect your App to an Account Give your App Access to Account Features Get your App s OAuth Credentials Developers can consume and provide marketing services using any runtime and development environment they choose by using Fuel s APIs. Because ExactTarget Fuel is a part of the Salesforce1 Platform, developers will find Force.com and Heroku ideal environments to implement these marketing services. This section shows you how to set up your developer environment for working with ExactTarget Fuel. Code@ExactTarget First and foremost, you should familiarize yourself with Code@ ExactTarget (http://code.exacttarget.com), the home of ExactTarget Fuel API and other developer documentation as well as client libraries, SDKs and other developer tools. In addition, our Developer Advocates regularly monitor and offer help at the popular StackExchange site (http://salesforce.stackexchange.com/tags/exacttarget). Code@ExactTarget, along with Salesforce Developers (http://developer.salesforce.com), presents a vibrant resource for anyone building apps or looking for support. Fuel Client Libraries To get started, download the Fuel client library for your preferred programming language from http://code.exacttarget.com/apis-sdks/ fuel-sdks/. Fuel s client libraries provide wrappers around Fuel s APIs that enable developers to integrate with those APIs using native language constructs. There are currently client libraries for Java,.NET, Node.js, and PHP with others maintained by the ExactTarget developer community. The client libraries provide protocol agnostic interfaces across Fuel s SOAP and REST APIs as well as automated token management and other features designed to reduce development time. Our SOAP API is our oldest and most comprehensive API, but its functionality is limited to the ExactTarget email application, and, like all SOAP APIs, it is fairly heavyweight. Our REST API is newer and less comprehensive, but it exposes a broader set of Marketing Cloud capabilities and is much more lightweight and easy to use (and is getting more comprehensive with every release). 29

Chapter 5: Setting Up Your Development Environment By using the client libraries, you get the best of both worlds, and, in most cases, it is possible to accomplish the same task with far less code using the client libraries. For that reason, and because we have coded common patterns and best practices directly into the client libraries, we highly recommend using a client library if one is available for your preferred environment. If there s not a client library available for your preferred environment, or if you d rather not use a client library, don t worry you can always use the APIs directly. We ll show you a few examples of how to do that (see Using the API Directly), but we won t be able to be comprehensive. You can find much more information about how to use the APIs directly at Code@ExactTarget. App Center Next, you should create an App Center account and log in to that account. App Center (https://appcenter.exacttarget.com) provides the central development console for using Fuel s APIs and building Marketing Cloud apps. Each app in App Center represents an application connected to ExactTarget Fuel. If you are familiar with connected apps in Force.com, you will find the concept of connected apps in Fuel familiar. App Center currently offers four types of connected apps (Figure 17): API Integrations are secure, API-based server-to-server integrations. An API Integration should be created when you want to use Fuel s APIs to automate tasks or integrate business systems. API Integrations utilize an OAuth2 client credentials flow to acquire access tokens directly from Fuel s authentication service. Marketing Cloud Apps are full-screen apps that live within the ExactTarget Marketing Cloud and are launched via the Marketing Cloud s app menu. Marketing Cloud apps can be custom apps built by your organization or apps installed from the ExactTarget HubExchange marketplace. Marketing Cloud apps utilize a JSON Web Token (JWT) to acquire access tokens on behalf of logged in users. Marketing Cloud App Extensions are lightweight extensions to other apps that extend that app s native capabilities and experience. Examples of Marketing Cloud app extensions include Journey Builder activities, Automation Studio activities, and Cloud Editor gears. Mobile Apps are apps built for the ios, Android, or Blackberry mobile platforms that use the Journey Builder Apps SDK to interact with their users via push or in-app messages. Mobile apps are classified as consumer-grade applications and utilize long-lived limited access tokens. 30

Chapter 4: Setting Up Your Development Environment Figure 17: App Center To get started, create an API Integration with the Marketing Cloud by following the steps below: Navigate to App Center (https://appcenter.exacttarget.com/appcenter). Click API Integration. Give the connection a name and description. Give the connection a package (packages are identifiers that uniquely identify the connection or app in ExactTarget Fuel): Click Next. 31

Chapter 5: Setting Up Your Development Environment Connect your App to an Account Next, connect your app to an ExactTarget Marketing Cloud account. Your app will access this account when it makes API calls: The first time you connect an app to an account, you need to select New from the dropdown menu. App Center saves account references, so if you want to use the same account for future apps, you can select that account from the dropdown menu rather than connecting to a new one. When you connect an account, you need to tell App Center what type of account it is: A Production ExactTarget Account is what most developers have access to and use for development purposes. If you are using a Developer Edition account, you should select Production ExactTarget Account. A Sandbox ExactTarget Account exists as a special type of account that some organizations purchase for use in conjunction with a production account for testing. If you re not sure which type of account to choose, you should choose Production ExactTarget Account. After you have selected what type of ExactTarget account you want to connect your app to, click the Link to Account button. A new browser window will open and display the ExactTarget Marketing Cloud login screen asking for a username and password. Note: Don t confuse the username and password you used to log into App Center with ExactTarget Marketing Cloud credentials they are different! Give your App Access to Account Features Once you log in, you move to the next step of the wizard. In this step, you need to tell App Center what account features your app will need to access to function properly. Your app will receive access to only those account features you specify here. For other app types, like Marketing Cloud apps, the users of your app must have access to these features to use your app in their Marketing Cloud accounts. 32

Chapter 4: Setting Up Your Development Environment Your app will need to create and modify emails, lists, subscribers, and data extensions, as well as send email and retrieve tracking event data, so you will need to give your app access to the following account features and operations: Channels Email Read, Write, Send Contacts List and Subscribers Read, Write Data - Data Extensions Read, Write Data Tracking Events Read Get your App s OAuth Credentials After completing this step of the wizard, you will see a summary screen. If everything looks good, click Finish to complete the wizard. 33

Chapter 5: Setting Up Your Development Environment Among other things, the summary screen shows you the connected app s OAuth client credentials, which you will use with the Fuel authentication service to get OAuth tokens that will authenticate your app with other Fuel APIs: Also note the Courtesy Limit. The Courtesy Limit is a soft capped limit on the number of API calls your app can make. If your app needs to make more than 50,000 API calls per day, it will not be prevented from making them. However, ExactTarget monitors the API usage of each app and can rate limit or throttle apps that are either intentionally or accidentally abusing Marketing Cloud resources. Note: The connected app s OAuth client credentials represent pre-authorized access to the account granted through the authorization step of the App Center wizard. You should never expose the client secret on the client side via JavaScript, and you should always take steps to store the client secret securely in your application, as knowledge of the client secret will give anyone full access to the linked account! You can navigate back to the app summary screen at any time from the App Center main window: Now your application connects to a Marketing Cloud account, and you received OAuth credentials to that account. Let s write some code! 34

Chapter 6: Using the API to Populate the Data Extension In this chapter Using a Client Library Using the API Directly You can populate the data extension you created in Going Further with Data Extensions in two ways via ExactTarget Fuel: Using a client library, and using the API directly. In this chapter, we will cover how to do both. You can use this chapter not only as a guide to populating the data extension, but also as a guide on how to use Fuel s APIs and client libraries. Using a Client Library The preferred method of using ExactTarget Fuel is via a client library. In our examples, we will use the PHP client library, though you can easily adapt our examples to the other client libraries as they all follow similar patterns and expose the same objects and properties. To get started, install the PHP client library in a subdirectory of your workspace called sdk. Make sure you install all dependencies as described in the README of the client library. To configure the client library, you need to add your OAuth credentials from App Center to config.php (the client library contains a template file you can use to create config.php). Note that you can safely include your OAuth credentials in config.php because config.php is hosted serverside and not exposed to the client: <?php return array( );?> appsignature => none, clientid => YOUR _ CLIENT _ ID _ FROM _ APP _ CENTER, clientsecret => YOUR_CLIENT_SECRET_ FROM _ APP _ CENTER, defaultwsdl => https://webservice.exact target.com/etframework.wsdl 35

Chapter 6: Using the API to Populate the Data Extension After the client library is configured, you initialize it by instantiating an ET_Client object: <?php require( sdk/et _ Client.php ); $client = new ET _ Client();?> The ET _ Client object is the central object in all Fuel client libraries and performs a number of tasks for you automatically, including acquiring and refreshing OAuth access tokens using the client credentials you specify in config.php. After initializing the client library, you can add a row to the data extension we created using the following code: <?php require( sdk/et _ Client.php ); $client = new ET _ Client(); $derow = new ET _ DataExtension _ Row(); $derow->authstub = $client; // specify the name of the data extension $derow->customerkey = subscribers ; // specify the values of the data extension row $derow->props = array( EmailAddress => YOUR _ EMAIL _ ADDRESS, FirstName => YOUR _ FIRST _ NAME ); $response = $derow->post(); print _ r($response);?> The following steps outline a typical interaction with a Fuel client library object and highlight the patterns common to all Fuel client libraries: Instantiate the object you want to interact with (in this case, ET _ DataExtension _ Row). Supply the ExactTarget Marketing Cloud account context via the authstub property on the object ($derow->authstub = $client). (In some client libraries, this is automatically handled for you.) Identify the object you want to interact with, typically via a unique ID or key. In our case, CustomerKey is the API equivalent of the External Key value we specified in Going Further with Data Extensions when we created the data extension. Set the appropriate properties that govern the operation (in this case, you are creating a data extension row with the EmailAddress column set to your email address and the FirstName column set to your first name). Perform a REST-like operation (GET, POST, PATCH, or DELETE) on the object depending on whether you want to retrieve, create, update, or delete it. In the example above, you create a data extension row, so you perform a POST. 36

Chapter 6: Using the API to Populate the Data Extension When you load the PHP file in your browser, you will see the following output: ET _ Post Object ( [status] => 1 [code] => 200 [message] => [results] => Array ( [0] => stdclass Object ( [StatusCode] => OK [StatusMessage] => Created DataExtensionObject [OrdinalID] => 0 [NewID] => 0 [Object] => stdclass Object ( [PartnerKey] => [ObjectID] => [CustomerKey] => subscribers [Properties] => stdclass Object ( [Property] => Array ( [0] => stdclass Object ( [Name] => EmailAddress [Value] => YOUR _ EMAIL _ ADDRESS ) ) ) ) ) ) [1] => stdclass Object ( [Name] => FirstName [Value] => YOUR _ FIRST _ NAME ) ) [request _ id] => [moreresults] => This output displays a typical response to a PHP client library operation. For now, just note that the call succeeded as indicated by StatusCode and StatusMessage. 37

Chapter 6: Using the API to Populate the Data Extension Go back to the Email application and verify the row added successfully by navigating to the Data Extensions screen and clicking the data extension. Click the Records tab to view the data (Figure 18). Figure 18: Adding a row to the data extension via the PHP client library To highlight the similar patterns employed by the different client libraries, the following Java code is equivalent to the PHP code we used to add the row to the data extension: public class DataExtensionAddRow { public static void main(string args[]) throws ETSdkException { ETClient client = new ETClient(); ETFilter filter = new ETSimpleFilter( CustomerKey, ETFilterOperators.EQUALS, su bscribers ); ETDataExtension dataextension = client.retrievedataextension (filter); ETDataExtensionRow row = new ETDataExtensionRow(); row.setcolumn( EmailAddress, YOUR _ EMAIL _ ADDRESS ); row.setcolumn( FirstName, YOUR _ FIRST _ NAME ); dataextension.insert(row); 38

Chapter 6: Using the API to Populate the Data Extension Using the API Directly If you are using a language or platform for which a client library is not available or a client library is otherwise not a viable solution, you can use the API directly rather than going through a client library. This section shows you how to do that. Getting an Access Token The first step in any API-based integration is getting an access token you will use to authenticate other API calls. To get an access token, use the Fuel authentication service. The code sample below demonstrates how to use an HTTP POST request to acquire an access token: POST https://auth.exacttargetapis.com/v1/requesttoken Content-Type: application/json { clientid : YOUR _ CLIENT _ ID _ FROM _ APP _ CENTER, clientsecret : YOUR _ CLIENT _ SECRET _ FROM _ APP _ CENTER 200 OK { accesstoken : p3sygbfr3t7z94f7wv4czxtw, expiresin : 3600, refreshtoken : hu3kyjqt4r7wpwrkbkjvpwpu The access token is returned in the accesstoken property. You can use this token to authenticate other API calls by specifying this value via the Authorization header field with the Bearer HTTP authorization scheme: GET https://www.exacttargetapis.com/platform/v1/endpoints Accept: application/json Authorization: Bearer p3sygbfr3t7z94f7wv4czxtw You can use Fuel access tokens to authenticate with the ExactTarget SOAP API as well. The following example use the same access token to authenticate with the SOAP API: <s:envelope xmlns:s= http://schemas.xmlsoap.org/soap/envelope/ > <s:header> <h:fueloauth xmlns= http://exacttarget.com xmlns:h= http://exacttarget.com > p3sygbfr3t7z94f7wv4czxtw </h:fueloauth> </s:header> [...] </s:envelope> 39

Chapter 6: Using the API to Populate the Data Extension Refreshing the Access Token Note the expiresin and refreshtoken properties in the HTTP response to the requesttoken API call. Fuel access tokens expire one hour after they are issued. If you attempt to use an expired token, you will receive a 401 Unauthorized HTTP response. If this happens, you will need to refresh your access token. To do that, add the refresh token from your initial call to your next call: POST https://auth.exacttargetapis.com/v1/requesttoken Content-Type: application/json { clientid : YOUR _ CLIENT _ ID _ FROM _ APP _ CENTER, clientsecret : YOUR _ CLIENT _ SECRET _ FROM _ APP _ CENTER, refreshtoken : hu3kyjqt4r7wpwrkbkjvpwpu Important considerations when using the API directly There are two important considerations to keep in mind if you use the API directly and do your own OAuth token management rather than using the SDKs. First of all, you should NOT request a new token for every API call you make each token is good for an hour and should be reused. Making two API calls for every one operation is inefficient and may result in throttling. Secondly, and we cannot say this enough, be careful where you store your client secret. In particular, you should NOT store your client secret in a mobile application because a mobile device is not a secure environment; it is recommended that you utilize an Authorization Code or Implicit Grant OAuth flow instead. 40

Chapter 7: Creating Your First Interaction In this chapter Journey Builder Basic Concepts Creating Your Content in the Email App Setting Up the Contact Model Using Contact Builder Creating your first interaction in Journey Builder We are now ready to build our first customer journey. As mentioned in the introduction, we will be playing the role of a fictional wearable device company wanting to drive post-purchase customer engagement by encouraging new customers to download our mobile app and, once installed, encourage consistent usage of it. We want to do this because we know the more engaged our customers are, the more likely it will be that they will continue to use our product regularly; and that the more they use our product regularly, the more likely it will be that they will buy the next version. This is a good example of a For App strategy as described in the section A For App Strategy. Let s build out our fictional scenario. We offer our wearable in retail outlets as well as online. When customers purchase our product, they create an account in our system their product synchronizes with, making their data available to them in the cloud so they can access it both on our web site and on a mobile app we offer free in popular app stores. The signup process involves supplying an email address, which is a very common requirement for forgot my password reasons. It is that email address that provides us with the opportunity to make our first customer touchpoint, and it is that customer touchpoint that initiates the overall customer journey. Once the account has been created, we ll fire an event into the Journey Builder engine that begins a simple drip campaign designed to get the customer to install the mobile app. The first step of the drip campaign is to send an email to the customer thanking them for signing up. We ll use that email send to encourage new customers to download the mobile app, including a link to the app store to make it as easy as possible for them to do that as well as to track who clicks through. Next, we ll wait a few days, and if the customer hasn t yet installed the app, we ll send them another email with an incentive to do so: 20% off renewal next year. Once the app is installed, we ll use the Journey Builder Apps for SDK to more deeply engage with our customers through push and in-app messages. 41

Chapter 7: Creating Your First Interaction Journey Builder Basic Concepts Before proceeding, it will be very helpful to have an understanding of how Journey Builder works and its basic concepts. In Journey Builder, an interaction is a workflow comprised of an interconnected series of activities and waits. Activities can be outbound message actions such as Send Email or Send SMS or control flow actions such as Decision Split or Engagement Split that send the interaction down one path or another based on a specified condition being met (e.g., the email sent in a previous step of the interaction has been opened). Waits suspend the interaction for a specified period of time (e.g., wait two days, then perform the next activity ). Optionally, an interaction can have a stated goal (e.g., I want 80% of the population to install the mobile app ). The interaction begins executing when an event gets fired (e.g., the customer has just registered their product) and a trigger condition is met (e.g., the customer has not yet installed the mobile app). Once the interaction begins executing, customers that meet the trigger condition move systematically through the interaction according to its activities and waits. Customers leave the interaction once they have reached the final activity or the goal of the interaction has been met (if the goal is configured to cause the customer to leave the interaction once it has been met). Journey Builder uses contacts to represent customers and store customer data. Contacts represent a single view of your customers, consolidating information gathered from multiple sources into a single place and making that information actionable in your customer journeys. You can associate any type of data with a contact, including address information that spans multiple channels (email address, mobile number, etc.), interests and preferences, engagement history (opens, clicks, page views, etc.), and data from third-party sources (demographic information, purchase history, etc.). In addition to the standard activities available to you in Journey Builder, you can build your own activities as well, either custom for your organization or as an ISV for the ExactTarget HubExchange marketplace. How to build your own activites is beyond the scope of this book see http://code.exacttarget.com/ app-development/journey-builder-development/ for more information on building your own Journey Builder activities. Before we get into Journey Builder, we need to prepare the content assets we re going to be using in the email that will initiate the customer journey. Creating Your Content in the Email App First, create the emails to send in the interaction using the same flow used in Sending Your First Email. Create two emails: A message thanking the customer for purchasing the wearable with a link to the app, and the other reminding the customer to install the app and offering them an incentive to do so. We ll be sending the second message in the event they don t install the app after receiving the first message using a typical drip campaign flow. 42

Chapter 7: Creating Your First Interaction Go ahead and create those emails with the subject lines Thank you for registering, %%FirstName%%! and %%FirstName%%, did you know, respectively. Use the following bodies: Email #1: <html> <body> <p>thank you for registering! Don t forget to <a href= http://www.example.com/download/ >download our mobile app</a>!</p> <small> <p>this email was sent by:</p> <p> %%Member _ Busname%% <br /> %%Member _ Addr%% <br /> %%Member _ City%%, %%Member _ State%% %%Member _ PostalCode%% <br /> %%Member _ Country%% </p> <a href= %%profile _ center _ url%% >Profile Center</a> </small> <custom name= opencounter type= tracking > </body> </html> Email #2: <html> <body> <p>... we have an app? <a href= http://www.example.com/down load/ >Download it today</a> and save 20% on renewal next year!</p> <small> <p>this email was sent by:</p> <p> %%Member _ Busname%% <br /> %%Member _ Addr%% <br /> %%Member _ City%%, %%Member _ State%% %%Member _ PostalCode%% <br /> %%Member _ Country%% </p> <a href= %%profile _ center _ url%% >Profile Center</a> </small> <custom name= opencounter type= tracking > </body> </html> 43

Chapter 7: Creating Your First Interaction With our assets now available for use, we can move on to the next task, which is to set up the customer data model ( contact model ) using Contact Builder. Setting Up the Contact Model Using Contact Builder Contacts are defined in the Contact Builder application. To define your contact model, navigate to Contact Builder under Data & Analytics. Contact Builder opens in the Data Designer tab (Figure 19). Figure 19: Contact Builder Data Designer Contacts consist of attributes, which represent a single piece of information about a contact such as a first name, email address or favorite ice cream flavor. Contact attributes reside in data extensions and need to be linked to the contact record before they are available to Journey Builder. Data Designer allows you to define and manage linkages between the contact model and your data extensions. To do that, you create attribute groups that map contact attributes to specific data extensions and columns within those data extensions. These attribute groups can then be used in Journey Builder activities and triggers (among other places). 44

Chapter 7: Creating Your First Interaction Create an attribute group using the steps below: 1. Click on Create Attribute Group. 2. Name your attribute group customers. 3. Click Save. 4. Click on Link Data Extension to link the subscribers data extension you created in Going Further with Data Extensions. 5. In the right panel, select the subscribers data extension. 6. In the left panel, select the Contact Key attribute. 7. In the right panel, select the EmailAddress column. 8. In the right panel dropdown, select One, then check the box labeled Use as root (Figure 20). 9. Click Save. Figure 20: Linking a data extension to the contact model 45

Chapter 7: Creating Your First Interaction When you link data extensions to the contact model, you need to specify the cardinality of the relationship: One-to-one relationship: A one-to-one relationship indicates that the data extensions being linked relate to each other on a single piece of information called a primary key (e.g., a unique member ID or mobile number). Each data extension contains a single reference to that primary key. One-to-one relationships are used to extend the contact record, e.g. by linking demographic information from an outside source via the primary key. Root relationship: A root relationship is a special kind of one-to-one relationship between a contact record and a data extension that acts as the source for contact information. A root relationship can only occur between the contact record and a single data extension. The data extension used in a root relationship must contain only one row per contact, and each row in that data extension represents a contact. One-to-many relationship: A one-to-many relationship indicates that the data extensions being linked relate to each other on multiple pieces of information via the primary key. For example, you could use a one-to-many relationship to relate the contact s email address to multiple orders contained in a purchase history data extension. One-to-many relationships are beyond the scope of this tutorial. Many-to-many relationship: A many-to-many relationship can match several different values between two data extensions. Many-to-many relationships are also beyond the scope of this tutorial. In our case, we are defining the contact model based on the subscribers data extension, so we specify the root relationship. Finally, before we can use our new attribute group with Journey Builder, we need to tell Contact Builder the EmailAddress column in the subscribers data extension we just linked is an email address using the steps below (Figure 21): 1. Click on Contacts Configuration in the top menu bar. 2. Click Edit in Email Channel Address Order. 3. Click Add Address. 4. Select the subscribers data extension in the popup window. 5. Select the EmailAddress column in the popup. 6. Click Save in the popup. 7. Click Save in Email Channel Address Order. 46

Chapter 7: Creating Your First Interaction Figure 21: Adding the EmailAddress column to Email Channel Address Order Creating your First Interaction in Journey Builder We re ready to create our first interaction! To launch Journey Builder, navigate to Journey Builder under Marketing Automation, which opens in Journey Builder s Summary View. Summary View shows a filterable list of interactions in the account along with analytics from activated interactions. To create an interaction, click Create New Interaction in the upper right hand corner. This will take you to Journey Builder s Canvas View (Figure 22). The Canvas View gives you all the tools required to declaratively create interactions. Let s go ahead and create our first interaction. First of all, give the interaction a name by clicking on Untitled Interaction in the top left corner. Name the interaction install the mobile app, then click Done. Optionally, you can also add a description. 47

Chapter 7: Creating Your First Interaction Figure 22: Journey Builder Canvas View Defining the Trigger Next, let s define the trigger. As described in Journey Builder Basic Concepts, a trigger specifies the condition that must be met for the interaction to begin executing. Define the trigger using the steps below: 1. Click Select a Trigger 2. Click Create Trigger. 3. Click Next. 4. Give the trigger the name app has not been installed. 5. Find the subscribers attribute group in the Attributes pane and expand it. 6. Drag the HasAppInstalled attribute and drop it where it says Drag and drop Attributes to build an Expression. 7. Select Is False from the dropdown menu. 8. Drag another HasAppInstalled attribute and drop it in the same place. 9. Select Has No Value from the dropdown menu. 10. On the very right hand side of expression builder, change AND to OR in the dropdown menu. 11. Specify the data source by clicking Choose Data Extension then selecting the subscribers data extension. Your screen should now look like Figure 23. 12. Click Next. 13. Click Next again. 14. Click Done. 48

Chapter 7: Creating Your First Interaction Figure 23: Defining the trigger Adding Activities to the Canvas Next, let s define the activities that make up the interaction. As described in the chapter opening, our interaction plan is as follows: Once the account has been created, we ll fire an event into the Journey Builder engine that begins a simple drip campaign designed to get the customer to install the mobile app. The first step of the drip campaign is to send an email to the customer thanking them for signing up. We ll use that email send to encourage new customers to download the mobile app, including a link to the app store to make it as easy as possible for them to do that as well as to track who clicks through. Next, we ll wait a few days, and if the customer hasn t yet installed the app, we ll send them another email with an incentive to do so: 20% off renewal next year. Add the first email to the canvas using the steps below: 1. Drag the Send Email activity from the Activity pane and drop it on the canvas under Immediately (Day 0). 2. Hover your mouse over the Send Email activity you just dropped. 3. Click Configure. 4. Select the first email you created in the section Creating Your Content in the Email App. 5. Click Next. 6. Click Done. 49

Chapter 7: Creating Your First Interaction Next, let s add a wait to the canvas. In production, we ll want to wait three days before we send the second email, but for the purposes of testing, let s just wait three minutes for now. In the upper right part of the screen, change the Time Interval dropdown from days to minutes. Waits are implicitly added to the canvas based on where subsequent activities are dropped. Since the next activity is a decision split (essentially, an if/then like control flow activity), add the decision split to the canvas using the steps below: 1. Drag the Decision Split activity from the Activity pane and drop it on the canvas under Minute 3. 2. Hover your mouse over the Decision Split activity you just dropped. 3. Click Configure. 4. Build the expression HasAppInstalled Is True in the same way you built the expression for your trigger in Defining the Trigger. 5. Click Done. 6. Drag the Send Email activity from the Activity pane and drop it on the canvas under the No split of Minute 3 (i.e., the path that gets taken when the expression HasAppInstalled is either False or Has No Value). 7. Select the email for this Send Email activity in the same way you selected the first one. This time, select the second email you created in the section Defining the Trigger. Your screen should now look like Figure 24. Figure 24: Adding activities to the canvas 50

Chapter 7: Creating Your First Interaction Activating the Interaction We are now ready to activate the interaction and test it. To activate the interaction, click Activate, then click Activate again to confirm we want to activate it. Note that the Canvas View switches to include interaction metrics appropriate to the channel (e.g., opens and clicks) on the canvas (Figure 25). Figure 25: An activated interaction Testing the Interaction Next, let s fire the event to start the interaction via the API, which in our hypothetical scenario will happen when the customer creates their account and supplies their email address. To fire the event, we need to know the event definition key of the trigger we defined in Defining the Trigger. To get the event definition key, go back to the Summary View and click on Trigger Administration in the top right corner. Find your trigger, and note the value in the column Event Definition Key (Figure 26). 51

Chapter 7: Creating Your First Interaction Figure 26: Getting the event definition key for the API call Once we know the event definition key, get an access token from Fuel s authentication service following the instructions in Using the API Directly, then use that access token to make the following API call: POST https://www.exacttargetapis.com/interaction-experimental/v1/ events Authorization: Bearer OAUTH _ ACCESS _ TOKEN Content-Type: application/json { ContactKey : YOUR _ EMAIL _ ADDRESS, EventDefinitionKey : EVENT _ DEFINITION _ KEY _ FOR _ THE _ TRIGGER, Data : { EmailAddress : YOUR _ EMAIL _ ADDRESS You should receive the first email immediately and the second email three minutes later per our interaction. You can simulate installation of the app by using the API to set the value of the data extension column HasAppInstalled to true after you receive the first email (and, obviously, within the first three minutes after receiving it). Congratulations! You have successfully built your first interaction and gotten your customer to install your mobile app! In the next chapter, we ll cover what you can do now that you have valuable screen real estate on that customer s smartphone. 52

Chapter 8: Engaging with the Customer in the Mobile App In this chapter Sending Push Messages Using Location within Push Messages Sample Journey Builder for Apps Workflow Journey Builder for Apps SDK Configuration Now that the app has been installed, you have a new and valuable customer touchpoint the customer is now literally only a few taps or swipes away from your brand each and every time they use their smartphone. But your app sits alongside thousands of other apps competing for attention and screen real estate. To take maximum advantage of your new customer touchpoints, you need to keep your app (and brand) top of mind, which isn t always easy. And you need to maximize the value of each interaction once the user is in-app, which requires more sophisticated functionality that goes beyond traditional push messaging. This chapter will show you how to take maximum advantage of your new customer touchpoints by integrating Journey Builder directly into your mobile apps using the Journey Builder for Apps SDK. The Journey Builder for Apps SDK builds on the MobilePush SDK available from the ExactTarget Marketing Cloud since 2012, adding powerful in-app messaging capabilities to the push messaging support provided by MobilePush. Sending Push Messages At its core, the Journey Builder for Apps SDK provides a framework for you to use when sending push messages. These push messages can include a simple text alert, a mobile-optimized landing page, or a combination of text alert and mobile-optimized landing page. The Journey Builder for Apps SDK works with both ios and Android platforms (including the new Amazon devices). You can also use either native apps or take advantage of the new Cordova support to blend universal HTML 5 applications with native device functionality (e.g., the device camera). Once you integrate the SDK with your ios, Android, or Amazon app, you can use the same personalization information available for email or SMS messaging for your push messages. When your customers opt to receive push messages, you can display messages or send links to mobile-optimized landing pages directly on the smart phone screen. The SDK also provides information on how users interact with your app, including which messages users open and how much time they spend in-app. This information is available in the MobilePush app, available in the ExactTarget Marketing Cloud app menu. 53

Chapter 8: Engaging with the Customer in the Mobile App Typically, push notifications are designed to get the user to launch the app.. let s now go beyond that within the app itself. Using Location within Push Messages The Journey Builder for Apps SDK also supports the sending of push notifications based on location in the following three scenarios: 1. The user enters a specified location, known as a geofence. This type of message can help you bring users into a specific location using a time-sensitive offer. 2. The user leaves a specified geofence. This type of message can help you reward users with an offer that prompts them to return to a location in the near future. 3. The user encounters a beacon, a low-power Bluetooth device that allows you to target a mobile device at close range, such as within a store versus a larger radius centered around a store. This type of message can help you provide a specific offer to a user already in a store or prompt a user when their mobile device comes near an item on their wishlist. Sample Journey Builder for Apps Workflow The steps below outline how you might prompt a user to download your mobile app and enable push messaging: 1. Advertise your app via in-store signage, website, or direct promotion (such as email or SMS). 2. Send a push message welcoming the user and prompting them to take an action (such as visiting a location or updating a preference center). 3. Continue push messaging with offers, alerts, and updates. a. Target and personalize messages via subscriber data. b. Provide product recommendations. c. Sign users up for cross-channel promotions, such as email or SMS messages. d. Automate messages with personalized messages to create targeted lifecycle campaigns. e. Use the MobilePush REST API to trigger transactional messages (such as bank statements, flight statuses, or shipping confirmation). f. Promote surveys. g. Create location-based sending with time-sensitive offers. h. Prompt inactive users with retention messages based on contact record information. i. Provide coupons for loyal customers. j. Include remarketing information to prompt users that abandon carts. 54

Chapter 8: Engaging with the Customer in the Mobile App Journey Builder for Apps SDK Configuration Developers can include the Journey Builder for Apps SDK as they begin the app development process, or they can add the SDK to an existing app to integrate that app with Journey Builder for Apps. In either case, the integration follows the steps outlined below: Create production and development versions of your app in App Center: You must create apps for both production and development apps in the AppCenter. Note that different platform versions of the same app (ios and Android, for example) must use the same production and development apps in AppCenter. 1. Navigate to http://appcenter.exacttarget.com/appcenter and login. 2. Click Create New App. 55

Chapter 8: Engaging with the Customer in the Mobile App 3. Click the MobilePush template. 4. Enter a name for your app. Note that you must repeat this process for both production and development instances of your app. 5. Enter a name for the instance of your app in the Name field. 6. Enter a description for the instance of your app in the Description field. 7. Enter the package address for the instance of your app in the Package field. 8. Click Choose File and select the icon for the instance of your mobile app. 9. Click Next. 56

Chapter 8: Engaging with the Customer in the Mobile App 10. Select an account with which to integrate in the Account drop-down menu. 11. Select the Production ExactTarget Account button unless otherwise instrucuted by your ExactTarget relationship manager. 12. Click Link to Account. 13. Click Next. 14. Click Integrate. 15. Click Finish. 57

Chapter 8: Engaging with the Customer in the Mobile App 16. Note the Application ID and Access Token values for use when bootstrapping your app with the Journey Builder for Apps SDK. You must obtain separate values for both the production and development versions of your mobile app. 58

Chapter 8: Engaging with the Customer in the Mobile App Review and download the Journey Builder for Apps SDK: ExactTarget Marketing Cloud provides Journey Builder for Apps SDKs for ios and Android application development. Once integrated into your mobile application, these SDKs handle all communication to and from ExactTarget Marketing Cloud needed to register a given mobile device and receive push notifications. Journey Builder for Apps SDK Versions Certain MobilePush features (such as OpenDirect URL and ETLocationManager) require the most recent version of the client-side SDK. To use these features, review the SDK release notes and bundled documentation for instructions. Version 1 Initial implementation for MobilePush Version 2 Adds support for OpenDirect with URL Version 3 - Adds support for ETLocationManager The most current version of the SDK supports the following operating systems: ios 6 and later Android 2.3 and later ExactTarget Marketing Cloud supports the current SDK version and the previous two versions. ExactTarget Marketing Cloud recommends updating to the current SDK, but will support setup for the previous two SDK versions. All features available at the time of the SDK release will remain functional except for the following instances: ExactTarget Marketing Cloud will not provide any fixes for bugs for previous SDK versions. Upgrade to the newest version to avoid any applicable bugs. ExactTarget Marketing Cloud will not add new functionality or features to previous SDK versions. Upgrade to the newest version to access new functionality and features. ExactTarget Marketing Cloud uses a semantic versioning (http://semver.org/) system for a release numbering scheme. Use the following overview to understand this release numbering scheme: The MAJOR version introduces API changes incompatible with previous versions. The MINOR version adds functionality that remains backwards-compatible with previous versions in the same major version. The PATCH version introduces backwards-compatible bug fixes. SDKs View and download the SDKs from GitHub, where you can also view the complete source code for the project: ios - For devices running Apple s ios operating system, such as iphone and ipad GitHub Repository and Full Release Notes - https://github.com/exacttarget/mobilepushsdk-ios Download Complete Zip from GitHub - https://github.com/exacttarget/mobilepushsdk-ios/ archive/master.zip 59

Chapter 8: Engaging with the Customer in the Mobile App Android - For devices running Google s Android operating system, such as Nexus 4 and Samsung Galaxy phones GitHub Repository and Full Release Notes https://github.com/exacttarget/mobilepushsdk- Android Download Complete Zip from GitHub https://github.com/exacttarget/mobilepushsdk- Android/archive/master.zip Provision the app to use Apple or Google push messaging services: ios: The Journey Builder for Apps SDK allows you to utilize MobilePush functionality as part of your ios mobile app. This functionality includes the ability to send push messages to mobile devices through the app (based on demographic information or geofence triggers), include CloudPage content in a push message, and collect analytics information based on the results of sent push messages. The integration permits you to more accurately target and communicate with mobile device users via push messages. You must provision your mobile app in the ios Provisioning Panel. The certificates issued in the process remain valid for one year. Ensure that you repeat this procedure once per year before your certificates expire to maintain app functionality. Follow the instructions below to integrate the Journey Builder for Apps SDK with your ios mobile app: 1. Log in at the ios Dev Center. 2. Click Certificates, Identifiers & Profiles. 60

Chapter 8: Engaging with the Customer in the Mobile App 3. Click Identifiers. 4. Click the + icon to create a new app. 61

Chapter 8: Engaging with the Customer in the Mobile App 5. Enter a name for the app in the Name text field. 62

Chapter 8: Engaging with the Customer in the Mobile App 6. Enter an explicit app ID in the Bundle ID field. 7. Click the check box next to Push Notifications. 8. Click Continue. 9. Click Submit to confirm your app ID creation. 10. Select your app in the presented list. 11. Click Edit. 12. Click Create Certificate... under Development SSL Certificate or Production SSL Certificate depending on the instance of the app you provision. Note that you must repeat these steps for both the development and production instances of this app. 63

Chapter 8: Engaging with the Customer in the Mobile App 13. Launch Keychain Access on your Mac. 14. Click Keychain Access. 15. Click Certificate Assistant. 16. Click Request a Certificate from a Certificate Authority... 17. Enter your email address in the User Email Address field. 64

Chapter 8: Engaging with the Customer in the Mobile App 18. Enter a recognizable name for the certificate in the Common Name field. 19. Click Saved to disk. 20. Click Continue. 21. Enter a filename for the saved certificate. 22. Choose a location at which to save the certificate. 23. Click Save. 24. Return to the ios Dev Center website. 25. Click Continue. 65

Chapter 8: Engaging with the Customer in the Mobile App 26. Click Choose File. 27. Select the file saved in step 23. 66

Chapter 8: Engaging with the Customer in the Mobile App 28. Click Generate. 29. Click Download. 30. Double-click the downloaded file to install the certificate in Keychain Access. 31. Select the certificate in Keychain Access. 67

Chapter 8: Engaging with the Customer in the Mobile App 32. Right-click on the certificate. 33. Select Export. 34. Select a location to which to save the certificate. 35. Click Save. 36. Optionally, enter a password in the Password field. 37. If you entered a password, enter that password again in the Verify field. 38. If you entered a password, Click OK. 39. Email the production and development certificates, along with your App ID and the Member Identifcation (MID) number of the ExactTarget Marketing Cloud account, to mobilepush@ exacttarget.com with the subject ios App Integration. How to Bootstrap the Journey Builder for Apps SDK in your ios Mobile App Before you can Bootstrap the Journey Builder for Apps SDK in your ios Mobile App you must create a production and development app in AppCenter. See How to Create a Production and Development Apps in the AppCenter for details and instructions. Follow the steps below to bootstrap the Journey Builder for Apps SDK in your mobile ios app: 1. In your app development environment, Copy the libetpushsdk.a and the header files into your project. 68

Chapter 8: Engaging with the Customer in the Mobile App 2. Select Project Settings. 3. Select General. 4. Add libetpushsdk.a and libsqlite3.dylib as dependencies. 5. Add code in the AppDelegate implementation class to to bootstrap the Journey Builder for Apps SDK. Note that you must call configuresdkwithappid and andaccesstoken and provide values from code@exacttarget.com. You can also add custom tags like application version or information for use in targeting push message sends. 6. - (BOOL)application:(UIApplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { #ifdef DEBUG [[ETPush pushmanager] configuresdkwithappid:@ 427c085f-5358944f2-a8f7-bbc5150c77c5 andaccesstoken:@ yay73bzx6eygw8ypaqr67fvt, withanalytics:no, andlocationservices:no, andcloudpages:no]; #else [[ETPush pushmanager] configuresdkwithappid:@ 35a19ebc- 50ae-4ed5-9d6c-404290ada3cd andaccesstoken:@ cghknp9rjrmk9pkf6qh392u3 withanalytics:no, andlocationservices:no, andcloudpages:no]; #endif [[ETPush pushmanager] registerforremotenotificationtypes:uiremotenotification- TypeAlert UIRemoteNotificationType Badge UIRemoteNotificationTypeSound]; [[ETPush pushmanager] shoulddisplayalertviewifpushreceived:yes]; [[ETPush pushmanager] applicationlaunchedwithoptions:launchoptions]; return YES; 69

Chapter 8: Engaging with the Customer in the Mobile App 7. Register for push message callbacks. Handle these calls so that ExactTarget servers can receive information about the mobile device and register that device. 8. - (void)application:(uiapplication *)application didregisterforremotenotificationswithdevicetoken:(nsdata *) devicetoken { [[ETPush pushmanager] registerdevicetoken:devicetoken]; -(void)application:(uiapplication *)application didfailtoregisterforremotenotificationswitherror:(nserror *)error { [[ETPush pushmanager] applicationdidfailtoregisterforremotenotificationswitherror:error]; -(void)application:(uiapplication *)application didreceiveremotenotification:(nsdictionary *)userinfo { [[ETPush pushmanager] handlenotification:userinfo forapplicationstate:application.applicationstate]; 9. Deploy and start your app on a physical test device. You cannot use an ios simulator for testing. 10. Send a test message using the app: Wait 15 minutes until after the device first registers to send the test message. The message may arrive after a slight delay. Registration and tracking information generally arrives after a 15 minute delay. How to Implement Analytics in your ios Mobile App If you wish to implement ETAnalytics for analytical information on your app, pass a YES value for the withanalytics parameter. [[ETPush pushmanager] configuresdkwithappid:@ 35a19ebc-50ae-4ed5-9d6c 404290ada3cd andaccesstoken:@ cghknp9rjrmk9pkf6qh392u3 withanalytics:yes, andlocationservices:no, andcloudpages:no]; 70

Chapter 8: Engaging with the Customer in the Mobile App How to Implement Tags in your ios Mobile App To implement contact segmentation by tags, include code to set tags for subscriptions as defined by user choice. //SettingsViewController #define TAGIFY(x) [x stringbyreplacingoccurrencesofstring:@ withstring:@ _ ] -(void)switchtoggled:(uiswitch *)theswitch { NSLog(@ Switch %ld is at state %d, (long)theswitch.tag, theswitch.on); if (theswitch.on) { // the switch is now ON [[[ETPush pushmanager] addtag:tagify([[ _ rooms objectatindex :theswitch.tag] objectforkey:@ name ])]; else { // the switch is now OFF [[ETPush pushmanager] removetag:tagify([[ _ rooms objectatin dex:theswitch.tag] objectforkey:@ name ])]; How to Implement Attributes in your ios Mobile App To implement segmentation by attributes, include code to reference attributes in the app. You must define attributes within MobilePush before you can utilize them within the app. [[ETPush pushmanager] addattributenamed: FavoriteTeam value:favoriteteamname]; How to Implement Message Notifications in your ios Mobile App Follow the steps below to implement message notifications in your mobile ios app. 1. To implement a message notification when the app is in the foreground, include code such as the example below (ios will call your delegate): 2. -(void)application:(uiapplication *)application didreceiveremotenotification:(nsdictionary *)userinfo { [ETPush pushmanager] handlenotification:userinfo forapplicationstate:application.applicationstate]; //Add custom code here launch a special view controller, etc 71

Chapter 8: Engaging with the Customer in the Mobile App 3. To implement a message notification when the app is in the background, include code such as the example below: 4. -(BOOL)application:(UIApplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { [[ETPush pushmanager] registerforremotenotificationtypes:uiremotenotification- TypeAlert UIRemoteNotificationType Badge UIRemoteNotificationTypeSound]; [[ETPush pushmanager] shoulddisplayalertviewifpushreceived:yes]; [[ETPush pushmanager] applicationlaunchedwithoptions:launchoptions]; if (launchoptions!= nil) { // Launched from push notification NSDictionary *userinfo = [launchoptions objectforkey:uiapplicationlaunchoptionsremote NotificationKey]; //Add custom code here Ensure that you add handling to your didfinishlaunchingwithoptions method. How to Add Audio to your ios Mobile App Add an audio file called custom.caf to the main application bundle of your project to play that audio file when the mobile device receives a notification: How to Manage Badge Count in your ios Mobile App Ensure that you reset the badge counter when the mobile device receives the message (usually in applicationwillenterforeground). - (void)applicationwillenterforeground:(uiapplication *)application { // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. [[ETPush pushmanager] resetbadgecount]; 72

Chapter 8: Engaging with the Customer in the Mobile App How to Implement OpenDirect functionality in your ios Mobile App The OpenDirect customized push message contains a URL to be opened in a web view. Craft your application to react appropriately when the mobile device receives that type of push message. How to Process Custom Keys in your ios Mobile App To process custom keys when a push message arrives while the app is in the foreground, use code like the sample below and ios will call your delegate: -(void)application:(uiapplication *)application didreceiveremotenotification:(nsdictionary *)userinfo { [[ETPush pushmanager] handlenotification:userinfo forapplicationstate:application.applicationstate]; NSString *eventid = [userinfo objectforkey:@ eventid ]; //Add custom code here launch a special view controller, etc To process custom keys when a push message arrives while the app is in the background, retrieve the custom keys in the didfinishlaunchingwithoptions method with code like the sample below: -(BOOL)application:(UIApplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { [[ETPush pushmanager] registerforremotenotificationtypes:uiremotenotification TypeAlert UIRemoteNotificationType Badge UIRemoteNotificationTypeSound]; [[ETPush pushmanager] shoulddisplayalertviewifpushreceived:yes]; [[ETPush pushmanager] applicationlaunchedwithoptions:launchoptions]; if (launchoptions!= nil) { // Launched from push notification NSDictionary *userinfo = [launchoptions objectforkey:uiapplicationlaunchoptionsremote NotificationKey]; NSString *eventid = [userinfo objectforkey:@ eventid ]; //Add custom code here 73

Chapter 8: Engaging with the Customer in the Mobile App How to Implement Location Capabilities in your ios Mobile App The Journey Builder for Apps SDK uses location capabilities to store end user location data in the ExactTarget database. You can use this information to target messages to a segmented group of contacts. The app pre-downloads geofence messages and triggers those messages when a mobile device crosses a geofence boundary. You must receive user permission to implement location services. To implement location services, pass a YES value for the andlocaitonservices parameter and use ETLocationManager to monitor location and geofence for a user. The Journey Builder for Apps SDK can now use Bluetooth capabilities to trigger proximity messages associated with Beacons. The app pre-downloads proximity messages in the same manner as geofence messages and triggers those messages when the mobile device discovers the appropriate beacon. The mobile user must enable Bluetooth on the device to implement proximity messages. To implement location/beacon services, pass a YES value for the andlocaitonservices parameter and use ETLocationManager to monitor location and geofence for a user. The app will monitor locations in the same manner for both beacons and geofences. [[ETPush pushmanager] configuresdkwithappid:@ 35a19ebc-50ae-4ed5-9d6c- 404290ada3cd andaccesstoken:@ cghknp9rjrmk9pkf6qh392u3 withanalytics:no, andlocationservices:yes, andcloudpages:no]; [[ETLocationManager locationmanager] startwatchinglocation]; How to Add ios 8 Support for Push in your ios Mobile App You will need to modify your app to function correctly with ios 8. Review the complete list of additional and deprecated calls on the Apple Developer site. Note that you must also use version 3.3.0 or higher for the Journey Builder for Apps SDK and link with static library libetpushsdk-3.3.0-ios8beta.a for testing IOS8 functionality. AppDelegate.m Changes 1. Replace any calls using the code under Previous ios Code to the code under ios 8 Code: 2. Previous ios Code 3. [[ETPush pushmanager] registerforremotenotificationtypes: UIRemoteNotificationTypeAlert UIRemoteNotificationTypeBadge UIRemoteNotificationTypeSound]; 4. ios 8 Code 74

Chapter 8: Engaging with the Customer in the Mobile App 5. // See ETPush.h for reasoning behind this #if logic // IPHONEOS _ DEPLOYMENT _ TARGET = 6.X or 7.X #if IPHONE _ OS _ VERSION _ MIN _ REQUIRED < 80000 #if IPHONE _ OS _ VERSION _ MAX _ ALLOWED >= 80000 // Supports IOS SDK 8.X (i.e. XCode 6.X and up) // are we running on IOS8 and above? if ([[UIApplication sharedapplication] respondstoselector: @selector(registerforremotenotifications)]) { UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsfortypes: UIUserNotificationTypeBadge UIUserNotificationTypeSound UIUserNotificationTypeAlert categories:nil]; [[ETPush pushmanager] registerusernotificationsettings:settings]; [[ETPush pushmanager] registerforremotenotifications]; else { [[ETPush pushmanager] registerforremotenotificationtypes: UIRemoteNotificationTypeAlert UIRemoteNotificationTypeBadge UIRemoteNotificationTypeSound]; #else // Supports IOS SDKs < 8.X (i.e. XCode 5.X or less) [[ETPush pushmanager] registerforremotenotificationtypes: UIRemoteNotificationTypeAlert UIRemoteNotificationTypeBadge UIRemoteNotificationTypeSound]; #endif #else // IPHONEOS _ DEPLOYMENT _ TARGET >= 8.X // Supports IOS SDK 8.X (i.e. XCode 6.X and up) UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsfortypes: UIUserNotificationTypeBadge UIUserNotificationTypeSound UIUserNotificationTypeAlert categories:nil]; [[ETPush pushmanager] registerusernotificationsettings:settings]; [[ETPush pushmanager] registerforremotenotifications]; #endif 75

Chapter 8: Engaging with the Customer in the Mobile App 6. Ensure that you change all Notification types to match existing instances within your code. 7. Add the following code to your AppDelegate.m file. 8. / See ETPush.h for reasoning behind this #if logic // IPHONEOS _ DEPLOYMENT _ TARGET = 6.X or 7.X #if IPHONE _ OS _ VERSION _ MIN _ REQUIRED < 80000 #if IPHONE _ OS _ VERSION _ MAX _ ALLOWED >= 80000 // Supports IOS SDK 8.X (i.e. XCode 6.X and up) - (void)application:(uiapplication *)application didregisterusernotificationsettings: (UIUserNotificationSettings *)notificationsettings { [[ETPush pushmanager] didregisterusernotificationsettings:notificationsettings]; #endif #else // IPHONEOS _ DEPLOYMENT _ TARGET = 8.X // Supports IOS SDK 8.X (i.e. XCode 6.X and up) - (void)application:(uiapplication *)application didregisterusernotificationsettings: (UIUserNotificationSettings *)notificationsettings { [[ETPush pushmanager] didregisterusernotificationsettings:notificationsettings]; #endif 9. Info.plist Changes If you use location services, add a NSLocationAlwaysUsageDescription key (including an appropriate location usage string) to your Info.plist file. Any ios 8 builds will ignore previous references to NSLocationUsageDescription keys due to the NSLocationAlwaysUsageDescription requirement. Android: The Journey Builder for Apps SDK allows you to utilize MobilePush functionality as part of your Android mobile app. This functionality includes the ability to send push messages to mobile devices through the app (based on demographic information or geofence triggers), include CloudPage content in a push message, and collect analytics information based on the results of sent push messages. The integration permits you to more accurately target and communicate with mobile device users via push messages. Follow the instructions below to integrate the Journey Builder for Apps SDK with your Android Mobile App. For a full working example, you can download and install a demo app. View the code for this Demo App from GitHub https://github.com/exacttarget/mobilepushsdk-android 76

Chapter 8: Engaging with the Customer in the Mobile App How to Provision your Android Mobile App Follow the steps below to provision your Andoid mobile app with Google: 1. Download the Journey Builder for Apps SDK from https://github.com/exacttarget/mobilepushsdk- Android 2. Locate the etsdk{version.jar file in the libs folder. You must include this file as a dependency in your Android mobile app. 3. Locate the google play services.jar file in the Public Demo/libs folder. You must include this file in your Android mobile app as well. 4. Review the Android documentation regarding the integration of your Android mobile app with Google Cloud Messaging. 5. Log into the Google Cloud Console. 6. Click Create Project 77

Chapter 8: Engaging with the Customer in the Mobile App 7. Enter a name for your project in the Project name field. 8. Enter an ID for your project in the Project ID field. 9. Click Create. 10. Record the Project Number value supplied by the Google Cloud Console. You will use this value later in your Android application code as the Google Cloud Messaging Sender ID. 11. Click APIs & auth. 12. Set the Google Cloud Messaging for Android switch to ON. 13. Click Credentials. 78

Chapter 8: Engaging with the Customer in the Mobile App 14. Click Create New Key. 15. Click Android Key. 79

Chapter 8: Engaging with the Customer in the Mobile App 16. Retrieve the SHA1 fingerprints of the Android Debug Key for all members fo your team and the SHA1 production keystore certificate hash using a Terminal window (Mac) or command prompt (Windows). 80

Chapter 8: Engaging with the Customer in the Mobile App 17. Paste all retrieved values in the text field. 18. Click Create. 19. Click Create New Key. 81

Chapter 8: Engaging with the Customer in the Mobile App 20. Click Server Key. 21. Ensure you leave this value blank to permit functionality with all IPV4 and IPV6 addresses. 22. Click Create. 23. Copy the API Key value. 24. Send an email to mobilepush@exacttarget.com with the API Key value, your Code@ AppCenter App ID, and the Member Identifcation (MID) number of the ExactTarget Marketing Cloud account with the subject of GCM MobilePush Setup Request. How to Provision Your Amazon Android Mobile App Follow the steps below to provision your Android mobile app with Amazon: 1. Create or log into your account at https://developer.amazon.com. 2. Navigate to the Dashboard tab. 82

Chapter 8: Engaging with the Customer in the Mobile App 3. Click Add a New App. 4. Select Android. 5. Enter the name for the app in the App title field. 6. Enter the correct value in the App SKU field. 7. Select the correct category for your app in the Category drop-down menu. 8. Click Use my default support information to use your default contact information for customer support requests. 9. Enter the email address to use for customer support requests in the Customer support email address field. 10. Enter the phone number to use for customer support requests in the Customer support phone number field. 11. Enter the URL to use for customer support requests in the Customer support website field. 12. Click Save. 13. Click Security Profile. 83

Chapter 8: Engaging with the Customer in the Mobile App 14. Select Create a New Security Profile. 15. Enter a name for the security profile in the Security Profile Name field. 16. Enter a description for the security profile in the Security Profile Description field. 17. Click Save. 18. Click Device Messaging. 19. Click Enable Device Messaging. 84

Chapter 8: Engaging with the Customer in the Mobile App 20. Click View Security Profile. 21. Copy the values in Client ID and Client Secret and mail them to your ExactTarget relationship manager. 85

Chapter 8: Engaging with the Customer in the Mobile App 22. Open a terminal window and copy any MD5 key values for any debug certificates and your production Android signing certificate. 23. Navigate to the Android/Kindle Settings tab. 24. Enter a name for each key in API Key Name. 25. Enter the package name in the Package field. 26. Enter the MD5 signature in the Signature field. 27. Click Generate New Key. 28. Repeat steps 24 through 27 for each MD5 signature obtained in step 22. 86

Chapter 8: Engaging with the Customer in the Mobile App How to Bootstrap the Journey Builder for Apps SDK in your Android Mobile App Before you can Bootstrap the Journey Builder for Apps SDK in your Android Mobile App you must create a production and development app in AppCenter. See How to Create a Production and Development Apps in the AppCenter for details and instructions. Follow the steps below to bootstrap the Journey Builder for Apps SDK in your mobile Android app. These instructions use the Eclipse development IDE. 1. Copy the etsdk-{version.jar into the libs folder for your project. 2. Copy additional dependency jars from the Public Demo project at https://github.com/exacttarget/ MobilePushSDK-Android: jackson required to process JSON communication with ExactTarget ormlite ormlite - required to manage internal sqlite database play-services play-services required to register for Google Cloud Messaging support-v4 required to support notifications on older devices joda Used when displaying and formatting times in the test app (optional) 3. Open the AndroidManifest.xml file for your app. 4. Ensure your uses-sdk minsdkversion is 10 or later. 5. <manifest > <uses-sdk android:minsdkversion= 10 android:targetsdkversion= 19 /> </manifest> 6. If you plan to use Amazon messaging, add the following to the permissions for Amazon messaging. Otherwise, you can skip this step. 7. <!-- ExactTarget permissions for Amazon Device Messaging --> <permission android:name= com.company.myapp.etpush.permission.receive _ ADM _ MESSAGE android:protectionlevel= signature /> <uses-permission android:name= com.company.myapp.permission.receive _ ADM _ MESSAGE /> <uses-permission android:name= com.amazon.device.messaging.permission. RECEIVE /> <!-- END ExactTarget permissions for Amazon Device Messaging --> 87

Chapter 8: Engaging with the Customer in the Mobile App 8. If you plan to use Amazong messaging, add a second copy of the BroadcastReceiver in the manifest. This copy includes different permissions and filters. 9. <!-- ET Broadcast Receiver for handling Amazon/ADM push messages. ADM requires it s own definition for this receiver. You cannot combine this definition with the definition for Google/GCM. You can use the ET _ GenericReceiver directly, or extend it to customize notifications --> <receiver android:name= com.exacttarget.etpushsdk.et _ GenericReceiver android:permission= com.amazon.device.messaging.permission.send > <intent-filter> <action android:name= com.amazon.device.messaging. intent.receive /> <action android:name= com.amazon.device.messaging. intent.registration /> <category android:name= com.company.myapp /> </intent-filter> </receiver> 10. Add permissions required by MobilePush and change the package name to match the package name of the app. 11. <!-- ExactTarget required permissions --> <permission android:name= com.company.myapp.permission.c2d _ MESSAGE android:protectionlevel= signature /> <uses-permission android:name= com.company.myapp.permission.c2d _ MESSAGE /> <uses-permission android:name= com.google.android.c2dm.permission.receive /> <uses-permission android:name= android.permission.internet /> <uses-permission android:name= android.permission.get _ ACCOUNTS /> <uses-permission android:name= android.permission.wake _ LOCK /> <uses-permission android:name= android.permission.access _ NETWORK _ STATE /> <uses-permission android:name= android.permission.vibrate /> <uses-permission android:name= android.permission.write _ EXTERNAL _ STORAGE /> <uses-permission android:name= android.permission.access _ WIFI _ STATE /> <!-- END ExactTarget Required Permissions --> C2D_MESSAGE - Permission to receive Google Cloud Messages RECEIVE - Permission to receive Google Cloud Messages INTERNET - Communicate to ExactTarget servers GET_ACCOUNTS - Google Cloud Messages requires a Google account WAKE_LOCK - Keep the phone from sleeping during the sending or receiving of data ACCESS_NETWORK_STATE - Check connectivity for sending data VIBRATE - Vibrates device for push notification WRITE_EXTERNAL_STORAGE - Used for local database to hold messages ACCESS_WIFI_STATE - Access device WiFi status and behave accordingly 12 Add a BroadCastReceiver to handle push messages sent by Google. The category must match the package name for the app. You can use the ET_GenericReceiver directly for simple requirements. You can also extended the class for use in the manifest for more detailed customization or to customize the Intent launched after a tapped notification. 88

Chapter 8: Engaging with the Customer in the Mobile App 13. <!-- ET Broadcast Receiver for handling push messages. --> <receiver android:name= com.exacttarget.etpushsdk.et _ GenericReceiver android:permission= com.google.android.c2dm.permission.send > <intent-filter> <action android:name= com.google.android.c2dm.intent.receive /> <action android:name= com.google.android.c2dm.intent.registra- TION /> <category android:name= com.company.myapp /> </intent-filter> </receiver> 14. Add a BroadcastReceiver and a Service to your manifest to send phone registration data. 15. <!-- ET Broadcast Receivers for sending data (required) --> <receiver android:name= com.exacttarget.etpushsdk.etsenddatareceiver /> <!-- ET Service handlers for sending data (required) --> <service android:name= com.exacttarget.etpushsdk.etsenddataintentservice /> 16. Modify the oncreate() method to bootstrap the MobilePush SDK: Enter the values for the App ID and the Access Token created in AppCenter. Enter the value for the GCM Sender ID from the Google Cloud Console. public class MyApplication extends Application { private static final String TAG = MyApplication ; @Override public void oncreate() { super.oncreate(); try { //This method sets up the ExactTarget mobile push system ETPush.readyAimFire(this, f2f60bbe-ddbb-4043-b4f7-144c9ddbba54, rqsu6htzqw6yh36rqgcvkmk5, false, false, false); ETPush pushmanager = ETPush.pushManager(); pushmanager.setgcmsenderid( 1072913718575 ); //A good practice is to add the versionname of your app from the manifest as a tag //so you can target specific app versions with a push message later if necessary. String versionname = getpackagemanager(). getpackageinfo(getpackagename(), 0).versionName; pushmanager.addtag(versionname); catch (ETException e) { if (ETPush.getLogLevel() <= Log.ERROR) { Log.e(TAG, e.getmessage(), e); catch (NameNotFoundException e) { Log.e(TAG, e.getmessage(), e); 89

Chapter 8: Engaging with the Customer in the Mobile App 17. Google Cloud Messaging (GCM) requires each app to opt in when a version changes. The SDK handles this opt-in process, so calling enablepush() at the start of your primary activity ensures no mobile device stops receiving messages without an intentional request. 18. try { if (ETPush.pushManager().isPushEnabled()) { // ETPush.pushManager().enablePush() // // Google Cloud Messaging (GCM) requires each app to opt in when a version changes. The SDK handles this opt-in process, so calling enablepush() at the start of your primary activity ensures no mobile device stops receiving messages without an intentional request. ETPush.pushManager().enablePush(); catch (ETException e) { if (ETPush.getLogLevel() <= Log.ERROR) { Log.e(TAG, e.getmessage(), e); 19. When enabling your app for production, ensure that you add this enablement to an option on a preferences page setting or dialog box popup window so that your customer can initially opt in to receive notifications. From that point forward, the above code will ensure the mobile device remains opted in. 20. Send a test message using the app: Wait 15 minutes until after the device first registers to send the test message. The message may arrive after a slight delay. Registration and tracking information generally arrives after a 15 minute delay. How to Implement Analytics in your Mobile App Follow the steps below to implement analytics in your mobile Android app: 1. Set the enableanalytics parameter to true on the call to readyaimfire() in the main Application class on oncreate(). 2. //This method sets up the ExactTarget mobile push system ETPush.readyAimFire(this, f2f60bbe-ddbb-4043-b4f7-144c9ddbba54, rqsu6htzqw6yh36rqgcvkmk5, true, false, false); 3. Add a manifest entry for the OpenReceiver. This entry handles the tapping of a message and ensures analytics logs the event. 90

Chapter 8: Engaging with the Customer in the Mobile App 4. <!-- ET Broadcast Receiver for handling notification taps. Used to capture analytics before handing off to client s Activity --> <receiver android:name= com.exacttarget.etpushsdk.etopenreceiver > <intent-filter> <action android:name= com.exacttarget.message _ OPENED /> </intent-filter> </receiver> 5. Override onpause() and onresume() in each Activity class. 6. @Override protected void onresume() { super.onresume(); try { ETPush.pushManager().activityResumed(this); catch (ETException e) { if (ETPush.getLogLevel() <= Log.ERROR) { Log.e(TAG, e.getmessage(), e); @Override protected void onpause() { super.onpause(); try { ETPush.pushManager().activityPaused(this); catch (ETException e) { if (ETPush.getLogLevel() <= Log.ERROR) { Log.e(TAG, e.getmessage(), e); 7. Add calls to notify the Journey Builder for Apps SDK of the lifecycles for your activity. The Journey Builder for Apps SDK will only assume your app moved to the background 2 seconds after calling activitypaused() without a call to activityresumed(). 91

Chapter 8: Engaging with the Customer in the Mobile App How to Implement Tags in your Mobile App Use the example below as a model for your own code. This example displays a PreferenceActivity where the user can turn push notifications on and off as well as subscribe to various building locations: public class SettingsActivity extends PreferenceActivity implements OnSharedPreferenceChangeListener { private static final String TAG = SettingsActivity ; private SharedPreferences sp; @Override protected void onstop() { super.onstop(); //re-register with ET to send the subscription tags that changed. try { if (ETPush.pushManager().isPushEnabled()) { ETPush.pushManager().enablePush(); catch (ETException e) { if (ETPush.getLogLevel() <= Log.ERROR) { Log.e(TAG, e.getmessage(), e); @Override public void onsharedpreferencechanged(sharedpreferences sharedpreferences, String key) { Log.d(TAG, Preference changed: + key); try { if ( pref _ notify.equals(key)) { boolean pushenabled = sharedpreferences.getboolean(key, true); if (pushenabled) { ETPush.pushManager().enablePush(); else { ETPush.pushManager().disablePush(); else if (key.startswith( pref _ )) { // for other standard prefs, do nothing special here. else { try { // they changed a building subscription, add it as a tag. boolean subscribed = sharedpreferences.getboolean(key, false); if (subscribed) { ETPush.pushManager().addTag(key); else { 92

Chapter 8: Engaging with the Customer in the Mobile App ETPush.pushManager().removeTag(key); catch(throwable e) { Log.e(TAG, e.getmessage(), e); catch (ETException e) { if (ETPush.getLogLevel() <= Log.ERROR) { Log.e(TAG, e.getmessage(), e); How to Implement Attributes in your Mobile App To implement segmentation by attributes, include code to reference attributes in the app. You must define attributes within MobilePush before you can utilize them within the app. try { ETPush.pushManager().addAtributeNamedValue( FavoriteTeam, favoriteteamname); catch (ETException e) { if (ETPush.getLogLevel() <= Log.ERROR) { Log.e(TAG, e.getmessage(), e); How to Implement Message Notifications in your Mobile App You can implement several different custom actions when tapping a push message. Use the examples below as models for your own code. Launch an Activity to Handle the Notifcation Tap Set up a notification recipient activity class that launches when the notification receives a tab. This activity launches with an intent containing the message payload. //MainApplication pushmanager.setnotificationrecipientclass(showdetailsactivity.class); //ShowDetailsActivity @Override protected void onresume() { super.onresume(); Intent intent = getintent(); Bundle payload = intent.getbundleextra( payload ); 93

Chapter 8: Engaging with the Customer in the Mobile App Specify an Action and URI for the Launch Intent When Notification Receives a Tap Ensure that an activty in your ApplicationManifest.xml contains an intent-filter configured to receive the intent: <!--ApplicationManifest.xml --> <activity > <intent-filter> <action android:name= android.intent.action.view /> <data android:mimetype= application/myapp /> </intent-filter> </activity> //MainApplication pushmanager.setnotificationaction( android.intent.action.view ); pushmanager.setnotificationactionuri(uri.parse( application/myapp )); //ShowDetailsActivity @Override protected void onresume() { super.onresume(); Intent intent = getintent(); Bundle payload = intent.getbundleextra( payload ); Implement Full Customization of Intent and PendingIntent Use this method to notify a BroadcastReceiver or a Service when the notification receives a tap. You can also use this method to implement additional control over or add additional data to those Intents. 1. Extend the ET_GenericReceiver class and override its methods. 2. Put your new class into ApplicationManifest.xml in place of ET_GenericReceiver. 3. public class MyAppPushReceiver extends ET _ GenericReceiver { @Override public PendingIntent setuplaunchpendingintent(context context, Intent launchintent) { //get a broadcast pending intent instead of the default Activity PendingIntent pendingintent = PendingIntent.getBroadcast (context, 567, launchintent, 0); return pendingintent; @Override public Intent setuplaunchintent(context context, Bundle payload) { Intent launchintent = new Intent(context, NotificationTappedReceiver.class); launchintent.putextra( iscustomized, true); return launchintent; 94

Chapter 8: Engaging with the Customer in the Mobile App How to Add Audio to your Mobile App Follow the steps below to add audio to your mobile app: 1. Place a file named custom.mp3 in the raw folder of the res directory.: 2. Set a custom flag on the push message. This method plays the mp3 file by default. Otherwise, the push message triggers the default notification for the specific device. You can also allow the end user to customize the sound to play using a preferences page: 1. Use the sample code below as a model to contsruct your preference page: 95

Chapter 8: Engaging with the Customer in the Mobile App 2. <?xml version= 1.0 encoding= utf-8?> <PreferenceScreen xmlns:android= http://schemas.android.com/apk/res/ android > <PreferenceCategory android:title= @string/pref _ notify _ category _ title android:key= pref _ key _ notify _ settings > <CheckBoxPreference android:key= pref _ notify android:title= @string/pref _ notify android:summary= @string/pref _ notify _ summ android:defaultvalue= true /> <CheckBoxPreference android:key= pref _ customize _ ringtone android:title= @string/pref _ customize _ ringtone android:summary= @string/pref _ customize _ ringtone _ summ android:defaultvalue= false /> <RingtonePreference android:dependency= pref _ customize _ ringtone android:key= pref _ notify _ ringtone android:title= @string/pref _ notify _ ringtone android:summary= @string/pref _ notify _ ringtone _ summ android:ringtonetype= notification android:showdefault= true android:showsilent= true /> <CheckBoxPreference android:key= pref _ vibrate android:title= @string/pref _ vibrate android:summary= @string/pref _ vibrate _ summ android:defaultvalue= false /> </PreferenceCategory> </PreferenceScreen> 3. Create a customized Receiver that extends ET_GenericReceiver. 4. Override setupnotificationbuilder() to customize the notification before display 96

Chapter 8: Engaging with the Customer in the Mobile App 5. @Override public Builder setupnotificationbuilder(context context, Bundle payload) { Builder builder = super.setupnotificationbuilder(context, payload); SharedPreferences sp = PreferenceManager.getDefaultShared Preferences(context); boolean customizeringtone = sp.getboolean( pref _ customize _ ringtone, false); if(customizeringtone) { Uri ringtoneuri; String ringtone = sp.getstring( pref _ notify _ ringtone, null); if(ringtone == null) { ringtoneuri = Settings.System.DEFAULT _ NOTIFICATION _ URI; else { ringtoneuri = Uri.parse(ringtone); builder.setsound(ringtoneuri); boolean vibrate = sp.getboolean( pref _ vibrate, false); if(vibrate) { long[] pattern = {0L,500L,100L,1000L; builder.setvibrate(pattern); return builder; How to Implement OpenDirect functionality in your Mobile App The OpenDirect customized push message contains a URL to be opened in a web view. Craft your application to react appropriately when the mobile device receives that type of push message. Ensure that you addcustomopendirectactivity to your Android manifest file. By default, an opendirect message will open the webpage using ETLandingPagePresenter. If you use this method for displaying an opendirect URL, you must add the following to AndroidManifest.xml: <activityandroid:label= Landing Page android:name= com.exact target.etpushsdk.etlandingpagepresenter > </activity> To override what class handles an opendirect message you can call: ETPush.pushManager().setOpenDirectRecipient(CustomOpenDirectActivity. class); 97

Chapter 8: Engaging with the Customer in the Mobile App How to Process Custom Keys in your Mobile App You can use custom keys to send extra data along with the push notification. This data can include an ID value used by the app to retrieve additional data or other function. Access the custom key data via the Activity that opens when a push notification receives a tap: @Override protected void onresume() { super.onresume(); Intent intent = getintent(); //pull the eventid out of the payload that is sent along as a custom key. Bundle payload = intent.getbundleextra( payload ); eventid = payload.getstring( eventid ); // Do something with it here How to Implement Location Capabilities in your Mobile App The Journey Builder for Apps SDK uses location capabilities to store end user location data in the ExactTarget database. You can use this information to target messages to a segmented group of contacts. The app pre-downloads geofence messages and triggers those messages when a mobile device crosses a geofence boundary. You must receive user permission to implement location services. 1. Add the permissions, receivers, and services necessary for location capabilities and geofences in ApplicationManifest.xml. 2. <!-- ExactTarget Permissions for location and region monitoring --> <uses-permission android:name= android.permission.access _ COARSE _ LOCATION /> <uses-permission android:name= android.permission.access _ FINE _ LOCATION /> <uses-permission android:name= android.permission.receive _ BOOT _ COMPLETED /> <!-- END ExactTarget location and region monitoring Permissions --> <!-- ExactTarget Permissions for ibeacons --> <uses-permission android:name= android.permission.bluetooth /> <uses-permission android:name= android.permission.bluetooth _ ADMIN /> <!-- END ExactTarget Permissions for ibeacons --> <application> <!-- ET Broadcast Receivers for handling location updates --> <!-- Get location ourselves --> <receiver android:name = com.exacttarget.etpushsdk.location.receiver. LocationChangedReceiver /> <!-- piggyback and listen in on other apps that request location updates --> <receiver android:name = com.exacttarget.etpushsdk.location.receiver. PassiveLocationChangedReceiver /> <!-- Don t kill their battery using gps if it s low --> 98

Chapter 8: Engaging with the Customer in the Mobile App <receiver android:name = com.exacttarget.etpushsdk.location.receiver. PowerStateChangedReceiver > <intent-filter> <action android:name= android.intent.action.action _ BATTERY _ LOW /> <action android:name= android.intent.action.action _ BATTERY _ OKAY /> </intent-filter> </receiver> <!-- Wake up the app up every so often to get user s location --> <receiver android:name= com.exacttarget.etpushsdk.etlocationtimeout Receiver /> <receiver android:name= com.exacttarget.etpushsdk.etlocationwakeup Receiver /> <receiverandroid:name= com.exacttarget.etpushsdk.etlocation ProviderChangeReceiver > <intent-filter> <actionandroid:name= android.location.providers _ CHANGED /> <categoryandroid:name= android.intent.category.default /> </intent-filter> </receiver> <receiver android:name= com.exacttarget.etpushsdk.etgeofencereceiver /> <!-- figure out where they are if they just turned on their phone ( e.g. plane trip) --> <receiver android:name= com.exacttarget.etpushsdk.location.receiver. BootReceiver > <intent-filter> <action android:name= android.intent.action.boot _ COMPLETED /> </intent-filter> </receiver> <!-- ET Service handlers for handling location updates --> <service android:name= com.exacttarget.etpushsdk.etlocationtimeout Service /> <service android:name= com.exacttarget.etpushsdk.etlocationwakeup Service /> <serviceandroid:name= com.exacttarget.etpushsdk.etlocation ProviderChangeService /> <service android:name= com.exacttarget.etpushsdk.etgeofenceintent Service /> <!-- Service handlers for ibeacons --> <service android:enabled= true android:exported= true android: isolatedprocess= false android:label= ibeacon android:name= com. radiusnetworks.ibeacon.service.ibeaconservice /> <service android:enabled= true android:name= com.radiusnetworks. ibeacon.ibeaconintentprocessor > <meta-data android:name= background android:value= true /> <intent-filter android:priority= 1 > <action android:name= com.company.myapp.did _ RANGING /> <action android:name= com.company.myapp.did _ MONITORING /> </intent-filter> </service> </application> 99

Chapter 8: Engaging with the Customer in the Mobile App 3. Set the second Boolean parameter in the readyaimfire() method in the oncreate() method for your application to True. 4. //This method sets up the ExactTarget mobile push system ETPush.readyAimFire(this, f2f60bbe-ddbb-4043-b4f7-144c9ddbba54, rqsu6htzqw6yh36rqgcvkmk5, true, true, false); 5. Call startwatchinglocation to track a user location and enable the geofence. 6. try { if(!etlocationmanager.locationmanager().iswatchinglocation()) { Log.d(TAG, Geo enabled ); ETLocationManager.locationManager().startWatchingLocation(); catch (ETException e) { if (ETPush.getLogLevel() <= Log.ERROR) { Log.e(TAG, e.getmessage(), e); 7. Call stopwatchinglocation to stop tracking user location and disable the geofence. 8. Run the code below to enable beacons. 9. try { if(!etlocationmanager.locationmanager().iswatchingproximity()) { Log.d(TAG, Beacons enabled ); ETLocationManager.locationManager(). startwatchingproximity(); catch (ETException e) { if (ETPush.get- LogLevel() <= Log.ERROR) { Log.e(TAG, e.getmessage(), e); 10. Call stopwatchingproximity() to turn off beacon messages. How to Implement the EventBus in your Mobile App In the Android SDK, the EventBus provides notifications of events occuring inside the SDK. By setting up your app to register for EventBus callbacks, you can receive error notifications or take custom actions. Any Application, Activity, or Fragment class can register for EventBus callbacks. This section reviews code examples of listening for RegistrationEvent and ServerErrorEvent. In the oncreate() method for your Application, Activity, or Fragment class, add code to register for the EventBus 100

Chapter 8: Engaging with the Customer in the Mobile App @Override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); EventBus.getDefault().register(this); In the ondestroy() method, add code to unregister for the EventBus. Use this code for Activities and Fragments to prevent the EventBus from calling disposed classes and to allow for proper garbage collection. You can omit this code if listening for an Application class because this class does not use an ondestroy() callback. @Override protected void ondestroy() { super.ondestroy(); EventBus.getDefault().unregister(this); Add interfaces for RegisterEvent and ServerErrorEvent to the class. public class HomeActivity extends FragmentActivity implements RegistrationEventListener, ServerErrorEventListener { Implement the Listener interface required methods. These methods will receive a call whenever a RegistrationEvent or ServerErrorEvent occurs. Mark these parameters as final to ensure the callback method does not modify the parameters. @Override public void onevent(final RegistrationEvent registrationevent) { Log.i(TAG, RegistrationEvent: +JSONUtil. objecttojson(rgistrationevent)); Log.i(TAG, Device ID: +registrationevent.getdeviceid()); @Override public void onevent(final ServerErrorEvent servererrorevent) { String errorjson = JSONUtil. objecttojson(servererrorevent); Crashlytics.log(Log.ERROR, TAG, ServerErrorEvent: + errorjson); 101

Chapter 8: Engaging with the Customer in the Mobile App Integrate the Journey Builder for Apps SDK and any additional functionality into your mobile app: Background Push (push content to your mobile app without notifications, such as a subscription to a newsletter) A background push message appears on a mobile app without triggering a visual or audible alert on the mobile device. Examples include subscriptions read inside the ios Newsstand app or updates to messages within an app that do not require notifications. How to Send Background Push Messages Follow the steps below to create and send background push messages: 1. Create an API-triggered MobilePush message. 2. Ensure you set the content-available property to 1. 3. Set the override property to true. 4. Include AMPscript in the messagetext property as a placeholder for the overriden text. For example, you can include the value %%[]%%. Use the sample payload below as a model for your own message: Content-Type: application/json { Override : true, MessageText : %%[]%%, SendTime : 2012-10-31 09:00, content-available :1 Note that you cannot use badge count or sound as part of the message. Once you create the original message, you can pass text to the message using subsequent messages as part of the Override value. Cordova (hybrid apps that rely on Javascript to access native device functionality like cameras or accelerometers) The Cordova plug-in (http://cordova.apache.org/) allows your hybrid app to access native device function using Javascript. Native device functionality includes camera, accelerometers, or other features. Why Use the Cordova Plug-In? You can use the Cordova plug-in along with MobilePush to connect your hybrid apps and push messages to native device functionality. ExactTarget Marketing Cloud supports Cordova version 3.0 and above. 102

Chapter 8: Engaging with the Customer in the Mobile App How to Use the Cordova Plug-In Follow the instructions below to integrate the Cordova plug-in with your MobilePush app: 1. Add the platforms you use in conjunction with the Cordova plug-in: add [ios or Android only at this time] 2. Follow these steps for Android apps: Open the poject in Eclipse. Right-click your project name. Click Android. Click and remove the Cordova library (the jar already exists in the lib folder). This library will not exist in a newly developed project. 3. Follow the appropriate steps in the sections above to provision your apps for mobile push. 4. Create your AppCenter apps (both development and production apps) 5. Install the plug-in into your project using this code sample:cordova plugin add https://github.com/ exacttarget/mobilepushsdk-cordovaplugin 6. Modify the following parameters to the appropriate settings for your app (the presented values represent examples only): --variable DEVAPPID= 427c085f-5358944f2-a8f7-bbc5150c77c5 --variable DEVACCESSTOKEN= yay73bzx6eygw8ypaqr67fvt --variable PRODAPPID= 35a19ebc-50ae-4ed5-9d6c-404290ada3cd --variable PRODACCESSTOKEN= cghknp9rjrmk9pkf6qh392u3 --variable GCMSENDERIDDEV= 5671317166 --variable GCMSENDERIDPROD= 5671317166 --variable USEGEO= true //*could also be false --variable USEANALYTICS= true //*could also be false 7. The final code sample should look like the example below: 8. cordova plugin add https://github.com/exacttarget/mobilepushsdk-cordovaplugin --variable DEVAPPID= 427c085f-5358944f2-a8f7-bbc5150c77c5 --variable DEVACCESSTOKEN= yay73bzx6eygw8ypaqr67fvt --variable PRODAPPID= 35a19ebc-50ae-4ed5-9d6c-404290ada3cd --variable PRODACCESSTOKEN= cghknp9rjrmk9pkf6qh392u3 --variable GCMSENDERIDDEV= 5671317166 --variable GCMSENDERIDPROD= 5671317166 --variable USEGEO= true --variable USEANALYTICS= true 9. Bootstrap the SDK into your platform app: Follow the platform-specific instructions below. If you use cordova platform remove, the plugin will remove any code written in platformspecific files. You will need to copy the files you have out of your project so you can paste them back in upon re-addition. 103

Chapter 8: Engaging with the Customer in the Mobile App How to Bootstrap for ios 1. Open the resources folder and find the info plist file. This name should include your project name in front of it, such as Cordova-info.plist. 2. Open that file and drop down the ETAppSettings. 3. Find the AppDelegate.m file listed under the classes folder in your xcode sidebar. 4. Add #import ETpush. to the top of the file with the rest of the imports. 5. Open it and find the function:- (BOOL)application:(UIApplication*)application didfinishlaunching- WithOptions:(NSDictionary*)launchOption 6. Add the following code to the appdelegate.m file in application:didfinishlaunchignwithoptions: 7. NSBundle* mainbundle = [NSBundle mainbundle]; NSDictionary* ETSettings = [mainbundle objectforinfodictionarykey:@ ETAppSettings ]; BOOL usegeolocation = [[ETSettings objectforkey:@ UseGeofences ] boolvalue]; BOOL useanalytics = [[ETSettings objectforkey:@ UseAnalytics ] boolvalue]; #ifdef DEBUG NSString* devappid = [ETSettings objectforkey:@ ApplicationID-Dev ]; NSString* devaccesstoken = [ETSettings objectforkey:@ AccessToken-Dev ]; //use your debug app id and token you setup in code.exacttarget.com here [[ETPush pushmanager] configuresdkwithappid:devappid andaccesstoken:devaccesstoken, withanalytics:useanalytics, andlocationservices:usegeolocation, andcloudpages:no]; #else NSString* prodappid = [ETSettings objectforkey:@ ApplicationID-Prod ]; NSString* prodaccesstoken = [ETSettings objectforkey:@ AccessToken-Prod ]; //use your production app id and token you setup in code.exacttarget.com here [[ETPush pushmanager] configuresdkwithappid:prodappid andaccesstoken:prodaccesstoken withanalytics:useanalytics andlocationservices:usegeolocation andcloudpages:no]; #endif [[ETPush pushmanager]registerforremotenotificationtypes: UIRemoteNotificationTypeAlert UIRemoteNotificationType Badge UIRemoteNotificationTypeSound]; 104

Chapter 8: Engaging with the Customer in the Mobile App [[ETPush pushmanager] shoulddisplayalertviewifpushreceived:yes]; [[ETPush pushmanager] applicationlaunchedwithoptions: launchoptions]; NSString* token = [[ETPush pushmanager] devicetoken]; NSString* deviceid = [ETPush safedeviceidentifier]; NSLog(@ token %@, token); NSLog(@ Device ID %@, deviceid); if (usegeolocation) { [[ETLocationManager locationmanager] startwatchinglocation]; 8. Add the following function to the appdelegate.m file: 9. - (void)application:(uiapplication *)application didregisterforremotenotificationswithdevicetoken:(nsdata *)devicetoken { [[ETPush pushmanager] registerdevicetoken:devicetoken]; - (void)application:(uiapplication *)application didfailtoregisterforremotenotificationswitherror:(nserror *)error { [[ETPush pushmanager] applicationdidfailtoregisterforremotenotificationswitherror:error]; -(void)application:(uiapplication *)application didreceiveremotenotification:(nsdictionary *)userinfo { [[ETPush pushmanager] handlenotification:userinfo forapplicationstate:application.applicationstate]; NSError *error; NSData *jsondata = [NSJSONSerialization datawithjsonobject:userinfo options:0 error:&error]; if (!jsondata) { NSLog(@ json error: %@, error); else { [ETSdkWrapper.etPlugin notifyofmessage:jsondata]; 10. Replace the following function with the code below in the appdelegate.m file: 105

Chapter 8: Engaging with the Customer in the Mobile App 11. - (void)application:(uiapplication*)application didreceivelocalnotification:(uilocalnotification*)notification { NSError *error; NSData *jsondata = [NSJSONSerialization datawithjsonobject:notification.userinfo options:0 error:&error]; if (!jsondata) { else { NSLog(@ jsn error: %@, error); [ETSdkWrapper.etPlugin notifyofmessage:jsondata]; // re-post ( broadcast ) [[NSNotificationCenter defaultcenter] postnotificationname:cdvlocalnotification object:notification]; How to Bootstrap for Android 1. Enter android in your terminal command line to open the Android SDK Manager. 2. Select Extras under the Google Play Services library. 3. Update the GCM library with the command below: 4. android update lib-project --path path/to/android/sdk/lib/project --target <android api version you want to target> 5. Review a list of the currently installed targets using the android list targets command. 6. Add the code below to the local.properties file for the Android platform. Note that the number following reference must contain a value greater than any current references within your local.properties orproject.properties files. 7. android.library.reference.2=relative/path/from/local.properties/ to/android/sdk/installation/extras/google/google _ play _ services/ libproject/google-play-services _ lib 8. Add the following code to the main activity class as functions (within src/com.package.name/ class.java): 106

Chapter 8: Engaging with the Customer in the Mobile App 9. @Override protected void onresume() { super.onresume(); try { ETPush.pushManager().activityResumed(this); catch (ETException e) { Log.e(TAG, e.getmessage(), e); @Override protected void onpause() { super.onpause(); try { ETPush.pushManager().activityPaused(this); catch (ETException e) { Log.e(TAG, e.getmessage(), e); Note that users automatically manage their own subscription to push notifications using the opt-in switches integrated with the ios and Android platform. When they do so, their device information is added to their contact record, and you can manage additional information about these contacts within Contact Builder (such as importing information to additional data extensions and linking those data extensions to the MobilePush Demographics contact record to personalize your messaging efforts). You can also create your own detailed preference center within the app to capture customer preferences and use that information to refine messages that target specific interests. MobilePush can use custom keys (key/value pairs) to send information to the app, such as tracking codes for analytics software. Developers can also implement custom keys to better tailor the app experience. Because each mobile app includes unique functionality and code, the ExactTarget Marketing Cloud will engage with marketers and developers to enable MobilePush for their apps as part of a service package purchased along with MobilePush. The rest of this section concentrates on creating MobilePush messages designed to engage your customer and assist them on their journey. Creating a MobilePush Message in the ExactTarget Marketing Cloud To assist your subscribers on their journey, this section will help you create two messages: A welcome message sent when their first download your mobile app and opt to receive push messages. A location-based message that automatically triggers when a mobile device enters a specified geographic location (such as the area around one of your stores). 107

Chapter 8: Engaging with the Customer in the Mobile App Welcome Message Take a look at the instructions below to build your welcome message: 1. Log into your ExactTarget Marketing Cloud account and click Mobile. 2. Select MobilePush. 3. Click Create Message. 4. Click Outbound. 5. Enter Welcome Message in the Name field. 6. Select your mobile app in the App dropdown menu. 7. Select Interaction in the Send Method buttons (this method makes your message available to Journey Builder. 8. Select Alert in the Push Method buttons. 9. Enter the text Welcome to our mobile app, and check out our new location! in the Message field. 10. Click Activate. 108

Chapter 8: Engaging with the Customer in the Mobile App Location-Based Message Take a look at the instructions below to build your location-based message: 1. Click Create Message. 2. Enter Drop By in the Name field. 3. Select your mobile app in the App dropdown menu. 4. Select Alert in the Push Method buttons. 5. Enter the text Drop By Our New Location! in the Message field. 6. Click Next. 7. Click Create Location. 8. Type in an address for or drag a pin to the location on the map you wish to use. 9. Click the pin on that location. 10. Click Select. 11. Review the address and longitude and latitude settings. 12. Enter the radius for your geofence in meters in the Geofence Radius field. This setting establishes a circle around your assigned point that marks the area which triggers the push message. 13. Click Submit. 14. Select the location you just created in the Select Locations screen. 109

Chapter 8: Engaging with the Customer in the Mobile App 15. Click Next. 16. Enter the time and date for when you wish to active this message under the Set Push Send Date heading. 17. Select Ongoing for the end date and time. 18. Select the time zone to use for these dates and times in the Time Zone dropdown menu. 19. Click the box next to Limit the total number of messages for mobile device to and enter 1 in the text field. This setting prevents the mobile device from receiving too many messages if your customer moves in and out of the area frequently. 20. Click Activate. While this example demonstrates how you can use location-based messaging when a mobile device enters a geofence, you can also set a message to occur when a mobile device leaves a geofence or encounters a beacon. Integrate your MobilePush messages with Journey Builder Follow the instructions below to integrate your MobilePush welcome message into Journey Builder: 1. Within Journey Builder, navigate to the Timeline Canvas. 2. Click New Interaction. 3. Click Select a Trigger 4. Click MobilePush Opt-In. 5. Click Next. 6. Enter the app name in the Application text field. 7. Click Next. 8. Click Done. From this point, you can create additional push messages (such as a reminder or special offer) and add them to your interaction. 1. Drag a Send Push activity to the appropriate point of the interaction. 2. Hover over the activity and click Configure. 3. Select the push message you wish to use and click Next. 4. Click Done. With these instructions, you can use push messaging to maintain and nuture your customers as they move along their journey. 110

Chapter 8: Engaging with the Customer in the Mobile App API Calls Developers can use the ExactTarget Fuel REST API to create push messages via the Push routes found at http://code.exacttarget.com/apis-sdks/rest-api/v1/routes.html. The available APIs permit developers to perform common tasks like the following: Create and updating push messages Refreshing a list of contacts before sending a push message Retrieving information about sent messages The sample code below demonstrates how to create the welcome message we used earlier in this section via a REST call: POST https://www.exacttargetapis.com/push/v1/message Content-Type: application/json { messagetype : 1, contenttype : 1, name : Welcome Message, application : { id : 237690ac-41ff-4d3f-82f2-9c7efd89185f, name : MyApplication, alert : Welcome to our mobile app, and check out our new location!, sound : default, badge : +1, sendinitiator : 3, messagelimit : 1, tzbased : true, tzpastsendaction : 0, scheduledtzoffset : -4.0, scheduledtzsupportsdst : true ] Once you integrate your mobile app with the ExactTarget Marketing Cloud, you can send highly targeted and relevant push messages to your subscribers based on preference and location-based activities. Use this information to move your subscribers (sometimes literally!) along their journey with your brand. 111

Epilogue: The Future Of Marketing Is Now Throughout this book, we constantly referred to a customer journey and the importance of businesses engaging in every step of the way. Over the years, marketing continually refined from a mass media and one-size-fits-all messaging approach to a personalized 1:1 interaction. Now with Journey Builder For Apps, marketers can take part in the entire mobile, social, and app revolution that fuels our daily lives. Marketers can build touchpoints through the 8 stages of successful customer app journeys. Smartphones are just the beginning. The successful marketer looks forward towards the future. Just like the app revolution, this next wave of the future will place the customer at the center of everything in a more personal way that ever. Connected devices, such as cars that schedule their own services or planes that report engine and fuel consumption will make the rise of smartphones seem slow in comparison. GE refers to the rise of a web of connected devices as the Industrial Internet where every company becomes a software company. The lines of manufacturing and software blur with wearable devices primed to completely erase the boundary as we know it. Wearables (devices which consumers use to monitor fitness, heart rate, and view the world with augmented reality through glasses or armbands which translate muscle movements to unique experiences in virtual space), integrate with the customer journey from the moment customers wake up to the moment they go to bed (and sometimes even while they sleep). Just like the Industrial Revolution enabled the mass production of goods resulting in cheaper merchandise through scale, the Industrial Internet enables businesses to provide better service through the mass collection of information from billions of devices and sensors. Wearables create the personal connection between these devices and the customer. Journey Builder, the ExactTarget Marketing Cloud, and the Salesforce1 Platform represent the platform for creating durable, lasting relationships based on these personal connections. 113

114

Additional Resources Naturally, any static documentation of a rapidly evolving product will by definition always be at least somewhat out of date you can always find the latest version of this tutorial at http://code.exacttarget.com/ getting-started. The following links will also help you as you begin your journey with the ExactTarget Marketing Cloud: ExactTarget Marketing Cloud documentation http://help.exacttarget.com/ Code@ExactTarget (developer documentation and tools) http://code.exacttarget.com App Center (API access and app management) https://appcenter.exacttarget.com Journey Builder http://help.exacttarget.com/en/documentation/journey_builder/ Getting Started with Journey Builder Development http://code.exacttarget.com/app-development/journey-builder-development Fuel REST APIs http://code.exacttarget.com/apis-sdks/rest-api Fuel SOAP APIs http://code.exacttarget.com/apis-sdks/soap-api Fuel SDKs http://code.exacttarget.com/apis-sdks/fuel-sdks Personalization Strings http://help.exacttarget.com/en/documentation/exacttarget/content/personalization_strings Data Extensions and Data Relationships http://help.exacttarget.com/en/documentation/exacttarget/subscribers/data_extensions_ and_data_relationships AMPscript http://help.exacttarget.com/en/documentation/exacttarget/content/ampscript 115

Notes