Slack Events API: never receive 'im_created' event - slack-api

I'm building a Slack application/bot and I want it to be able to welcome user every time one starts a direct message conversation with it.
For that purpose, I set up my Slack application accordingly with the documentation in order to be able to receive the 'im_created' event. Especially, I added the im:read bot scope (and even the im:read workspace scope, just to make sure) and subscribe to this event. But I never received it whereas I could receive all other type of events I needed.
Has someone already been in this case and share with me what I'm missing here ?

The 'im_created' event should not be relied upon, at least on small workspace. Indeed, this what the Slack support person answered to my request:
"I was initially testing on a workspace that had a lot of users. Then I decided to test on a smaller workspace and there, I was able to replicate what you were seeing. Turns out that on smaller workspace when a user joins the workspace, we automatically open DMs with between that user and about 10 other users. So it's possible that the DM channels with your bot already existed because they were created as soon as the user was added to the workspace, hence no im_created events.
I tested some more by inviting new users to my small workspace while listening to the im_created event subscribed at a workspace level (not a bot level). As soon as the new user accessed the workspace what do you know? An im_created event is fired. However, this doesn't work if you subscribe at a bot level."
For this use case (welcoming user when starting conversation with the bot), one should use 'app_home_oppened' event and test if it is the beginning of the conversation with your own backend/data, quoting again the Slack support :
"Any way you cut it, this would not have been the right event for your user case, app_home_opened is the right call."

Related

Overview of how to track mail move change notification ms graph api

Our platform is replicating email functionality, I.e. view all emails folders and contents, reply, create new, draft, move etc for users.
We have successfully subscribed users to all change notifications (create, update, & delete) for the whole mailbox, however, we are not sure how to track folder move operations as I can’t find an example in the documentation and our current implementation is not working reliably.
The issue we have is that after receiving the various change notifications, when we are doing the requests to get the value for the updated/deleted message, sometimes the value returned is the updated value, not the original one, therefore if the folder has changed we do not know which message to delete. This issue is highlighted in the documentation here (half way down): https://learn.microsoft.com/en-us/graph/outlook-change-notifications-overview?tabs=http#example-3-create-a-subscription-to-get-change-notifications-with-resource-data-for-a-message-based-on-a-condition-preview
We tried it using immutable ids, but the final webhook received was sometimes the delete webhook for the message ID. This is supposed to be for the original email that was moved, however because the message ID is the same (and the parent folder ID value is not reliable) we may end up deleting the wrong email.
With immutable turned off, we did not receive any delete notifications (only creates and updates), so we ended up with duplicate emails as the original was never deleted.
Is someone able to advise the correct procedure to track these events?
Thanks
So it turns out the only reliable way to do this is using the delta query - https://learn.microsoft.com/en-us/graph/delta-query-messages - whenever a change notification is received for a folder.
So, when authorisation is provided for access to a users mailbox, you must get subscriptions for each folder and then whenever a change notification is received for that folder/subscription, the delta query is run for that folder.
I believe that MS are in beta testing for providing the change information in the webhook which in my option would be a great improvement in efficiency in terms of implementation and operation.
Hope this helps someone in the future!

Office.Js best method for notifying and syncing end user of updates from another system

Office.JS is presenting some challenges that seem to end in the same you can't do that loop.
We have a system that's used to create appointments and tasks based on certain variables. What we're struggling with is the best method to sync those events/appointments to the end user.
We've landed with sending the user letting them know there is pending items, but is there a way to embed office.js into the email to open the task pane to sync the two systems?
I know event-based exists, but forcing a sync when composing any email seems crazy. https://learn.microsoft.com/en-us/office/dev/add-ins/outlook/autolaunch
Is there a better way?
There is no way to open a task pane programmatically from Outlook web add-ins.
A task pane can be displayed by using the following mechanisms that require end user actions as well:
A ribbon button can be assigned to open a task pane.
A notification message can be configured programmatically at runtime to open a task pane.
If you need to synchronize items in Outlook I'd suggest handling onSend event (or smart alerts) where you can read all the data of an item being sent and sync it with your back end server. Also you may consider using Graph API for syncing all items, not only the current one.
Outlook web-based add-ins are designed to work for a particular (currently selected) item only. And they are still very limited, comparing to VSTO add-ins, in customizing the Outlook UI.

Any idea to archive emails in Conversations in Asana?

I would like to centralize every email from (or to) customers of a project in the Conversations view of a project in Asana. The goal is to keep an archive of all exchanges with a customer in one place for every team member.
I tried to use the project#mail.asana.com as CC in every emails that i send but customers don't have accounts on Asana (and i don't want them to access it) and so they can't save their replies in Conversations. I tried also to create an email group (in Google Apps) and add the Asana email at it but it didn't work.
Any idea to use the Conversations view as an archive ? Or maybe is there an external tool which integrate with Asana that can do this ?
Thanks a lot in advance !
Hmm, that's interesting! I suppose that if you don't have too many emails this makes some sense (otherwise it might make your Asana Inbox pretty noisy - everyone would see in their inbox every conversation)
I think what I would do is to set up a Gmail filter to automatically forward the email to your team. You can do this in Gmail like this: https://support.google.com/mail/answer/6579?hl=en. If you set up a good filter (i.e. sent to a group address) it seems like it would be pretty painless.
One thing to note is that the conversation in Asana will appear to come from whoever is associated with the email that's sending the conversation to Asana, so if you have a single POC with the outside world, it may make sense to only forward from their account. Alternatively, you could set up a special Asana user just for this purpose, and your teammates can follow a convention that "mailbot" (or whatever user it is) is just used to forward mail, and you should look at the content to get who the author was.

How to detect a new user in Slack?

I'm using Slack API and want to detect an event when user first joins a team but cannot find such type of event in docs.
What should I look for?
I think team_join might be the event you're looking for? Depending on whether you need to respond immediately (and the consequences of missing an event if your bot is offline), you might also consider just calling users.list periodically and comparing to the list of already-seen users.

subscribe via email to incoming tfs issues?

I'm wondering if there's a way to write a tfs query such that when the results change, I will receive an email notifying me.
side question - is there a way to subscribe to updates to specific pieces of code?
Thanks!
I have the TFS Power Tools installed. The Alerts Explorer appears to have pre-configured alerts for several check-in activities. One of them is Check-In of a specific file happens.
And, I'm not sure which results you're talking about, but... You can also create various alerts for Builds and Work Item actions. I've got mine set up to alert me when something is assigned to me or when something assigned to me changes.

Resources