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

Mohit Aghera

June 16, 2021
Tweet

More Decks by Mohit Aghera

Other Decks in Technology

Transcript

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

    Definition, Configuration and features • Data Sync • Authentication
  2. 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
  3. Bundle Definition & Configuration Provides information about features of the

    bundle Configuration support. Configuration for the object integration
  4. 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
  5. 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
  6. Parameter API Keys Authentication • Parameter based API Authentication •

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

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

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

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

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

    password for authentication • Use “mautic.integrations.auth_provide r.basic_auth” service. • Implements CredentialsInterface
  12. 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
  13. Field Mapping • Ensure that fields are specified in the

    configuration • Map Mautic lead fields with API response fields • Define sync direction
  14. 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
  15. 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
  16. 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
  17. Creating and Using Filters • We need to segment the

    users based on various criteria • Add new filters while creating the segments
  18. 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
  19. Point Actions • Assign points to user based on certain

    interactions • Event Listeners comes to the rescue
  20. 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