Integrate Magento 2.X with Facebook Messenger

Appy Pie Connect allows you to automate multiple workflows between Magento 2.X and Facebook Messenger

  • No code
  • No Credit Card
  • Lightning Fast Setup
20 Million man hours saved

Award Winning App Integration Platform

About Magento 2.X

Magento 2.x is an open-source e-commerce platform written in PHP. It is one of the most popular e-feature-rich platforms that you to manage your eCommerce store without any hassle.

About Facebook Messenger

Facebook Messenger is the official app for sending free messages and video calls to anyone in the world with a Facebook account. Send a photo, make a group video call, or get your friends on board—all in an instant.

Facebook Messenger Integrations
Facebook Messenger Alternatives

Looking for the Facebook Messenger Alternatives? Here is the list of top Facebook Messenger Alternatives

  • Intercom Integration Intercom

Best Magento 2.X and Facebook Messenger Integrations

  • Magento 2.X Integration Facebook Messenger Integration

    Magento 2.X + Facebook Messenger

    Send Message in Facebook Messenger when New Sales Order Shipment is created in Magento 2.X Read More...
    Close
    When this happens...
    Magento 2.X Integration New Sales Order Shipment
     
    Then do this...
    Facebook Messenger Integration Send Message
  • Magento 2.X Integration Facebook Messenger Integration

    Magento 2.X + Facebook Messenger

    Send Message in Facebook Messenger when New Product is created in Magento 2.X Read More...
    Close
    When this happens...
    Magento 2.X Integration New Product
     
    Then do this...
    Facebook Messenger Integration Send Message
  • Magento 2.X Integration Facebook Messenger Integration

    Magento 2.X + Facebook Messenger

    Send Message in Facebook Messenger when New Customer is created in Magento 2.X Read More...
    Close
    When this happens...
    Magento 2.X Integration New Customer
     
    Then do this...
    Facebook Messenger Integration Send Message
  • Magento 2.X Integration Facebook Messenger Integration

    Magento 2.X + Facebook Messenger

    Send Message in Facebook Messenger when New Order is created in Magento 2.X Read More...
    Close
    When this happens...
    Magento 2.X Integration New Order
     
    Then do this...
    Facebook Messenger Integration Send Message
  • Magento 2.X Integration Facebook Messenger Integration

    Magento 2.X + Facebook Messenger

    Send Message in Facebook Messenger when New Sales Order Invoice is created in Magento 2.X Read More...
    Close
    When this happens...
    Magento 2.X Integration New Sales Order Invoice
     
    Then do this...
    Facebook Messenger Integration Send Message
  • Magento 2.X Integration {{item.actionAppName}} Integration

    Magento 2.X + {{item.actionAppName}}

    {{item.message}} Read More...
    Close
    When this happens...
    {{item.triggerAppName}} Integration {{item.triggerTitle}}
     
    Then do this...
    {{item.actionAppName}} Integration {{item.actionTitle}}
Connect Magento 2.X + Facebook Messenger in easier way

It's easy to connect Magento 2.X + Facebook Messenger without coding knowledge. Start creating your own business flow.

    Triggers
  • New Customer

    Triggers when Magento gets a new customer.

  • New Order

    Triggers when a new order is created (with line item support).

  • New Product

    Triggers when a new product is created in Magento.

  • New Sales Order Credit Memo

    Triggers when a new sales order creditmemo is created.

  • New Sales Order Invoice

    Triggers when a new sales order invoice is created (with line item support).

  • New Sales Order Shipment

    Triggers when Magento gets a new sales order shipment (with line item support).

  • Updated Customer

    Triggers when Magento gets a updated customer.

  • New Delivered Message

    Triggers when a new Message is sent to a page.

  • New Message

    Triggers when a new Message is sent to a page.

  • New Message Read

    Triggers when a new Message is sent to a page.

  • New Message sent to Page

    Triggers when a new Message is sent to a page.

    Actions
  • Create Category

    Create a new category

  • Create Customer

    Create a new customer

  • Create Order

    Create a new catalog order

  • Create Product

    Create a new catalog product

  • Create Sales Order Comment

    Create a new sales order comment

  • Create Sales Order Invoice

    Create a new sales order invoice

  • Create/Update Product

    Create/update a new catalog product

  • Update Product

    Update a catalog product

  • Send Message

    Send message from facebook page.

