Hot to enable Cloud Elements Microsoft Graph Calendar webhooks for all calendars? - outlook

By default, when I integrate my Microsoft account with cloud elements:
https://developers.cloud-elements.com/docs/elements/microsoftgraph/
I only get notifications for my default calendar. But, in fact, I have like 5+ calendars. I want to get notifications about changes in all of them.
For now, I can only think of making a new end-point that accepts calendar ID and then I invoke this endpoint with the result of invocation:
GET /calendars
But, this looks like a hack. Is there a better solution to listen to all the calendars that I have using Cloud Elements?

According to your description, I assume you want to get the notifications for your calendar when the calendar changed.
We can use the subscription endpoint to get the notifications. For more detail about this endpoint, we can refer to this document

In the Cloud Elements UI, if you select the instance and click the api docs you will see four sections "information", "setup", "resources", and "models". Select resources and you will see one that has POST /webhooks
This is the call the Cloud Elements sends on webhook provision. If you want to change the body of the webhook go to the PreRequest Hook where you will see javascript that is creating a post body that will be sent to Microsoft.
By default the body you see in the javascript looks like:
var body={
"changeType": "created,updated,deleted",
"notificationUrl": "{webhookCallbackUrl}",
"resource": "/me/events",
"expirationDateTime": newDate
}
If you want to change what resources you get notification for you can do so in this body and using the documentation that was provided in the previous answer

Related

Is there a way to send a note when deleting an event in the Google Calendar v3 API?

In the Google Calendar web interface it's possible to send a note when cancelling (deleting) an event, like so:
Is this also possible via the v3 Google Calendar API? I looked at the Event delete API docs (and others), but there doesn't seem to be a parameter or option.
If you check the documentation for events.delete you will find that there is an optional parameter for sending updates to the user upon deletion
According to DaImTo it is not currently possible to set the note text when sending notifications about cancelled events.
If you'd like to see this feature implemented, star this issue.

Google Meet integration api (like Hangouts app for Slack)

I want to utilise Google Meet api, which is used in Hangouts integration for Slack, description follows
TL;DR:
Links such as https://meet.google.com/new?gid=123&gd=qwe987 can be generated, so a modal is shown which can ask user's confirmation and then some request is sent from user's browser (where the Google Meet page is opened) to some endpoint (probably it is determined from gid which seems to be google application id). Is there a way to configure my application to have a webhook, so I can generate these custom links?
There's Google+ Hangouts app for Slack. Here's how it works (after you add the app in your workspace):
you send /hangout command in any Slack channel
slackbot sends an "Only visible to you" message in this channel with a link to start a new hangout. it looks smth like this (I changed data in the link): https://meet.google.com/new?gid=691521906844&gd=THTJ30X6W%7CU01113BD13M%7CD01113BDB5Z%7Csuren%7C%7C1846381238693%7C1%7CB01QFGG5GJF%7CE1MDm4DWcuVa0RbN5ZT9o5KF
when you visit the link, a new meeting is started instantly, and the page shows modal with text "To bring others into this video call, post a link it to your Slack channel" with buttons 'Cancel' and 'Post'.
when you click 'Post', a new message is sent to the Slack channel, where the command was sent. Text is "#Suren Khorenyan has started a Google+ Hangout and would like you to join. Join Hangout." and contains a link to the meet, which was created previously
How can I utilise this integration for another app, like Mattermost (or anything else like Telegram chats via bots)?
As I see, data in the url slightly changes. Probably it's payload for Google Meet to trigger Slack to send a message with link to the channel.
gid seems to be something like google app id
gd seems to be something like google data. If I url-decode it, it becomes THTJ30X6W|U01113BD13M|D01113BDB5Z|suren||1846381238693|1|B01QFGG5GJF|E1MDm4DWcuVa0RbN5ZT9o5KF. This is some kind of payload, separated by pipes (obviously), but I don't know what any part of this means (suren is my username in the Slack workspace, probably this is used for creating an invitation message).
When I click Post, this happens:
a new POST request to https://hooks.slack.com/services/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 is sent with form-data
hangout_id: 1812381238693
hangout_url: https://meet.google.com//abc-iuqx-def
a new message is posted to the Slack channel
Google meet somehow knows where to post back! Is this configured at the Google application (application id is provided via gid)? How can I configure my application for such behaviour? Where can I setup webhook url?
If we breakdown the request, we can see that url contains some parts of the gd payload:
THTJ27X6W - this is the first part of the gd payload
B01ABCD5GJF - last but one
E1MDm4DWcuVa0RbK5ZT9o5KD - the last part of the gd payload
and form-data contains:
hangout_id - this is in the gd payload after my name
hangout_url - obviously, this is the url for the new created meeting
How can I change it for my needs?
I created a new application at Google APIs dashboard (here console.developers.google.com/apis), but can't find any docs for this integration. There's Google+ Hangouts API in API Library, but it says Apps will continue to function until April 25, 2017..
I tried to approach it from another side:
In the API Library there's Google Calendar. I found mattermost-hangout app on GitHub (had to update it a bit, so it works with updated api). Here's how it works:
oauth2 for authorising at google (single account)
it handles POST request, which is meant to be received from Mattermost (triggered by a slash command),
creates a new calendar event using Google Calendar API (with conference),
takes hangouts url from the response and sends a new message in the Mattermost channel with invitation to join the meeting.
But it has some downsides:
you have to use one account to authorise all event creation events (yeah, it can be upgraded to authorise any number of users, but it'll be inconvenient. why to force anyone to provide access to their Google Account, when Google Meet authorisation just happens in browser, we don't need to create events)
account, used for auth, now has events in his calendar. of course, events can be deleted, but it's not the way.
Is there any documentation on utilising gid and gd params?
Generally, I want to find a way to configure a webhook in my app, so when Google Meet finds my application's ID in the gid query param, it looks at the app's config and sends a request to my app (previously configured endpoint (I assume it works this way)).
Of course there's a chance that it's some kind of internal API and it cannot be used by everyone, but I could not find any information on this.

