Magento 2

Integrate Magento 2 to sync users and data with Xtremepush

The Magento 2 Integration enables you to automatically sync Magento 2 data, execute personalised e-commerce marketing campaigns and analyse them.

This guide demonstrates how to integrate and successfully gather data from Magento.

Install the Xtremepush extension in Magento 2

As a first step of the integration, the Xtremepush extension needs to be installed in Magento 2.

πŸ“˜

Technical support required

The Xtremepush extension can be installed via composer. It requires IT Support with SSH access to the server where Magento 2 hosted.

In order to install the Xtremepush extension, four main steps need to be taken:

  1. Log in to your Magento 2 server and navigate to the root directory of your Magento app from your command line tool. This guide shows example outputs for Terminal, but these steps can be modified for any command line tool of your choice.

  2. The module is installed via Composer. First make sure that your existing dependencies are up-to-date:

composer update
  1. Then run this command to add the Xtremepush module to your Magento environment:
composer require xtremepush/magento2-plugin
  1. After the update, you should perform code regeneration and restart the services:
sudo php -d memory_limit=-1 bin/magento setup:upgrade
sudo php -d memory_limit=-1 bin/magento setup:di:compile
sudo php -d memory_limit=-1 bin/magento setup:static-content:deploy -f

After deploying the static content, restart the services.

Create integration in Magento 2

Log in to your Magento account and navigate to System > Integrations > Add New Integration.

Fill in the integration details by entering a descriptive name and password , then navigate to API (under Basic Settings) to assign the relevant level permissions.

πŸ“˜

Permissions required

You will need to grant the following user permissions:

  • System > System Extensions > System Integrations
  • Marketing > Communications > Newsletter Subscribers
  • Sales > Operations > Orders > Actions > View
  • Customers

Click on Save after setting the permissions. At this stage, Magento will generate your Access Token that you will need to use in the Xtremepush platform in order to complete your integration. You can find it under Integration details.

Complete integration in Xtremepush

Once you complete the steps above in Magento 2, open a new tab in your browser and log in to your Xtremepush account. Navigate to Integrations > Marketplace, select the Magento card in the Integrations Marketplace tab and click Connect.

Fill in the Connection and Data Mapping sections to complete the integration.

Connect Magento

In this page, you need to enter basic settings and connection details.

Basic settings

Give your connection a Name that helps you easily identify it.

Connection settings

  • Access Token: Found in Magento by navigating to System > Integrations > Xtremepush integration in a section called Access Token.
  • Shop URL: Such as https://my-shop.com/.

After completing the connection details, click the Fetch Magento Attributes button. It will automatically bring a data mapping section for attributes once the integration credentials get confirmed.

Data mapping

This section lists your automatically mapped system attributes. It allows you to select which standard attribute you want to import. You can also map your Magento custom attributes to your custom attributes in Xtremepush.

Xtremepush's system attributes such as user_id and email will be automatically mapped to Magento id and email attributes (listed in the Column fields).

You can set Magento's standard attributes to Import or Don't Import under the Map to fields. If you select Import, these will be automatically created in Xtremepush.

Finally, you will also see Magento's custom attributes (listed in the Column fields) such as gender , default_billing and default_shipping. You can map these attributes to your predefined Xtremepush custom attributes.

πŸ“˜

Creating attributes

System attributes and standard attributes are automatically created on Xtremepush. However, in order to map custom attributes you need to create these attributes on the Xtremepush first. Review our Attributes & tags guide to see how to do so.

πŸ‘

Email subscription data

In order to gather email subscription data, you need to map Magento's is_subscribed attribute to Xtremepush's email_subscription attribute.

Once you've completed the data mapping, click Connect to complete the integration.

Subscribe to webhooks

Once you complete the steps above in Xtremepush, from your Magento dashboard, navigate to Xtremepush > Settings > General, check your integration settings and then enable the integration.

After successfully enabling your integration, navigate to General > Webhooks and enable webhooks to fetch realtime events from Magento into Xtremepush. You can enable checkout (quotes), customer, and order related events. When you enable a webhook, you will be able to use its events in your campaigns as they will be automatically created as a custom events on the Xtremepush platform when that event is triggered from Magento.

These events can be used when you create event triggered campaigns. You can also use them within segmentation, for example for check-out abandonment or welcome emails for first time buyers.

πŸ“˜

Events will use their naming from Magento 2. For example;customer/order/created, customer/quote/updated, customer/customer/registered etc. You can check available event naming from this page.

Once you have selected the required webhooks, click Save Config. Once the connections are made and confirmed, your Magento integration will be listed under the Configured Integrations tab within the Marketplace and you are presented with the Integration Details page.

Finally, in order to start the synchronisation, click the Actions drop-down menu and select Sync. Your options will be Full sync, Sync profiles and Sync purchases. A full sync includes synchronisation of users (which will be created in Xtremepush) and purchase data. Once complete, each profile attribute is displayed along with a timestamp and status of Completed. If there is any other status, click the More menu and choose Details for extended information.

πŸ“˜

Purchase data synchronization

Once you synchronise purchase data, you do not need to sync this data again. The system automatically updates purchase data based on received order details from real-time events.

Review the integration

Navigate to Settings > Integrations > Marketplace > Configured integrations and click on Magento to review the integration details (Overview). The Information section shows the token and endpoint. This information is automatically passed to Magento but also can be confirmed from this page for security headlines. The Sync History section provides an overview of the sync history with Magento.

Update or delete an existing connection

Select the integration you want to update at Settings > Integrations > Marketplace > Configured Integrations. Go to the Settings tab and update any necessary setting, click Save to confirm. If you need to delete or deactivate the connection, click on the Actions button. You will be presented with the option to either Deactivate or Delete the integration. Clicking either of them opens a confirmation dialog.