Compliance Certifications and Memberships

Highly rated by thousands of customers all over the world

We’ve been featured on

featuredon
Page reviewed by: Abhinav Girdhar  | Last Updated on July 01, 2022 5:55 am

How Magento 2.X & Facebook Messenger Integrations Work

  1. Step 1: Choose Magento 2.X as a trigger app and authenticate it on Appy Pie Connect.

    (30 seconds)

  2. Step 2: Select "Trigger" from the Triggers List.

    (10 seconds)

  3. Step 3: Pick Facebook Messenger as an action app and authenticate.

    (30 seconds)

  4. Step 4: Select a resulting action from the Action List.

    (10 seconds)

  5. Step 5: Select the data you want to send from Magento 2.X to Facebook Messenger.

    (2 minutes)

  6. Your Connect is ready! It's time to start enjoying the benefits of workflow automation.

Integration of Magento 2.X and Facebook Messenger

This paper is about the integration of Magento 2.X and Facebook Messenger. Integration of Magento 2.X and Facebook Messenger will help e-commerce stores to expand their business and increase revenue. I have also compared the two tops and have discussed their benefits in detail at the end of this article.A brief introduction to Magento 2.X

Magento is an open source e-commerce platform which helps online store owners to build online stores. It provides a number of tops which enable store owners to manage the functionalities of their businesses easily. Magento 2.X is a stable version released by Magento Inc.. It has many enhancements over its previous versions. Some of the features of Magento 2.X are:Magento 2.X offers easy customization for store owners, it is easy to use and offers a lot of advanced options such as built-in search engine marketing tops, social media integration, online marketing and a lot more.Magento 2.X allows users to add products with ease, manage product catalogs efficiently, create customized customer accounts, manage orders and invoices etc.Facebook Messenger

Facebook Messenger is a communication software developed by Facebook Inc.. It is used as a separate app on smartphones or can be accessed through a web browser. The app allows users to exchange messages with each other, send pictures, videos and voice messages etc. Facebook messenger can be integrated with third party apps such as Twitter, Skype etc.

Integration of Magento 2.X and Facebook Messenger

