Developer Community Triggered Send Scenario
Jen develops software for Northern Trail Outfitters, and her latest project involves working with her team to develop a new ecommerce site. Her tasks include integrating the ecommerce site with the Northern Trail Outfitters account to send the following types of message:
- A welcome email when the customer first creates an account
- Purchase confirmations and receipts
- Opt-in emails for those wishing to receive marketing email
All of the above examples represent transactional emails. Northern Trail Outfitters marketers continues to handle all marketing emails, and they also develop all of the necessary content for transactional emails. Jen handles the API code that calls the correct email message and creates and executes the sending of these transactional emails. She works with .NET/C# code and receives the applicable Marketing Cloud credentials from her supervisor.
Before doing anything else, Jen must successfully connect her development environment to the Marketing Cloud SOAP API. Since she is writing .NET/C# code, Jen connects using Visual Studio and successfully executes a call to retrieve the availability status of the API.
Understanding the Data Model
Now that Jen has successfully connected her development environment, she needs to understand how Marketing Cloud stores the data necessary execute the email sends previously listed. Because this is a new ecommerce site, Jen has the opportunity to work with others involved in implementing Marketing Cloud and decide how they identify individual users and store the applicable information.
At this point, Jen relies on documentation to understand more about the application. She also learns about triggered sends and realizes that these email messages perform the function she has been assigned to implement. The ecommerce site triggers these sends when certain actions take place. She also learns about both subscriber lists and data extensions, as she must understand exactly how Marketing Cloud stores information in order to better design how Northern Trail Outfitters information is stored and processed when sending triggered emails. Jen won't be the only person using this information, but she does have a stake in making the final decision.
Jen also takes the time to familiarize herself with the available API best practices to understand how to best write her code against Marketing Cloud. Because the new ecommerce site relies on email to communicate with customers, Jen decides to make the email address the primary identifier for all customers. She also decides to store this information in data extensions, per the best practice recommendations. Finally, she decides to write her code to take advantage of both the synchronous and asynchronous API calls as recommended by the best practices.
The marketers for Northern Trail Outfitters handle the actual creation of the email content and messages. However, they must provide Jen with the external keys for these email messages so she can retrieve these items into the email send definitions.
Creating and Starting the Triggered Send Definition
Jen discovers that triggered send definitions must be created and then started in order to make them functional within Marketing Cloud. Initially, Jen has to create triggered send definitions for two different interactions:
- A welcome email thanking customers for creating an account with Northern Trail Outfitters
- A confirmation email thanking customers for a purchase
Once she creates those triggered send definitions, she starts them to ensure they can accept incoming calls.
Handling Errors and Exceptions
Jen must also learn how to handle error codes associated with triggered send definitions and the triggered send itself.
For synchronous processing, Jen casts the CreateResult to a TriggeredSendCreateResult to gain access to the SubscriberFailures array.
For asynchronous processing, the ResultMessage object represents the focal point for exception handling. Jen retrieves the ResultMessage for each request using the retrieve method, read from an email attachment or available as a HTTP post variables. The ResultDetailXML property contains a serialized TriggeredSendCreateResult that can be interrogated to get the desired.
Retrieving Triggered Send Definition Information and Tracking
Jen wants to review how her triggered sends are performing, and the marketing department wants to know how customers are interacting with the emails sent as part of the triggered sends. Jen retrieves a tracking send summary to get the information needed and act accordingly.
Scaling the Implementation
After initial testing and implementation, Jen and the team want to expand their efforts to handle increased load and more features.
Creating Email Messages
Jen also recommends creating more email messages and personalizing them to the specific customer. Until this point, the email messages used fixed content to welcome the customer and let them know that the transaction had cleared. Jen recommends that marketing include dynamic content in their email messages to include the following attributes:
- First Name
- Last Name
- Item(s) Purchased
Jen also creates more triggered send definitions to accomodate customers wishing to change their username and password for the ecommerce site. These definitions include HTML email messages that have been created by marketing and sent to Jen for inclusion in the triggered send definition. These HTML email contain references to information in the data extension for use in the email message.
Using the Asynchronous API
In order to ensure that all API calls are properly handled, Jen decides to use the asynchronous API for further development on the ecommerce site. While this does involves rewriting existing functionality, Jen feels the solution scales better using the asynchronous API and allow for better management of her API calls.
Jen also considers building a landing page for the marketers to view the triggered send tracking information she retrieves via the API. She stores this information in a data extension and builds a landing page using AMPscript that returns the tracking information for easy viewing.
- Connect to the API using WCF
- Retrieve the Availability Status of a Marketing Cloud Account
- Data Extensions
- Subscriber Lists
- SOAP API Best Practices
- Retrieve an Email
- Create Triggered Send Definition
- Start Triggered Send Definition
- Error Codes
- CreateResult Object
- TriggeredSendCreateResult Object
- ResultMessage Object
- Retrieve a Triggered Send Summary
- Dynamic Content
- Asynchronous Processing
- Retrieve Rows from a Data Extension Using AMPscript