Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Building Enterprise Integrations using Mautic - MautiCon 2021

Building Enterprise Integrations using Mautic - MautiCon 2021

Being a really flexible tool, Mautic excels at integrating it with various Enterprise systems. Mautic’s integrations bundle helps to build third-party integrations with various applications.

We have discussed the following things in the deck:
• Setup your plugins so you can leverage the integrations bundle.
• Manage authentications
• Build data synchronization with third-party systems
• Implement query builder and filters
• Implement segmentation and points management

E699d3eb01633cd53d59cdd28c1c252d?s=128

Mohit Aghera

June 16, 2021
Tweet

Transcript

  1. Building Enterprise Integrations using Mautic Integrations Bundle

  2. About Me • • • •

  3. Mautic Plugins • •

  4. Integration Framework • • •

  5. Integration Framework • Webhooks • Event Listeners • Filters •

    Definition, Configuration and features • Data Sync • Authentication
  6. Bundle Definition & Configuration Overview of what we are building

    - Simple plugin for “LiveStorm.co Webinar Portal” Setup bundle class Setup Integration class • Define additional attributes like name, icon, display name etc. Setup config file
  7. Key Points for Basic Configuration • • • • •

  8. Bundle Definition & Configuration

  9. Bundle Definition & Configuration Provides information about features of the

    bundle Configuration support. Configuration for the object integration
  10. Config & Sync Support

  11. Scaffolding for Features and Field Mapping Provide form for storing

    keys and secret key Store other configurations depending on requirements Provide field mapping for source and destination
  12. Bundle Definition & Configuration 📦LiveStormBundle ┣ 📂Assets ┃ ┗ 📂img

    ┃ ┗ 📜livestorm.png ┃ ┣ 📂Config ┃ ┗ 📜config.php ┃ ┣ 📂Form ┃ ┗ 📂Type ┃ ┣ 📜ConfigAuthType.php ┃ ┣ 📜ConfigFeaturesType.php ┣ 📂Integration ┃ ┣ 📂Support ┃ ┃ ┣ 📜ConfigSupport.php ┃ ┃ ┗ 📜SyncSupport.php ┃ ┃ ┃ ┣ 📜Config.php ┃ ┗ 📜LiveStormIntegration.php ┃ ┗ 📜LiveStormBundle.php
  13. Authentication Support Options for providing Authentication keys and secret Authentication

    approaches
  14. Various Authentication Methods API Keys Basic Auth OAuth

  15. Parameter API Keys Authentication • Parameter based API Authentication •

    Use “mautic.integrations.auth_provide r.api_key” service. • For Credential, implement ParameterCredentialsInterface class.
  16. Parameter API Keys Authentication • Parameter based API Authentication •

    Use “mautic.integrations.auth_provide r.api_key” service. • Implements ParameterCredentialsInterface class.
  17. Header Based API Authentication • Header Based API Authentication •

    Use “mautic.integrations.auth_provide r.api_key” service. • For Credentials, implement HeaderCredentialsInterface
  18. Header Based API Authentication • Header Based API Authentication •

    Use “mautic.integrations.auth_provide r.api_key” service.
  19. Basic Authentication • Basic Auth uses combination of username and

    password for authentication • Use “mautic.integrations.auth_provide r.basic_auth” service. • Implements CredentialsInterface
  20. Basic Authentication • Basic Auth uses combination of username and

    password for authentication • Use “mautic.integrations.auth_provide r.basic_auth” service. • Implements CredentialsInterface
  21. OAuth2 Authentication Client configuration Integration token persistence Token factory

  22. OAuth2 Two-Legged Authentication • Password Grant • Client Credentials Grant

  23. Authentication 📦LiveStormBundle ┣ Other Files…. ┣ 📂Connection ┃ ┣ 📜ApiConsumer.php

    ┃ ┣ 📜Client.php ┃ ┗ 📜Credentials.php ┃ ┣ 📂Form ┃ ┗ 📂Type ┃ ┣ 📜ConfigAuthType.php ┃ ┣ Other Files… ┃ ┣ 📂Integration ┃ ┣ 📂Support ┃ ┃ ┣ …Other Files…. ┃ ┃ ┃ ┣ 📜Config.php ┃ ┗ 📜LiveStormIntegration.php ┃ ┗ 📜LiveStormBundle.php
  24. Data Synchronization • Define field mapping using MappingManualFactory • Building

    sync report • Executing sync order
  25. Field Mapping • Ensure that fields are specified in the

    configuration • Map Mautic lead fields with API response fields • Define sync direction
  26. Sync Field Mapping 📦LiveStormBundle ┣ ….Other Files….. ┣ 📂Sync ┃

    ┗ 📂Mapping ┃ ┣ 📂Field ┃ ┃ ┣ 📜Field.php ┃ ┃ ┣ 📜FieldRepository.php ┃ ┃ ┗ 📜MappedFieldInfo.php ┃ ┣ 📂Manual ┃ ┃ ┗ 📜MappingManualFactory.php ┃ ┗ 📜ContactFieldMapping.yaml ┃ ┣ 📂Integration ┃ ┣ 📂Support ┃ ┃ ┣ …Other Files…. ┃ ┣ 📜Config.php ┃ ┗ 📜LiveStormIntegration.php ┃ ┗ 📜LiveStormBundle.php • Field Repository • Fields Sync Direction • Field Mapping Factory
  27. Building Sync Report • Define and implement report builder class

    • Identifies objects created and updated between two sync • Typically we use API to fetch data between two duration
  28. Sync Field and Data Exchange • ReportBuilder service • SyncDataExchange

    services 📦LiveStormBundle ┣ ….Other Files….. ┣ 📂Sync ┃ ┣ 📂DataExchange ┃ ┣ 📜ReportBuilder.php ┃ ┣ 📜SyncDataExchange.php ┃ ┗ 📜ValueNormalizer.php ┃ ┃ ┗ 📂Mapping ┃ ┣ 📂Field ┃ ┃ ┣ 📜Field.php ┃ ┃ ┣ 📜FieldRepository.php ┃ ┃ ┗ 📜MappedFieldInfo.php ┃ ┃ ┃ ┣ 📂Manual ┃ ┗ …Other Files… ┣ 📂Integration ┃ ┣ 📂Support ┃ ┃ ┣ 📜….Other Files…. ┗ 📜LiveStormBundle.php
  29. Creating and Using Filters • We need to segment the

    users based on various criteria • Add new filters while creating the segments
  30. Creating Filters • Create EventListeners that listens LIST_FILTERS_CHOICES_O N_GENERATE event.

    • Create another service to map filter and related query builder. It listens SEGMENT_DICTIONARY_ ON_GENERATE event. • Create Query Builder to build and run query. 📦LiveStormBundle ┣ 📂EventListener ┃ ┣ 📜 SegmentFiltersDictionarySubscriber.php ┃ ┗ 📜SegmentEventsFilterSubscriber.php ┃ ┣ 📂Form ┃ ┗ 📜 …Other Directories Files… ┣ 📂Integration ┃ ┣ 📂Support ┃ ┃ ┣ 📜….Other Directories Files…. ┃ ┣ 📂Segment ┃ ┗ 📂Query ┃ ┃ ┗ 📂Filter ┃ ┃ ┃ ┗ 📜EventAttendanceQueryBuilder.php ┃ ┣ 📂Services ┃ ┣ 📜….Other Files….. ┣ 📂Sync ┃ ┣ 📜….Other Files….. ┗ 📜LiveStormBundle.php 3 2 1
  31. Point Actions • Assign points to user based on certain

    interactions • Event Listeners comes to the rescue
  32. Create Point Actions • Subscribe PointEvents::POINT_ON_BUILD • Provide form type

    class to generate options • Trigger event from relevant methods 📦LiveStormBundle ┣ 📂EventListener ┃ ┣ 📜LiveStormRelationshipProcessor.php ┃ ┣ 📜SegmentEventFiltersSubscriber.php ┃ ┣ 📜WebinarAttendancePointsSubscriber.php ┃ ┗ 📜WebinarInteractionPointsSubscriber.php ┃ ┣ 📂Form ┃ ┗ 📂Type ┃ ┃ ┣ 📜ConfigAuthType.php ┃ ┃ ┣ 📜ConfigFeaturesType.php ┃ ┃ ┣ 📜LiveStormEventInteraction.php ┃ ┃ ┗ 📜LiveStormEventAttendance.php ┃ ┣ 📂Segment ┃ ┗ 📂Query ┃ ┃ ┗ 📂Filter ┃ ┃ ┃ ┗ …Other Files… ┃ ┣ 📂Services ┃ ┣ 📜LiveStormAPIHandler.php ┃ ┣ 📜SyncObjectMapping.php ┃ ┗ 📜SyncObjectProcessor.php ┃ ┗ 📜LiveStormBundle.php 1 2 3
  33. Sample Code Repositories • https://github.com/mohit- rocks/LiveStormBundle

  34. Questions??