How to listen for Database-changes using an RestAPI from Google/Microsoft/Notion? - node.js

I am trying to integrate Google Calendar and Microsoft Todo into my Notion Workspace using NodeJS. It is quite easy to make Requests in order to create, read, update and delete data but I was wondering how I could listen for changes in the database. For instance if someone creates an event in Google Calendar, how can I directly respond to this change in Google's database by creating a new event in the Notion Database? I thought of making as many requests per minute as possible in order to notice changes as early as possible, but I do not think that is quite resource friendly.
Eventually I was also wondering if it is even possible to make a RestAPI-Server that sends out some kind of Notifications.
I hope my question is understandable.
Thank you and stay save!

They keyword you're looking for is "webhook", I don't know if Google Calendar and Microsoft Todo support webhook or not but Notion currently doesn't, learn more at https://www.reddit.com/r/Notion/comments/nd76ec/notion_api_webhooks/

Related

Google Hangouts Chatbot Create Room

I am writing service for messaging between rooms using Hangouts chatbot. Is it possible to create a room with Hangouts chatbot?
https://developers.google.com/hangouts/chat/concepts
If it were generally possible to create a new room programmaticaly with the Hangous API, you could do it with the chatbot.
For example, if you implement the chatbox with Apps Script, you can create a function onMessage(event) and establish was will to happen in case of a certain event.message.text (e.g. create a new chat room if the message text contains the string create new room.
However, for the moment it is not possible to create a new chat room programmatically.
There is a feature request asking for this functionality, but given the potential of abuse, it is controversial either it will be implemented.
See comment #2:
Hello, thank you for the feature request! At the moment rooms cannot
be created via the API to prevent abuse such as a bot or script
spamming room creation. However, this kind of feature has been
discussed internally and may be coming in the future (with
limitations). I will update this issue if more information is
released.
And comment #25:
Thanks for the input. It's great to see some real life use cases. We
fully acknowledge the importance of a CreateRoom(DM) API and we are
actively looking into the right permission model to allow bots to do
so. Please continue to follow this bug as we will post updates here
when appropriate.

trigger AWS Lambda function via MS teams

Is there a way we can trigger AWS Lambda function from Microsoft Teams. what I wanted to achieve is that stakeholders be able to approve merge requests from MS teams or maybe give an approval on Production rollout.
Is this connection possible at all?
Please help
Yes, this is definitely possible, but there are a bunch of things you need to do to get a full working solution, so it's hard to give it all in one answer here. Here are some guidelines to get started though:
You need a something for the user to actually "Approve", and way to do this. A common approach is to send a "Card" to Teams, which can have an "Approve" button. There are a few different kinds of cards, and different ways to send them to Teams, including a Bot, Flow/PowerAutomate (which uses it's own Bot behind the scenes) and incoming Webhooks.
When the user clicks the "Approve" (or "Reject") buttons, you need a way to handle the action (to link the button click to AWS).
If you've built Bots before, this might be the easiest option. If you want to use Flow/Power Automate, that's another option (see here for more information about important changes due "this quarter" - I'm not sure if they're released yet). If you've not used any of these, your best bet might be:
Configure an Incoming Webhook
Send a Connector Card with a "Post" button
Set the POST url to be your AWS Lambda

Firebase Messaging Push Notifications

hi guys I'm trying to add push notifications to my flutter app. I want them to be sent to specific users an hour before an event happens the time of the event will be stored in firebase by the user. I have been doing my research and I think need to write these conditions in a node.js file? I also want to send another notification if an entry is added which is pretty straight forward. However I only would want to send it to the users in the same area as the user who added the entry. In my flutter app I use geohashes and haversine to query firebase for the user in the same area would I need to do the same in the node.js file. I am having trouble finding some good examples if this correct please direct me to some better resources if not please help me better understand what I should be doing. Thank you
Your question's scope is wide but I will try to give you some kind of guideline for you to begin with.
First to set up an environment for firebase functions follow this, then there are different triggers for firebase functions like database write calls a function to be executed when new data is written to the database.
In your case when you add an event inside your trigger write some code to get the users near that area and send notifications, and to send the notifications you will need to get the token of every user when they login to your app and save it somewhere else.
For firebase functions, you need to know basic Javascript/TypeScript and for that, this video series of Doug Stevenson is very helpful. I recommend finishing the tutorial first.

Is there a way to get Instagram #Mention History via API or otherwise?

The native application doesn't show all the activity, only the most recent.
Therefore I lose 70-90% of my notifications overnight. There must be a way to get all that historical data.
I told you can't, but, thinking.. you can. :)
The API don't provide that facility.. You can check all endpoints here: http://instagram.com/developer/endpoints/
But you can iterate over all your medias an get all comments and likes. If you store it locally, after, will be possible to request API again and check your new unseen interactions.
It will work for likes and comments.

Fast or rolling contact importer

Im trying to add a feature to my website that involves the typical "invite your friends" with help from a contact importer (cloudsponge). Its a pretty popular and gets the job done but I need something faster..
The problem with cloudsponge is that they request all contacts in one call, this could mean a long wait time for someone with alot of contacts.
I looked at their rest calls and there doesnt seem to be a way to load contacts in pieces. Do any of these contact importing services allow you to pull in a few contacts at a time (lets say 50) so that we can show our user the first 50 contacts and load the rest / updating the view. So they dont have to wait forever for all the contacts to be pulled?
Ive looked at other apis like context io but cant seem to find a solution to this one.
I built the CloudSponge API.
Early on, we decided to support imports across a variety of providers while exposing a simple and consistent interface. Pagination and rolling or real-time access to contacts were things that were excluded in order to do that. To provide end-user feedback on the progress of the import, we added the /events endpoint.
So far import speed hasn't been a major issue for a couple reasons:
In general, end users with an address book of 10000+ contacts are rare (although this may not be the case for certain niches).
End users who do have this many contacts in their address book usually understand that it will take a while to import.
Having said that, the speed is something that we can definitely improve upon. Here's a few ideas:
We can allow for returning only a subset of all contacts by default. For example, we currently return all contacts for Gmail, which is usually a much larger number of contacts than are actually stored in 'my contacts'.
We can implement parallel paginated imports on the server side. This will make our server process work harder and faster to download the user's contacts from, say, Gmail. This adds complexity on our side but keeps the API untouched.
We can implement your suggestion: add a rolling or real-time access to contacts in our API, either in an extended endpoint or a new version of our interface.
I'm happy to work with you on exploring these to improve our service. Send us an email: support#cloudsponge.com
Graeme

Resources