Push Notification from Firebase using MySQL - mysql

My app is sending in-app notifications. using MySQL Tables and listener. but I want to use Push Notification from Firebase. my DB is MySQL.
I want to send a new order notification as soon as an order is created in the MySQL table.
so order gets created in MySQL, if order created successfully, create the record in firebase.
firebase sends a notification to pizza stores within a 1km radius of our customer.
Can anyone confirm this is possible.??
Is firebase capable of doing this???
Backend API coding is in Laravel.

Yes, it's possible! You can use Firebase Functions.
Whenever a record is created in your MYSQL, you can create a record of it in Firestore (see Firesore API) and with Cloud functions Firestore triggers (see Firestore Triggers), you may write whatever logic you need (sending notification to a specific audience in you case) when a firestore record is created/updated/deleted.
Note: Firebase functions use JavaScript and TypeScript.

Related

How do I integrate HubSpot data into a MySQL database automatically?

I have a HubSpot account where my team updates my customers' details in three sheets such as Contacts, activities etc. Now I want to integrate the data available in these sheets to my MySQL database.
I want the changes done in the HubSpot sheets to be automatically transferred to my MySQL database.
Is there any way to do so?
Unfortunately, there is no any direct connector between HubSpot and MySQL out of the box. You have to create all the relevant tables yourself in your MySQL database and then populate them with the desired data via HubSpot APIs, for instance, use https://legacydocs.hubspot.com/docs/methods/lists/get_lists to retrieve all contact lists.
Alternatively, you can look at some commercial solutions such as Zapier, Skyvia, Hull etc.
For example, configuration of a Zapier connector is straight forward:
Sign up for free here, it will give you a chance to explore Zapier features within 2 weeks;
Authenticate MySQL in Zapier -> MyApps -> Connect a new account (select MySQL) to allow Zapier to access your MySQL account;
Authenticate HubSpot similar to the above step for MySQL;
Pick up HubSpot app as a trigger to kick off your data sync, for example, "Contact Recently Created or Updated";
Choose a resulting action from the MySQL app, for example, "Update Row";
Select the data you want to send from HubSpot to MySQL;
That is all, enjoy!
You can trial Zapier for 2 weeks, it should be enough to validate the integration aspect before signing up for a certain commercial plan; once logged in to Zapier you can see all available plans here.
Sequin recently launched a HubSpot/Postgres integration along the lines you're describing. There's a technical writeup describing how it works, which should be cross-applicable to MySQL.
The API strategy:
Use list endpoints to establish a base state in SQL.
Use /search endpoints and a stored cursor: fetch new changes and apply them to the base state.
I wrote a longer post on why we don't use the Webhooks API for this.

How to create Flutter chat app with PHP Mysql rest api?

I want to create a chat app in Flutter but all chat data need to store on my server Mysql via PHP API as backend. (I do not want Firebase Firestore or Realtime database)
As many people create chat app on the web via the help of JavaScript, jQuery & Ajax but I don't know how I will use this on Flutter.
You can create your database with MySQL, and your backend API with php. For the backend you can use SLIM or Laravel or any other php framework. Then in your flutter code you will need to make http requests to this API.
A problem that you can face is Realtime because streams in flutter do not make the data retrieval realtime from a php API. To solve this you will need to add a timer that periodically refreshes the chat. A better solution is to use sockets to make the chat realtime. You can also use firebase cloud messaging for notifications which is free of charge.
This might be useful for you:
https://www.youtube.com/watch?v=6vOIk2-WoxQ&list=PL_5DleQzXnX4GRhKef32CiSs2oBfTVxe3

Is it possible for firebase to update itself?

I need to provide every user with data from different sites. Each of the site provides data in JSON format, but some of them have restriction to maximal number of request.
My idea for solution is to download the data to firebase periodically, than users will access just the firebase database.
From docs it seems to me that firebase can somehow use http requests.
Can I use firebase to periodically update itself by http request?
Or should I establish server which will do the task?
I am pretty new to those topics so any tip where to look for information will be appreciated.

How to send back data to a server in a PWA website

I've searched and I can only find tutorials to pull info from a server to update the latest info of my PWA app using JSON. But I can't find any way and any example to fetch data back to a server to mantain for instance a Database updated and display that to all users which may use that PWA.
For example, I have a PWA that let me login (client-server communication), then it displays a list of contacts that were stored in a Database. I can delete, modify or add new users to this list from my PWA app, and after doing that, they'll update on my server Database, so if my friend Paul, wants to check the updated list from his account, he'll see the new changes.
How Can I do that? Which language would I have to use, php and Javascript (Ajax)? Which is the most fluid and optimized way to do it according to a Progressive Web App.
I guess you are trying to store user changes back to the server(webservice and then to the data base).
You have to make an AJAX call to your web service and pass the required data needed to store in DB.
Here is an example.
https://www.w3schools.com/xml/xml_http.asp
Depending on the framework you are using, you might have more options to call a web service. Like here is an example for Angular -> https://www.w3schools.com/angular/angular_http.asp

Securely registering a new Wordpress user with a custom Zapier action (via JSON API?)

I want to use Zapier to register a new Wordpress user — the trigger will be a new purchase on Gumroad.
This plugin — https://wordpress.org/plugins/json-api-user/ — allows you to register users using a public JSON interface, eg by hitting
https://example.com/api/user/register/?username={{email}}&email={{email}}&nonce=blahblahblah
I'm new to all this, but know that I can get Zapier to insert the purchaser's email from Gumroad into {{email}}.
My question is, how can I do this in a secure way?
(At the moment anyone can hit example.com.com/api/get_nonce/?controller=user&method=register and get the key they need)
And maybe it can even be done without using Zapier?
I'm assuming that the nonce is only good for a short period of time, like a couple minutes? If so, what you want to do is lock down the /api/get_nonce/ endpoint to require a password. That way only authenticated users can get a nonce, which can then be used to create the user.
As for how Zapier fits in, it's a bit complicated to custom build a two-request process like this. You would have to make your own app on the Developer Platform do the nonce call and then the user creation.
I use the following plugin to create users (via Zapier) on my WordPress sites after someone signed up on my Teachable school: WP Webhooks Pro
This plugin allows me to either POST the data to my WordPress site via JSON, XML or a simple form data. In my case, I don't need a nonce, since the plugin generates API keys that I can use to push my data to.