I publish data from Electron as JSON into particle cloud and I want to set up a web-hook which forwards the JSON to my web server with MySQL where
JSON is parsed if needed
key: value pairs are added to MySQL db
How can I do it? For example, do I need a server side script (eg php) which gets POST message from web-hook, parses the JSON and adds it to MySQL or there is a way to directly post JSON from particle web-hook to MySQL on my server? I have no hands-on experience with such issues so I may be not aware of some obvious things
This isn’t quite what you were asking for, but another option is to use a local node.js server to write to MySQL. No webhook required, and the server can be on a home network with NAT, dynamic IP address, and no firewall rules changes are required. Here’s a sample project for that:
Although @rickkas7 has provided you with a short-cut on the way to your solution, it’s usually well received by the community when you first search for potentially already existing topics that may address your need and if you really haven’t found anything state the fact.
As for the first part of that, this would be a selection of topics that come up with the search terms
I can tell you how I do it. Photon publishes data; webhook forwards the data to a PHP script on my website; PHP script decodes the data, builds the MySQL INSERT statement and executes it. Data now resides in the table.