Successfully reported this slideshow.

Automate Everything!

0

Share

Loading in …3
×
1 of 43
1 of 43

More Related Content

Related Books

Free with a 30 day trial from Scribd

See all

Related Audiobooks

Free with a 30 day trial from Scribd

See all

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.

Editor's Notes

  • Hands up if you have played with the Martketing Automation editor in Sitecore
    And hands up if you’ve built an actual MA plan in production ?
  • I’ve been working with Marketing Automation for much of this year, found it fascinating and kinda fun.
    Lots to learn but very satisfying when it all comes together and seeing the end users put the plans into action.
  • Front end code is Angular. Back end is C#.
    Add to Sitecore via the Sitecore Content Management interface
    Deploy all the necessary pieces (there are a few!)
  • But first a quick bit of background on Marketing Automation
    Engagement plans were kinda clunky and were part of CM
    The new MA UI is MUCH nicer and more intuitive
  • Engine is separate from XM (Experience Manager) and is part of Experience Platform
    Separate process
    Can run as:
    Windows Service
    Console App
    Azure WebJob
  • So, what is an Activity Type ?
    - it’s an element in a Marketing Automation plan that performs an action based on xDB contact data
  • Most people think of Marketing Actions when they hear the phrase “custom activity types” but all of these are Activity Types.
  • There’s a corresponding Sitecore item in the tree for each of these.
    They are themed by colour.
    You could create your own custom Activity Type Classification, however there would be some CSS and HTML requirements.
  • Editor is the entire pane
    Parameters are passed back and forth from UI to Sitecore/.NET code
  • Can branch into what are called “Paths” based on decisions made in the Activity TYpe
  • So now we know what an Activity Type is and the pieces that make up an Automation Plan, how do we create our own ?
  • Ok so let’s get into the tricky bit – front end dev.
  • On screen walkthrough of files
  • On screen walkthrough of files
  • On screen walkthrough of files
  • On screen walkthrough of files
  • tsconfig.json is the TypeScript compiler config
    tsconfig-aot.json is the configuration for our Angular compilation.
    AOT is Ahead of Time compilation
    There is a “files” section and a “genDir” which tells the AOT compiler what to compile and where to put the object code
    Webpack bundles up our modules.
  • Watch out for read-only folders
  • Switch to code
    Properties MUST be public for parameters to be passed from the editor
    Note the return type
    Nuget packages Sitecore.Xdb.MarketingAutomation.Core
    Facets
  • Using appSettings (in Engineroot\AppSettings folder
  • This is a bit fiddly. Best to set up some special deployment pipelines or some scripts to ensure everything is in the right place.
    Because if it isn’t, you will find out pretty quickly!
  • (Discuss and show the various pieces that need to be deployed and where)
  • (Discuss and show the various pieces that need to be deployed and where)
  • (Discuss and show the various pieces that need to be deployed and where)
  • If time permits, look at a custom predicate in the solution
  • ×