How to integrate MQTT and Apps Script? - google-apps-script

I've got a device that communicate via MQTT.
My device have a MQTT server:
Host: node02.myqtthub.com:1883
Client ID: name****
user: *****
pass: ****
Subscribe Topic: GETTO/304470****tx
Publish Topic: GETTO/304470****rx
For example with MQTTBox software in Windows if I Publish Payload "$ST" it return: "$SA,277,1,1,105,280,0,0,0000,000,180,05.2,2".
I want to have this line "$SA,277,1,1,105,280,0,0,0000,000,180,05.2,2" on my Google Sheet's cell.
Is possible to integrate it with App Script?

Is possible to integrate it with App Script?
Yes it is possible, but it will depend on whether your MQTT broker (which you've shown as myqtthub.com) allows you to create a webhook, which will be needed to forward your messages when received (usually as JSON payload) to the Google Apps Script server via http(s) using your custom Apps Script URL.
Here is an online example: https://docs.emqx.com/en/cloud/latest/rule_engine/rule_engine_web_hook.html

Related

Do I have to call Firebase Remote Config API from the Cloud Function?

I have some params in Remote Config that I want to update from the Google Cloud Functions.
Should I use the Remote Config API when both Cloud Functions and Remote Config belong to the same account or project?
I am asking because Cloud Functions can directly import the data from Firestore without any authentication and API.
Remote Config provided the RESTful APIs to update the parameters or template.
You don't have to call them from a Google Cloud function. But calling them from a Google Cloud function or even Firebase Cloud function is definitely workable.
You can even call the RESTful APIs from postman or some other tools once you set up the call properly.
Check more details here: https://firebase.google.com/docs/reference/remote-config/rest
With Remote Config backend APIs, you could use Remote Config with Cloud Functions for Firebase, changing values in your app based on events that happen server-side. For example, you can use Remote Config to promote a new feature in your app, and then turn off that promotion automatically once you detect enough people have interacted with the new feature.
Using the Remote Config REST API or the Admin SDKs described in this guide, you can bypass managing the template in the Firebase console to directly integrate Remote Config changes into your own processes.
As described here, Cloud Functions can be triggered in response to changes in Firebase Remote Config in the same Cloud project as the function. This makes it possible to change the behavior and appearance of your app without publishing an app update.

Automatize Google Drive API connection with Mule 4

I'm using Mule 4 and I want to do automatic application which gets data from google drive server when an HTTP request arrives.
I'm having trouble when I'm trying to connect to Google Drive API automatically when a requests arrives, is there some way to authenticate just 1 time to access to Google Drive API, and then, got a persistent OAuth 2.0 code which allows you to connect for life with it? Otherwise, any URL to get a code with no interaction once HTTP request arrives?
You can use the Mule Google Drive Connector to automate the operations.

What App server to use for json and soap API

I am trying to select a app server platform to service JOSN & Soap POST requests from client app on Desktops. The app server runs on linux and use PHP code.
I searched and found PHP framework but that doesn't give you easy to use auth user/password, so you have to do the auth in app code. What is to use for simple request/response app server with secure auth like user/password on first request and then token like normal web servers.
Currently using Drupal 7 REST services module to handle request auth, but SOAP has security issues. Looking for better and light weight framework.
For your API : https://www.drupal.org/project/jsonapi (it's gonna be implemented in 8.7 anymay)
If you have an external authentication provider (like keycloak, azureAD…) : https://www.drupal.org/project/oauth2_jwt_sso
If you don't : https://www.drupal.org/project/simple_oauth

Google Compute instance receiving email

I'm looking to run a mail server on a Google Compute Engine instance, and have discovered Google's blockage of port 25, 465, and 587. I'll probably use Mailjet for outgoing mail. Anyone found a good solution for incoming mail?
Email messages sent to your app are implemented as HTTP requests containing MIME data. To process incoming email messages, you associate email addresses with script handlers in your app configuration, then include the handlers in your app's code.
The link below is for python but there is no restriction on language.
https://cloud.google.com/appengine/docs/standard/python/mail/receiving-mail-with-mail-api

Using Google Compute API automated over as server

I'm using the Google client API library for Python. My code is running on an Ubuntu 14.04LTS server.
I have a working Google Compute project, were I created and downloaded a OAuth2.0 token to my server.
I'm trying to write a script that does the following:
Automatically (with no user interaction) authenticate to Google Compute engine.
create a new VM and then perform more actions...
My basic problem is using the OAuth2.0 authentication. It required user approval on a javascript supporting browser, and I want to do it automatically, on my server.
Using my code on my desktop works. A browser page pops up requiring my approval. On my server, I get the following message:
we have detected that your javascript is disabled in your browser
The code segment I use for authentication is:
# authenticate using the OAuth token
client_secret = os.path.join(
os.path.dirname(__file__),
self._oauth_token_path)
# set up a Flow object for the authentication
flow = client.flow_from_clientsecrets(
client_secret,
scope=scope,
message=tools.message_if_missing(client_secret))
# open credential storage path
credential_storage = file.Storage(self._credential_storage_path)
credentials = credential_storage.get()
# get credentails if necessary
if credentials is None or credentials.invalid:
credentials = tools.run_flow(flow, credential_storage, flags)
I read about service account access as a replacement of the regular OAuth2.0 authentication. Does any one know if that's the best way to go? any thoughts on how to do it better?
OAuth 2.0 requires user approval and is not the method to go for if you want to run your code/scripts automatically.
Service accounts are more suitable for this and are supported by the API (https://cloud.google.com/compute/docs/authentication#tools)
You create a service account + key in the developer console and use both to authenticate your application.