Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Automate Everything!

100 views

Published on

Presentation on customising Sitecore Marketing Automation activity types. Presented to Sitecore Symposium 2019, Orlando Florida by Andy Parry.

Published in: Internet
  • Be the first to comment

  • Be the first to like this

Automate Everything!

  1. 1. Presented by: Andy Parry Date: November 6, 2019 Automate everything! Extending your Marketing Automation toolkit with custom actions
  2. 2. © 2001-2019 Sitecore Corporation A/S. Sitecore® and Own the Experience® are registered trademarks of Sitecore Corporation A/S. All other brand names are the property of their respective owners.© 2001-2019 Sitecore Corporation A/S. Sitecore® and Own the Experience® are registered trademarks of Sitecore Corporation A/S. All other brand names are the property of their respective owners. #SitecoreSYM 01 02 03 04 05 06 07 08 Introduction Activity types Custom activity types and Sitecore Building the front end code Building the back end code Deploying to Sitecore Extending with custom predicates and services Debugging and troubleshooting Today’s agenda
  3. 3. © 2001-2019 Sitecore Corporation A/S. Sitecore® and Own the Experience® are registered trademarks of Sitecore Corporation A/S. All other brand names are the property of their respective owners. #SitecoreSYM Introduction Andy Parry Sitecore lead at Insight in Perth, Australia Co-organizer of SUG Perth @handee_andee LinkedIn https://www.linkedin.com/in/andy-parry/ Git https://github.com/parrya/ma-demo
  4. 4. #SitecoreSYM© 2001-2019 Sitecore Corporation A/S. Sitecore® and Own the Experience® are registered trademarks of Sitecore Corporation A/S. All other brand names are the property of their respective owners. So what are we covering today? A technical walkthrough of how to… • Build a custom Activity Type to send SMS - Front-end code - Back-end code • Add it to Sitecore • Deploy it to Marketing Automation • Try it out!
  5. 5. #SitecoreSYM © 2001-2019 Sitecore Corporation A/S. Sitecore® and Own the Experience® are registered trademarks of Sitecore Corporation A/S. All other brand names are the property of their respective owners. Introduced in Sitecore 9 • Replaced “Engagement Plans” in Sitecore 8 • Rebuilt from the ground up for v9 • Angular UI • Super cool Some background on Marketing Automation
  6. 6. © 2001-2019 Sitecore Corporation A/S. Sitecore® and Own the Experience® are registered trademarks of Sitecore Corporation A/S. All other brand names are the property of their respective owners. #SitecoreSYM The Marketing Automation engine
  7. 7. © 2001-2019 Sitecore Corporation A/S. Sitecore® and Own the Experience® are registered trademarks of Sitecore Corporation A/S. All other brand names are the property of their respective owners.#SitecoreSYM Activity Types
  8. 8. #SitecoreSYM © 2001-2019 Sitecore Corporation A/S. Sitecore® and Own the Experience® are registered trademarks of Sitecore Corporation A/S. All other brand names are the property of their respective owners. “Activity Types” in Sitecore are the building blocks of Marketing Automation plans. They act on, or take actions based on, the xDB contact enrolled in the plan. Activity Types
  9. 9. #SitecoreSYM© 2001-2019 Sitecore Corporation A/S. Sitecore® and Own the Experience® are registered trademarks of Sitecore Corporation A/S. All other brand names are the property of their respective owners. Activity Types These are all Activity Types: • Marketing actions • Listeners • Decision point • Campaign entry • Other
  10. 10. #SitecoreSYM© 2001-2019 Sitecore Corporation A/S. Sitecore® and Own the Experience® are registered trademarks of Sitecore Corporation A/S. All other brand names are the property of their respective owners. Some more terminology Currently 4 Activity Type classifications: • Marketing action • Listeners • Decision points • Other elements
  11. 11. #SitecoreSYM © 2001-2019 Sitecore Corporation A/S. Sitecore® and Own the Experience® are registered trademarks of Sitecore Corporation A/S. All other brand names are the property of their respective owners. Some more terminology Activity Type Editor Parameters
  12. 12. #SitecoreSYM © 2001-2019 Sitecore Corporation A/S. Sitecore® and Own the Experience® are registered trademarks of Sitecore Corporation A/S. All other brand names are the property of their respective owners. Some more terminology Activity Type Result Paths
  13. 13. #SitecoreSYM © 2001-2019 Sitecore Corporation A/S. Sitecore® and Own the Experience® are registered trademarks of Sitecore Corporation A/S. All other brand names are the property of their respective owners. Some more terminology Sitecore items • Activity Descriptors • Paths • Parameters
  14. 14. © 2001-2019 Sitecore Corporation A/S. Sitecore® and Own the Experience® are registered trademarks of Sitecore Corporation A/S. All other brand names are the property of their respective owners.#SitecoreSYM Custom Activity Types
  15. 15. #SitecoreSYM © 2001-2019 Sitecore Corporation A/S. Sitecore® and Own the Experience® are registered trademarks of Sitecore Corporation A/S. All other brand names are the property of their respective owners. 1. Editor (Marketing Automation UI) 2. Sitecore items 3. .NET code (runs on the engine) An Activity Type has three parts: Elements of a custom Activity Type
  16. 16. #SitecoreSYM © 2001-2019 Sitecore Corporation A/S. Sitecore® and Own the Experience® are registered trademarks of Sitecore Corporation A/S. All other brand names are the property of their respective owners. Custom Activity Type editor ActivityActivity Editor Angular components: • Activity - Read-only - Describes the step • Activity Editor - Editable component - Edit the step properties • Deployed together as a “plugin”
  17. 17. #SitecoreSYM© 2001-2019 Sitecore Corporation A/S. Sitecore® and Own the Experience® are registered trademarks of Sitecore Corporation A/S. All other brand names are the property of their respective owners. Sitecore Activity Type descriptor Sitecore components • Stored in: /sitecore/system/Settings/ Analytics/Marketing Automation/Activity Types/ Activity Type • Properties • Parameters • Paths • Implementation type • Classification
  18. 18. #SitecoreSYM© 2001-2019 Sitecore Corporation A/S. Sitecore® and Own the Experience® are registered trademarks of Sitecore Corporation A/S. All other brand names are the property of their respective owners. Custom activity type – .NET code .NET components Activity class • Extends IActivity • Accepts parameters • Does the work! • Returns ActivityResult • Moves to next “path”
  19. 19. © 2001-2019 Sitecore Corporation A/S. Sitecore® and Own the Experience® are registered trademarks of Sitecore Corporation A/S. All other brand names are the property of their respective owners.#SitecoreSYM Building the front end with Angular and webpack
  20. 20. #SitecoreSYM © 2001-2019 Sitecore Corporation A/S. Sitecore® and Own the Experience® are registered trademarks of Sitecore Corporation A/S. All other brand names are the property of their respective owners. TypeScript source code • Activity • Editor component • Module (wraps the module) • Plugin (exports deployable plugin artifact) Elements of the front-end code
  21. 21. #SitecoreSYM© 2001-2019 Sitecore Corporation A/S. Sitecore® and Own the Experience® are registered trademarks of Sitecore Corporation A/S. All other brand names are the property of their respective owners. Activity • Describes the appearance of the step in the plan Elements of the front end code
  22. 22. #SitecoreSYM© 2001-2019 Sitecore Corporation A/S. Sitecore® and Own the Experience® are registered trademarks of Sitecore Corporation A/S. All other brand names are the property of their respective owners. Editor • Describes the UI of the editor panel • Handles the passing of parameters Elements of the front end code
  23. 23. #SitecoreSYM© 2001-2019 Sitecore Corporation A/S. Sitecore® and Own the Experience® are registered trademarks of Sitecore Corporation A/S. All other brand names are the property of their respective owners. Module • Wraps the code up into a portable module • This becomes a plugin Elements of the front end code
  24. 24. #SitecoreSYM© 2001-2019 Sitecore Corporation A/S. Sitecore® and Own the Experience® are registered trademarks of Sitecore Corporation A/S. All other brand names are the property of their respective owners. Package.json • Dependencies on Sitecore MA modules @ma-core • Angular package versions • Differences between Sitecore 9.0, 9.1, 9.2 Elements of the front-end code
  25. 25. #SitecoreSYM © 2001-2019 Sitecore Corporation A/S. Sitecore® and Own the Experience® are registered trademarks of Sitecore Corporation A/S. All other brand names are the property of their respective owners. Other project files • tsconfig-aot.json • tsconfig.json • webpack.config.js Elements of the front-end code
  26. 26. #SitecoreSYM© 2001-2019 Sitecore Corporation A/S. Sitecore® and Own the Experience® are registered trademarks of Sitecore Corporation A/S. All other brand names are the property of their respective owners. Build the front end code • npm install • npm run dev • Output artifacts are in /dist • Plugin file to be deployed to Sitecore If you build it….
  27. 27. © 2001-2019 Sitecore Corporation A/S. Sitecore® and Own the Experience® are registered trademarks of Sitecore Corporation A/S. All other brand names are the property of their respective owners.#SitecoreSYM Building the back end with .NET and Sitecore
  28. 28. #SitecoreSYM© 2001-2019 Sitecore Corporation A/S. Sitecore® and Own the Experience® are registered trademarks of Sitecore Corporation A/S. All other brand names are the property of their respective owners. Custom Activity Type – Back-end Custom Activity Class • Interface implementation • Service dependency injection • IActivityServices (Sitecore built-in services) • Parameters • Invoke() method • Activity Result • NuGet packages
  29. 29. #SitecoreSYM © 2001-2019 Sitecore Corporation A/S. Sitecore® and Own the Experience® are registered trademarks of Sitecore Corporation A/S. All other brand names are the property of their respective owners. Custom Activity Type – Back-end SmsService – using Twilio
  30. 30. #SitecoreSYM © 2001-2019 Sitecore Corporation A/S. Sitecore® and Own the Experience® are registered trademarks of Sitecore Corporation A/S. All other brand names are the property of their respective owners. Custom Activity Type – Back-end Service injection in engine XML configs
  31. 31. #SitecoreSYM© 2001-2019 Sitecore Corporation A/S. Sitecore® and Own the Experience® are registered trademarks of Sitecore Corporation A/S. All other brand names are the property of their respective owners. Custom Activity Type – Sitecore items The Activity Type Descriptor in Sitecore:
  32. 32. © 2001-2019 Sitecore Corporation A/S. Sitecore® and Own the Experience® are registered trademarks of Sitecore Corporation A/S. All other brand names are the property of their respective owners.#SitecoreSYM Deployment Pushing the code & configs
  33. 33. #SitecoreSYM © 2001-2019 Sitecore Corporation A/S. Sitecore® and Own the Experience® are registered trademarks of Sitecore Corporation A/S. All other brand names are the property of their respective owners. Deployment – What needs to go where? We need to deploy to: • Marketing Automation Engine • Custom activity DLL • XML configs • App settings (if needed) • Sitecore • Activity Type descriptor (content item) • CM Server • Custom activity DLL • Plugin JavaScript code • Plugin descriptor config
  34. 34. #SitecoreSYM© 2001-2019 Sitecore Corporation A/S. Sitecore® and Own the Experience® are registered trademarks of Sitecore Corporation A/S. All other brand names are the property of their respective owners. Sitecore MA service • Activity Type DLL • XML configs - Service dependency injection - Activity Type definition • AppSettings.config Deployment (continued)
  35. 35. #SitecoreSYM © 2001-2019 Sitecore Corporation A/S. Sitecore® and Own the Experience® are registered trademarks of Sitecore Corporation A/S. All other brand names are the property of their respective owners. Sitecore CM server • Activity editor UI plugin (JavaScript code) /sitecore/shell/client/Applications/MarketingAutomation/plugins/ • Config file for plugin loading /App-Config/Include/Project/MA.Demo.AutomationExtensions.plugins.config • Activity Type DLL /bin • Content (Activity Type descriptor, including Implementation Type*) /sitecore/system/Settings/Analytics/Marketing Automation/Activity Types/Send SMS Message *Don’t forget to set the parameters, path, editor, object type Deployment – What needs to go where?
  36. 36. © 2001-2019 Sitecore Corporation A/S. Sitecore® and Own the Experience® are registered trademarks of Sitecore Corporation A/S. All other brand names are the property of their respective owners.#SitecoreSYM Extending further
  37. 37. #SitecoreSYM © 2001-2019 Sitecore Corporation A/S. Sitecore® and Own the Experience® are registered trademarks of Sitecore Corporation A/S. All other brand names are the property of their respective owners. Extending automation further Where to from here? • Create and use a custom predicate in a conditional • Using the Framework Rules Engine (ICondition) • Inspect custom facets and custom interactions in your predicate • Enroll contacts in a plan with custom events • Explore the Marketing Automation API • Use Paths and Activity Results • Use the Sitecore built in Services via IActivityService • xConnect Client API • Taxonomy Managers, Definition Managers, Reference Data Service Client API • Activity enrollment service, Condition evaluation service • Integrate the Editor UI with Sitecore content items (lookups) • Integrate with line-of-business apps (e.g., Azure Service Bus, other APIs)
  38. 38. © 2001-2019 Sitecore Corporation A/S. Sitecore® and Own the Experience® are registered trademarks of Sitecore Corporation A/S. All other brand names are the property of their respective owners.#SitecoreSYM Troubleshooting Debugging and saving your sanity
  39. 39. © 2001-2019 Sitecore Corporation A/S. Sitecore® and Own the Experience® are registered trademarks of Sitecore Corporation A/S. All other brand names are the property of their respective owners. #SitecoreSYM Debugging and troubleshooting tips • You don’t have access to the Sitecore context! • No access to retrieve items • Use the API’s provided for this • Ensure your activity ID is the same across • Your config patch • Sitecore Activity Descriptor item • Angular package (also lower case) • If using custom facets, you have to include a config so that the Engine knows about them (contact loader) • MA engine won't recycle on XML changes. Need to restart manually
  40. 40. © 2001-2019 Sitecore Corporation A/S. Sitecore® and Own the Experience® are registered trademarks of Sitecore Corporation A/S. All other brand names are the property of their respective owners. #SitecoreSYM Debugging and troubleshooting tips • Logging • Ilogger • Files are separate to the Sitecore logs • In XP Single topology ([EngineRoot]App_DataLogs) • In Azure PaaS scaled (webjobs) • Debugging your code • Attach to the MA engine for local debugging • Azure PaaS: Use the Webjobs dashboard
  41. 41. © 2001-2019 Sitecore Corporation A/S. Sitecore® and Own the Experience® are registered trademarks of Sitecore Corporation A/S. All other brand names are the property of their respective owners. #SitecoreSYM Some key points • The Engine is separate from Sitecore Experience Manager • No Sitecore kernel or Master Database access • Uses the “new” Rules Engine • Use correct Angular package versions (see github) • Easy to extend and integrate Key takeaways
  42. 42. #SitecoreSYM© 2001-2019 Sitecore Corporation A/S. Sitecore® and Own the Experience® are registered trademarks of Sitecore Corporation A/S. All other brand names are the property of their respective owners. Resources • Github sample code: https://github.com/parrya/ma-demo Blogs and videos • https://doc.sitecore.com/developers/92/sitecore -experience-platform/en/activity-types.html • https://www.brimit.com/blog/sitecore-9-custom- marketing-automation-action • https://www.linkedin.com/pulse/how-sitecore-9- marketing-automation-works-deep-dive- emmerzaal/ • https://www.youtube.com/watch?v=0HxUph2YL Zc&list=PL1jJVFm_lGnyicywCcwcWa8RtsoiJEbC9 &index=5 Also, shout out to Alexei Vershalovich for his excellent blog posts. Thanks and questions! Finally {}
  43. 43. Thank you FOR DISCUSSION PURPOSES ONLY. Sitecore Confidential and Proprietary. ©2019 Sitecore Corporation A/S. Sitecore® and Own the Experience® are registered trademarks of Sitecore Corporation A/S. All other brand names are the property of their respective owners.

×