Incoming call notification for RingCentral - push-notification

I am developing a C# application to notify user in real time for the incoming call. I am able to get SMS notifications successfully but not able to get notifications for the calls.
I am using RingCentral C# Github to develop.
Thanks in advance.

If you can get SMS notifications and want call notifications, you just need to modify your event filters and subscribe for presence events. A list of events is available in the API Reference. I've added a few deep links to call events below.
API Reference: https://developer.ringcentral.com/api-docs/
Account Presence Event
/restapi/v1.0/account/{accountId}/presence
https://developer.ringcentral.com/api-docs/latest/index.html#!#RefGetAccountPresenceEvent
Extension Presence Events
/restapi/v1.0/account/{accountId}/extension/{extensionId}/presence
/restapi/v1.0/account/{accountId}/extension/{extensionId}/presence/line/presence
https://developer.ringcentral.com/api-docs/latest/index.html#!#RefGetExtensionPresenceEvent
Detailed Extension Presence Events
/restapi/v1.0/account/{accountId}/extension/{extensionId}/presence?detailedTelephonyState=true
/restapi/v1.0/account/{accountId}/extension/{extensionId}/presence/line/presence?detailedTelephonyState=true
https://developer.ringcentral.com/api-docs/latest/index.html#!#RefGetDetailedExtensionPresenceEvent
Extension Presence Line Event
/restapi/v1.0/account/{accountId}/extension/{extensionId}/presence/line
https://developer.ringcentral.com/api-docs/latest/index.html#!#RefGetExtensionPresenceLineEvent
Missed Calls Event
/restapi/v1.0/account/{accountId}/extension/{extensionId}/missed-calls
https://developer.ringcentral.com/api-docs/latest/index.html#!#MissedCallsEvent

Related

Java Google Calendar API: Send email notification when creating event

I am using java google calendar API. Whenever I create a new event I would like to send an email notification to all attendees.
I guess/expect there are 2 ways how to achieve that:
Set it as the calendar property
Set it ad hoc as property on the created event
I don't care which of these options I use but I don't know how to do it programmatically and I am struggling to find any example of the code.
As you can read in the documentation, about the sendUpdates parameter:
Whether to send notifications about the creation of the new event.
Note that some emails might still be sent. The default is false.
Acceptable values are:
"all": Notifications are sent to all guests.
"externalOnly": Notifications are sent to non-Google Calendar guests
only.
"none": No notifications are sent. This value should only be
used for migration use cases (note that in most migration cases the
import method should be used).
You can follow the insert Example besides the Quickstart to set the previous configuration, but take into account that there is an outdated dependency that makes you use the deprecated sendNotifications instead of sendUpdates:
compile 'com.google.apis:google-api-services-calendar:v3-rev305-1.23.0'
should be
compile 'com.google.apis:google-api-services-calendar:v3-rev401-1.25.0'
I already reported the issue to Google.
Assuming that you already have the object created event, with the list of attendees, the API call should be:
service.events().insert(calendarId, event).setSendUpdates("all").execute();

Send email automatically every day in App maker

I need to send an email alert everyday to notify pending Approvals to all approvers. Does this possible in App maker? Please suggest.
I am sending approval emails immediately after request created and this is working absolutely fine.
I want to know the event or an utility in App Maker which can help to trigger emails for pending approvals to approvers every day.
You can achieve this using Triggers in App Makers server script.
Please check the sample code below for more details.
ScriptApp.newTrigger("functionName").timeBased().everyDays(1).create();
You have to create a function which sends the email and add the name of the function in the place of newTrigger("functionName") with the quotes.

Check when any user is connected slack API

I want to know when any user is connected to my slack workspace. I know that with presence_change event I can get that info, but passing the user ID.
What I want to achieve is to send an event to my app (right now using ngrok) when any user is connected (eg. it status changes from disconnected to connected)
EDIT:
Finally I discovered that if you listen that event without user_id, it will returns the ID of the user that triggered that event. If this help anyone.
I know you already answered you own question and it's kinda old now, but it could help others.
Here is what could be done:
create a slack app
enable event subscriptions for this app in order to call your application webhook each time the 'presence change' event happens
in you application code, call slack api to get more details about the user that triggered this event
I detailed how to do these steps in this blog post for a very similar use case, but for another slack event (bot events), if needed: https://blog.eleven-labs.com/en/en/replace-erp-by-slack-bot-with-dialogflow-and-symfony/

Google Calendar push notifications. Up to date flag

I've subscribed on google calendar push notifications (PN). Base synchronization processes using PN. I need to know if all events already loaded in calendar scope or not.
Is it possible to have a special marker in my request answer (request events for specified calendar based on subscribed channel information)?
If calendar has too much events, events will be loaded in few push notifications handling. I need marker for UI if calendar is synchronized completely. In my my usual logic I thought that calendar is already synchronized if first PN per calendar already handled. So I need notify my UI client with correct status (calendar_is_synchronnized, calendar_is_not_synchronnized) but I do not have any markers from google if the PN provides me load last events portion in specified calendar scope.
I haven't got elegant solution for my question. But I've solved issue with double call. The is no special API for this purpose, I've used algorithm:
after updating to sync token I try get all events for same calendar just to be able compare new nextSyncToken with current if it is the same.
if token is different if means the calendar sync is not completed yet.
If any better idea(s), you are welcome.

How can I test subscription renewal flows in stripe?

I want to test my application's handling of webhook events from stripe when a subscription payment has been made (or failed). Here is what I've tried so far:
Set up a new subscription
Update user's credit card to be the one that can be added to an account, but will fail to actually be charged
Change the trial end date to be in one second
Wait a few seconds expecting the webhook to be sent
However, According to the documentation:
If you have configured webhooks, the invoice will wait until one hour after the last webhook is successfully sent (or the last webhook times out after failing).
One hour is a long time to wait, since I am trying to do this as part of an automated integration test suite.
One suggestion (from IRC) is to fake out the webhook request, so that my integration test sends the event, instead of Stripe sending it. However, since Stripe doesn't include any sort of HMAC in the webhooks, I can't trust the data in the payload. So, my application just takes the event ID from the webhook payload and fetches the event from the Stripe API:
If security is a concern, or if it's important to confirm that Stripe sent the webhook, you should only use the ID sent in your webhook and should request the remaining details from the API directly.
This will obviously not work if I am trying to inject fake events for my test (by design).
What are the best practices for testing this sort of scenario?
It seems there isn't a perfect way to do this. As suggested by #koopajah in a comment, I added a configuration value in my application that will disable fetching the event from Stripe, and instead just trust the event data in the webhook. This allows me to test my flow in almost the same way as it would work on production, since the event data in the webhook and the event fetched from Stripe are identical (assuming it is an authentic webhook request :)
Unless/until Stripe includes an HMAC signature in the webhook request to authenticate that it came from them, I think this is the best way to solve the problem.
One hour is a long time to wait, since I am trying to do this as part of an automated integration test suite.
You can shorten the wait by going to the invoice and selecting the "Charge customer" button, as shown below.

Resources