Check when any user is connected slack API - symfony

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/

Related

Google Calendar API: User exists as an attendee when the meeting does not exist in his calendar

I'm using calendar API to pull events of users in an organization that had installed my GSuite app as a service account (it just means that I have access to all the users in the organization).
I noticed some weird behavior - let's say I have an event with 2 participants - a and b (both are users in the company). when I use the calendar API events.list to pull event for a I get this event, and b is listed in the attendee list with responseStatus of 'accepted'.
When I pull the events for the same period of time for user b, I do not get this meeting, nor when I try to pull a specific event using the meeting id (event.get API). I also used showDeleted=True but still didn't get the event back when pulling the events of b (I'm pretty sure if the event would have been deleted then the responseStatus would have been 'decline').
What could be the reason for this behavior? I tried to reproduce it using two emails that I have access to, and I was not successful.
Since those are emails of my client I cannot just come up to them and ask what happened with this meeting.
This is the request I'm making (using python google API client):
from googleapiclient.discovery import build as Build
service = Build("calendar", "v3", credentials=credentials, cache_discovery=False)
service.events().list(calendarId='primary', timeMin=min_time, timeMax=max_time, pageToken=page_token, singleEvents=True).execute()
First I'm building the service using the service account credentials (delegating permissions to the current email), and then making the request to pull the events.
The min_time,max_time are strings like this - 2020-10-19T08:00:00+0000.
The pageToken starts as None but will change if there is a nextPageToken in the response.
This is the request I made to try and get the meeting of the user that appear as an attendee when pulling the event using another user's email & credentials:
service.events().get(calendarId='primary', eventId=<meeting_id>).execute()
But I'm getting 404 event not found response (This API returns deleted events - I've seen it)
I'm pulling all of the events correctly, and only saw this case on small number of the events (less than 5% of the meetings).
Any idea what could cause this?
Thanks!

Google Analytics User-ID-status showing as "Unassigned"

I have this scenario
I enabled User-ID feature and Session Unification feature.
On the frontend when someone Signup I set their newly created UserId and I trigger custom event, that says that someone signed up.
Then I trigger another custom event from the backend that say that user becomes a friend with someone (need to do this fro the backend) and I'm using Measurement Protocol for this hitting this endpoint when this happens https://www.google-analytics.com/collect?v=1&t=event&tid=trackingId&uid=uid&ec=eventCategory&ea=eventAction&el=eventLabel
Now the problem that I have is that I did a small test, where I registered 2 users, and for one I become a friend with someone just to see if that event triggers too
Inisde the Realtime everything works as expected, but when the reports show up the next day I got 1 user with status Unassigned
Any Ideas what can break this flow and how this can happen? I thought If data in realtime is ok that it will be on reports too, Thanks!
Miss & before ea parameter. This can make issue because event action will not recognized and it is a required parameter.
EDIT
if you have done the tests too far apart (30 minutes) you can generate some inconsistencies due to the session, considering that you send an event.
Note: real-time data is generally unreliable.

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.

Incoming call notification for RingCentral

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

Google Calendar API Push Notifications - Event Moves into the Past

I'm working on an app which allows users to confirm they attended a google calendar event. I'd like them to make the confirmation immediately after the end time of the event.
Will subscription to Google's event push notifications (https://developers.google.com/google-apps/calendar/v3/reference/events/watch) let me know when the event is over?
If not, what's the best way to solve the above problem?
Push notifications only let you know about changes on the calendar (someone moved the event, someone responded etc.). There are no push notifications at starts and ends of events.
You can still combine storing the events and watching the changes to them with having a cron job (or similar) to run your code when events end.

Resources