Can we pass custom values using square connect and have it returned back in webhook notification

I am looking for information on how to pass a custom variable (transaction_logID) to the square API and then have it returned back to me on the webhooks notification URL response.
How can i specifically link a "charge" event with a "notification" event so that I can update my personal SQL record with the transaction result? (Approved, Declined etc)
Thanks for your help.
Unfortunately passing in custom data and getting it back in a webhook isn't possible.
Depending on what exactly you want to link your notification to, you can look up the ID from the webhook in the v1 payments endpoints.

Accepting calendar invites via Google API

How do I accept a calendar invite using something like the Google Calendar API or the Google Gmail API?
Bonus points if you can point me how to do it in Ruby, but just a hint at which API I should be using would be more than fine.
You should be using events patch.
First create an Event with just the information you want to change. In this case, this will be the single attendee (even if there are multiple attendees) whose response you want to modify (which should be the same as the user under which the call is made), and the corresponding response status ("accepted", "declined", "tentative").
Then you execute patch, passing in the event id and the sparse event created above.
An example in Java is at https://stackoverflow.com/a/41054893/80075

Trigger script on Google calendar event

I want to trigger some script when new calendar event is created in Google Calendar (say calling some rest API that enters event information to my database). I do not want any kind of UI that triggers the script. Is it possible to achieve this using Google gadget since I do not want any UI? I would really appreciate the help as I am new to Google API.
Thanks a lot
Shubhra
Calendar API has something like notifications. See this link: Push Notifications. From documentation:
The Google Calendar API provides push notifications that let you watch
for changes to resources. You can use this feature to improve the
performance of your application. It allows you to eliminate the extra
network and compute costs involved with polling resources to determine
if they have changed. Whenever a watched resource changes, the Google
Calendar API notifies your application.
Google Calendar API (relevant docs) provides a watch endpoint that allows you to specify a webhook upon certain events.
To set up the webhook, you can call the Calendar API endpoint a POST request to https://www.googleapis.com/calendar/v3/calendars/calendarId/events/watch with the body
{
"id": string
"type": string,
"address": string
}
The "address" field tells Calendar what endpoint to call when there is a new Calendar event. You'll need to create and host this endpoint yourself.
Another option is to use a service like Zapier, which has fantastic integrations for Google Calendar and makes setting up a listener (i.e. a trigger) and corresponding action very simple.

Resources