Beyond Email: Integrating Magento Data with Marketing Automation

Sergey Vlasov
4 min readOct 24, 2023

Probably, everyone knows or has heard about the importance of using marketing automation tools, but never dared to use them, most likely for the following reasons:

  • there is no clear understanding of which tool to use
  • how to integrate this tool into the store. Some services have their own plugins, but some do not. And which plugin best suits my requirements
  • who will do all this
  • how much it will cost

Discover absolute marketing freedom and start experimenting now

We came up with a solution that uses existing Magento features to retrieve data that is added or changed in the database, and that’s email.

Magento email contains not only text but also classes and DataObject that you can use in your workflow:

  • there is a new customer
  • placed/changed order
  • the product is in stock
  • news is published, sales &, etc.
  • other events

The only thing is that we need to send this data to the automation workflow where marketing services are connected.

For example, for all registered customers, after 7 days, an offer to subscribe to the newsletter with discounts will be sent.

it’s a good idea to take advantage of the subscription instead of just ticking a box on the registration form.

Example of n8n workflow, newsletter subscription offer

Another case: sending an order confirmation email and notification in a Slack channel — for staff

Instead of Slack, you can use any messenger:

  • Microsoft Teams
  • Google Chats
  • Telegram
  • WhatsApp
Example of n8n workflow, sending Email/Slack notifications

One more case: Sending SMS/WhatsApp message to all registered customers, the message will be generated by GPT Chat

This solution only requires Magento API and workflow automation such as n8n or Zapier, no additional plugins/modules are required.

Utilizing Magento’s Email-to-Webhook Module for Multi-Channel Automation

We have developed a free, easy-to-install and use module called Email Flow.

Easily integrate your Magento 2 store with workflow automation platforms like n8n, Zapier, and many more using just one module. Send Magento 2 emails as JSON to webhooks and bridge your store to countless services such as MailChimp, SendGrid, HubSpot, ActiveCampaign, CRM systems, and others without needing any additional backend plugins.

Here’s how to harness its power:

  • SMS/Email Marketing: Integrate with platforms like Twilio or SendinBlue. When a customer abandons a cart, trigger an SMS or Email reminder alongside your email campaign.
  • Social Media Retargeting: Send data to platforms like Facebook Ads or Google Ads for retargeting. Show ads to customers who’ve shown interest in specific products.
  • Push Notifications: Integrate with services that offer web or mobile push notifications. Inform customers of sales or restocks instantly.

Instructions for installing and starting to use the module

The module https://github.com/sysintnet/module-email-flow

Use composer — recommended

composer require sysint/module-email-flow

Or download the module

Extract the files to your Magento installation’s app/code directory. Run the following commands:

php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento cache:flush

The module will now be installed and ready for configuration.

Configuration
Navigate to Stores > Configuration > Advanced > System > Email Flow Sending Settings

Email Flow configuration
  1. Enable plugin
  2. Input your webhook URL.
  3. Sending mode. By default, mixed means that emails will be sent by SMTP + FLOW. You’ll be able to set up your workflow and keep sending emails.
  4. Select authentication type: NONE, Base, API (NONE by default)
  5. Debug: Yes/No (No - by default). Here is the log filevar/log/debug.log
  6. Data Optimization Yes/No (Yes - by default)
  7. Save the configuration.

What is data optimization?

Some elements are NULL so it would be best not to send them, but you can send everything if you want, just turn off the data optimization.

  1. Transfer of all data
  2. Transferring only non-NULL data
Example of JSON data: 1 — non optimized, 2 — optimized

Once configured, the module will automatically send emails as JSON payloads to the specified webhook URL in real time. This data can then be used in your preferred workflow automation platform to trigger workflows, save data, and integrate with other services like Mailchimp, Sendgrid, HubSpot & etc.

Debugging

When debugging is enabled, messages can be found in the log file var/log/debug.log Example of the message: [2023-10-20T07:51:34.110881+00:00] .DEBUG: {"message":"Workflow was started"} [] []

Tested across platforms

  1. N8N
  2. Zapier

Compatibility

Magento Open Source/Adobe Commerce Cloud/B2B, versions:

  • 2.4.6–2.4.6-p3
  • 2.4.5–2.4.5-p5
  • 2.4.4–2.4.4-p6

PHP

  • 7.3, 7.4, 8.1, 8.2

Have a question? Please contact me using the form on the site. https://sysint.net/contact-us.html

--

--