Installing the Firebase Plugin for Mobile App Push Notification

How incredible would it be if the AMS could send Push Notifications to your app?  Well yes you can do this with OneSignal, however not everyone is using OneSignal and we have found that many of our customers are using Firebase.

So there is a company that has released a plugin, and as always I rushed out to get it.

The plugin can be purchased from here.

The main problem is that the plugin is not that simple to install if you are a Mautic newbie or not very technical.  I went through many different iterations and frustrations before I got it up and running.

And today I am going to document the steps that are needed in order to getting it functional.  In the next blog post we will dive deeper into the configuration and workings of the module.

Installation Instructions:

1. Download the plugin

2. Save the plugin in your working directory.

3. I created a directory called Firebase as I wanted to see what was inside the zip.

4. Create a directory inside your mautic plugins folder called “FCMNotificationBundle”:
sudo mkdir /var/www/mautic/plugins/FCMNotificationBundle

5. Copy the contents of the Firebase directory to the new plugin directory:
sudo cp * /var/www/mautic/plugins/FCMNotificationBundle

6. Change the permissions on this directory to your web user, in my case it was:
sudo chown -R www-data:www-data /var/www/mautic/plugins/FCMNotificationBundle

7. This plugin requires an external php extension called bolt.  You can download it from here.

8. The way I like to do this is I made a directory called BOLT in my working directory and from there ran the command:
sudo wget https://phpbolt.com/wp-content/uploads/2020/11/phpBolt-extension-1.0.2.zip

9. Unzip this file:
sudo unzip phpBolt-extension-1.0.2.zip

10. Once you do this it will make a new folder with all the different versions of bolt that are relevant for your server.

11. You now need to understand what ubuntu version you are running, if it is 34 bit or 64 bit.  In order to find this out type in the following command:
getconf LONG_BIT
You will get output of either 32 or 64.

12. You then need to find out what version of php you are running.  There are many ways to find this out, if you are not that technical simply go into your Mautic and click on the Settings Cog in the top right part of your screen and choose “System Info”, Then “Php Info” and you will see this screen:


In the above you can see that I am running php-7.3

13. Now you need to go back to your bolt directory and choose the correct version of bolt to install.  Below you will see the commands I did and the subdirectories in order to find the correct one for you. [Remember I am running on a linux 64 Bit with php-7.3]

14. Next we need to put the bolt.so file in a place that the system can find it.  
Look again in your PHP info page inside Mautic System and find the name of the PHP Extension directory, it will be something like 20190902.

15. Next I copied the bolt.so file to that directory:
sudo cp bolt.so /usr/lib/php/20190902/

16. Now we need to tell php where to find this file.  So in order to do so we need to edit our php.ini file.  As you can see from the first picture above inside the php info screen we look at, we can see that the php.ini file that Mautic is using is located in /etc/php/7.3/fpm/php.ini
You also need to update 
/etc/php/7.3/cli/php.ini

17. I always like to make a backup of files I am editing, so i did the following:
sudo cd /etc/php/7.3/fpm/
sudo cp php.ini php.ini.bak

18. Now you need to go and edit the files.  You can use either nano or vim, whatever is easier for you.  Open the file and search for the word “extension”. You need to look for the section that begins with Dynamic Extensions

19. Next scroll to the bottom of that section and add in a line:
extension=/usr/lib/php/20190902/bolt.so

20. Now you need to restart the php-fpm service in order for it to re-read the php.ini file:
sudo systemctl restart php7.3-fpm

21. At this stage I suggest going back to Mautic and refreshing the System Info window and searching for the word bolt.  You should see something like this:

22. Next thing is you need to make sure you have composer installed, if you do not you can follow the instructions here.

23. Now we need to run composer to get the plugins dependancies installed.  To do this go to your mautic directory:
sudo cd /var/www/mautic/
sudo -u www-data composer require plokko/firebase-php

The above way is recommended by the developers who released this, however for me it did not work and I had to use this composer.json file (which is configured for php7.4) and then I had to move the vendor file in the mautic directory to vendor_old and then sun composer install.

24. Some Issues that might come up

25. You might have installed version 2 of composer and if so you will get the following error

26. If this is the case you will need to downgrade your version of composer.  In order to do so run the following command:
sudo composer self-update –1

27. Once this is done you can go back to point #23 and rerun composer.

28. The last thing to do it to clear mautic cache:
cd /var/www/mautic/var/cache/
sudo rm -rf *

29. No go back to Mautic and click on Settings-> Plugins and you should see the new plugin installed and ready to be configured there.

Mautic-Firebase-Plugin

Stay tuned for the next blog on how to configure the plugin and put it to the test!!

Installing the Firebase Plugin for Mobile App Push Notification

How incredible would it be if the AMS could send Push Notifications to your app?  Well yes you can do this with OneSignal, however not everyone is using OneSignal and we have found that many of our customers are using Firebase. So there is a company that has released...

I sent an email and made a sale!

This is a sentence I am always surprised to hear from our clients.  So many people are under the impression that e-mails don't work anymore.  People are focused on social platforms, text messages and whatsapp. We meet so many clients that have legacy data that they...

Using Campaigns to Manage Sales Follow Up Cycle

In continuation from our previous post on "Using Campaigns to Improve Sales Cycle" we now move into using Mautic campaigns to help the sales team follow up with leads that come in. Firstly we consulted with our clients on their needs, and in a very general case what...

Using Campaigns to Improve Sales Cycle

The AMS has many hidden features that can be used in conjunction to improve your overall sales cycle. At Surge we have used advanced campaigns and logic to help increase a business overall sales cycle and to boost conversion rates. How did we do this ? We started off...

E-Mail Frequency – Is Too Little Too Much or Vice-a-Versa

What a question to ask ? Probably the most debated question among marketeers throughout time (or at least since email was around). Everyone has their own opinion, and each opinion is valid and correct. There is no real right or wrong answer over here. At Surge we...

Unique Discount Code Distribution System

Challenge There is an inherent challenge when working with mautic and setting up unique discount codes. There are many instances where you might want to distribute a unique one time discount code. We have found this necessary in a few instances for example: Signup to...

Trigger Email on New WooCommerce Order

With the AMS you have the ability to move away from the standard emails being sent out from WooCommerce.  This presents a great way to have nicer order notifications and better tracking using the AMS. Today we will focus on how this can work using MakeWebBetter Mautic...

Updating Mautic WhiteLabeler to correct version

Often when there is a new release of Mautic, those of us using Mautic Whitelabeller have the frustration that it is not compatible with the current version. Here are the steps to correct this: Unzip the file, then go and edit the file compare.php

SSL Issues with www and non-www records

I have used certbot LetsEncrypt for hundreds of sites and usually I go ahead and set up the certifications without a problem and everything works well. Well this was the case until we came to a launch of a pretty big client, it was late at night and I set up the...

Update Mautic 2.15.3 -> 2.16.3

I just went through a nightmare of an upgrade from an old mautic instance 2.15.3 to 2.16.3 and came accross a number of problems along the way that maybe helpful to someone some day. So as follows: Started upgrade via GUI - it just hung Went for command line upgrade...