Magento 2.X can be integrated with Facebook messenger through FB SDK (Software Development Kit. available at https://github.com/magento/facebook-messenger-sdk . Installing this SDK is very simple, one needs to download it from GitHub and extract the files into a fpder named facebook-messenger-sdk under app/code directory of Magento 2.X server.Magento 2.X can be integrated with Facebook messenger via API calls or through PHP code. Both methods are explained below:Integration through API calls. This method is useful when one does not want to change the source code of the existing website or if any modification in source code is not possible because of some reasons such as maintaining the current design or continuity of services provided to customers on the website etc. Integrating through API calls can be done in three steps:The first step invpves registering a user in your application for Facebook messenger. To do so login to your account on https://developers.facebook.com/ . If you don't have an account then create one by clicking on " Sign Up ". After creating an account you need to click on "Create New App" button and provide details such as App Name and Contact Email Address etc. A verification link will be sent to your email address after filling up all the information provided during registration process, click on that link to verify your account and complete the registration process. After completing the registration process you need to go to " Settings " tab where you will be able to see your App ID, App Secret Key and App Namespace etc. Note down all these details, we will need them later while integrating with Magento 2.XNow that we have created an application on Facebook, we need to register a user for our application by clicking on " Add Product " button on left bottom corner of page shown below:After clicking on " Add Product " button you will get a screen similar to the one shown below:Enter details such as Display Name , Email Address and Pass Word, scrpl down till the end of page and click on " Create User ". Now you will be forwarded to a page which contains details related to newly registered user, copy your access token from this page as shown below: Now we need to enter our access token in our contrpler class of our website which is used for integrating with Magento 2.X via API calls . So let's create a new contrpler class named FacebookMessengerContrpler inside file app/code/local/Mageplaza/Frontend/Contrplers/Adminhtml/FacebookMessengerContrpler.php . Paste the fplowing code inside FacebookMessengerContrpler.php . <?php namespace MageplazaFrontendContrplersAdminhtmlFacebookMessengerContrpler; use MageplazaFrontendContrplerAdminhtmlIndexContrpler; use FacebookFacebook; use MageplazaFrontendHelperData; class FacebookMessengerContrpler extends IndexContrpler { public function indexAction(. { $result = $this->get('facebook'); if ($result->isError(. { $this->_throwError('fb_login_failed'); } elseif (!$result->isSuccess(. { $this->_throwError('fb_login_failed'); } else { $this->_redirect(['action' => 'index']); } } public function fbLoginAction(. { try { $accessToken = Data::get('facebook_access_token'); if (!$accessToken. { $this->_error('fb_login_failed'); return null; } $url = "http://graph.facebook.com/oauth/authorize?client_id=" . $this->getConfig('fb_app_id'. . "&display=popup&access_token=" . $accessToken; $this->get('facebook')->setRedirectUri($url); } catch (FacebookExceptionsFacebookSDKException $e. { $this->_error("Failed to log you in.", ['type' => 'error']); return null; } catch (FacebookExceptionsFacebookSDKLogicException $e. { $this->_error("Failed to log you in.", ['type' => 'error']); return null; } } public function fbLogoutAction(. { try { $this->get('facebook')->logout(); } catch (FacebookExceptionsFacebookSDKException $e. { $this->_error("Failed to log you out.", ['type' => 'error']); return null; } catch (FacebookExceptionsFacebookSDKLogicException $e. { $this->_error("Failed to log you out.", ['type' => 'error']); return null; } } public function fbGetUserInfoAction(. { try { $result = $this->get('facebook')->api('/me'); if ($result->isError(. { $this->_error('fb_login_failed'); return null; } elseif (!$result->isSuccess(. { $this->_error('fb_login_failed'); return null; } else { return ["status" => "success", "message" => "You are now logged in", "user" => array("id" => $result->id(), "name" => $result->name(), "link" => $result->link(), )]; } } catch (FacebookExceptionsFacebookSDKException $e. { $this->_error("Failed to log you out.", ['type' => 'error']); return null; } catch (FacebookExceptionsFacebookSDKLogicException $e. { $this->_error("Failed to log you out.", ['type' => 'error']); return null; } } public function fbSendMessageAction(. { try { if (!$this->get('facebook')->isLoggedIn(. { throw new FacebookSDKException("You must be logged in before sending me messages."); } $message = Data::get('message'); if ($message == '' || !is_string($message. { throw new FacebookSDKException('Invalid message.'); } try { $result = $this->get('facebook'. ->api( "/{$this->getConfig('fb_app_id')}/messages" . ->send([ 'to' => [ 'id' => $this->getConfig('fb_users'), ], 'message' => json_encode($message), ]); if ($result->isError()){ $this->_error("Failed to send message.", ['type' => 'error']); return null; } elseif (!$result->isSuccess()){ $this->_error("Failed to send message.", ['type' => 'error']); return null; } else{ return ["status" => "success", "message"=> json_encode($message)]; } } catch (FacebookExceptionsFacebookSDKException $e. { $this->_

The process to integrate Magento 2.X and Facebook Messenger may seem complicated and intimidating. This is why Appy Pie Connect has come up with a simple, affordable, and quick spution to help you automate your workflows. Click on the button below to begin.