Google docs workspace addon API - key presses, text change - google-docs

Is there a way to receive an event when a text is changed or poll for that event from a workspace addon? I understand that all elements are json received from backend. Not sure how I can receive text change events (I am thinking perhaps polling through the backend and app-script) but then can I force refresh the json results on the addon workspace?

Related

No XEP-0333 Chat Markers in XMMPP Openfire backend - how to solve it?

We have an Openfire XMPP/Jabber server setup (with a NodeJs backend and React frontend).
Chat is a feature embedded in the app (NOT an overlay or window that is always visible). So the user has to navigate to a specific page to access the chat interface.
It is working via websockets and messaging sending is working fine. We have a React frontend.
The challenge is that XEP-0333 Chat Markers is not supported by Openfire (the spec never become production ready).
Therefore we need to know how can we implement this feature so that :
A users knows when they are online that they have an unread message (and later, how many unread message they have). For example, if they are not in the chat window and messages are arriving, we need to indicate that in the header of the app so they see it)
if a user goes offline, and comes back online but NOT into the chat window, how can we know if they have unread messages and notify them of that?
My understanding is that somehow we have to keep track of unread messages (eg perhaps in indexedb or local storage or even in postgres backend) and after the user reads a message, we delete it from storage. If the storage still has records for that user then clearly those are the unread messages.
Obviously we don't know if they actually READ the message, but we can assume that if the chat window is open and visible (ie. active tab in their browser) that any messages delivered have been read.
So if our application tab is active, but user is not in chat, and a message arrives, we store it. When they open chat and click on the sender, we remove it from storage.
Has anyone solved it this way? (looking for links to React or JS/TS code)
Is there a better way? (links to other solutions would be helpful, esp. code)

Saving and loading facebook instant game multiplayer data of the game

1) Is setting up webhook necessary to save json data of a context shared between players of context?
2) How to validate callback url for webhook on facebook developer console? My game is already live on facebook for single player. (No local testing)
3) Can I use my own personal https url to setup webhook?
No, you do not need to use the webhook to save context data. You can use XMLHttpRequest, fetch or a JavaScript SDK for a service like Playfab or Firebase to store data. In fact, we wouldn't even recommend you use a webhook for saving data because if the player turns off messages from your bot you will not receive any webhook callbacks.
You can validate a callback URL using the developer dashboard, including the "Show Recent Errors" button, which is really useful for spotting any issues. You can also get more information from the Webhooks item on the left nav.
You may need to clarify what you mean by "your own personal https url". As long as Facebook can hit your webhook URL, everything will work. You cannot, for example use a localhost URL.

Cancel Gmail auto save of draft programmatically

I need to encrypt the real message that user write in compose mode in Gmail , so I created a Chrome extension that creates another button of 'secure send' in compose window ( I am using gmail.js library and InboxSdk library ). The problem is that when user write a new message a draft save automatically every time user keep writing and the real message actually not secure.
I think about update every time the draft when user change the content via Gmail API Users.drafts: update but the problem that also here it's save for a while to Google and I don't want it.
Is there some option to cancel the auto save of the draft? Then maybe I somehow try to save the draft by myself.. I don't see anything about this in the gmail.js and InboxSDK library's and also in the rest of my research...
AFAIK gmail-api hasn't a method to block the Gmail UI draft message autosave. In an scenario like the one described on the question, I think that the best is to avoid the use of the Gmail UI to compose new messages.
Anyway, Gmail draft autosave on the UI is done by using AJAX. I suggest you to try to find out which request sends the body of the draft messages and block it only while your extension users writes something to be encrypted.

Firebase (Google) Cloud Messaging (FCM, old GCM) - check message status

I'm trying to find a solution to ensure a push notification to my Chrome extension has been received before sending another one. IF it hasn't been received and another one should go, I would change its content to tell the user he has multiple new informations to check.
So I'm looking for a way to check the previous message status using its ID, or check the queue of messages if using a collapse key, before sending a new one. But I can't find anything related to this, except here : https://support.google.com/googleplay/android-developer/answer/2663268?hl=en there is FCM message status detailed, but no way to get them after the first response.
I am aware receipts can be implemented using XMPP but I would really prefer to remain on the regular HTTP protocol.
Thanks ahead for any help.
XMPP receipts would be the recommended way for you to get an ack that the message was delivered. You can also use the Play Developer console (Android developer console) to view statistics on the status of messages. However this will not be sufficient if you want to automatically resend, you would have to do this manually.

Redis Sub/Pub - Get latest published content?

Using nodejs and redis sub/pub system. When I log into my web app I want to get the latest published content once I subscribe to it via nodejs. Is this possible? When I login I want the user to see the content from the channel they subscribed to. Right now when I login there is no data, but when I publish content to the channel it shows up, I refresh the page and the content does not show again.
EDIT
When the person logs into the system would I instead just load the results from the db via php then from there subscribe to the channel via nodejs and update the rows via redis sub/pub? Is that how it would work?
I think the best answer is anytime data is published to the channel to at the same time store that data in redis using the channel name as the key. Then when a user logs in it then grabs that data in redis, displays it then subscribe to the channel waiting for updated information. Do you agree or is there a better way?

Resources