Getting API error occurred: account_inactive when using Slack Postmessage api to send message to slack user - node.js

I am building a slack app that would send messages to user. Recently I am getting an error which says "account_inactive". The slack documentation describes the following error as below
Authentication token is for a deleted user or workspace when using a bot token.
I tried sending a message to a deactivated slack user using "chat.postMessage" using a bot token "xoxb-token" and the API returns success all the time. It would be great if anyone can help me with what causes this error.
PS: I am not using BoltJS, I am using he JS SDK directly.

Sounds like your app has been uninstalled from the workspace. You can try calling auth.test to see if the token is still valid.

I've come across this error recently.
In my case, the cause was that when a user account is deactivated, some apps they've installed are also deactivated. If this is the case for you, a member with the permission to manage apps will need to reactivate it.
More information can be found in this Slack help article.

Related

How I can get the Call Quality of all teams Calls&Meetings by Graph Api or similar?

I worked on a solution for getting all teams audio & video communication quality in the company.
https://learn.microsoft.com/de-de/learn/modules/msgraph-changenotifications-trackchanges/5-exercise-change-notifications
On Runtime-Ecxceptions I use the old version the videos are created. older sources
That should solved later but it should no reason for getting onl some notifications not all.
I tried to get the callrecords by change notification and it worked partly, but I get not all notifications, and the endpoint handler work more than a half day (12, 14 or 16 h i think).
If I understand it correct. All cloud communication audio-/Video Call was accessed with https://graph.microsoft.com/beta/communications/callRecords/
If the CallRecord is an meeting type the the joinWebURL is set and must be added to the filter-clause to get the corresponding meeting.
All online meetings are missing
some group calls direct routing calls
and PSTN-Calls I have not tested it.
My Created subscription:
{
"changeType": "created,updated",
"notificationUrl": "https://a283-178-27-237-107.ngrok.io/api/notifications",
"resource": "/communications/callRecords",
"expirationDateTime": "2021-08-29T11:00:00.0000000Z"
}
I took on every creation or renewing the subscription the max time 4230, but I tried it with short timespawn and periodically renewing the subscription.
My setting in the registered App
// add permissions to registered app
CallRecord-PstnCalls.Read.All
CallRecords.Read.All
Calls.AccessMedia.All
Directory.Read.All
OnlineMeetings.Read.All
OnlineMeetings.ReadWrite.All
Reports.Read.All
User.Read.All
(OnlineMeetings is only a short time added)
I set the application access policy for this app with powershell.
Then I tried to get the Callrecords through the Callrecords History of teams Admin Center.
But the Id's there worked party an with the user who created the Meeting or call.
I got the messages Forbidden, invalid token,... so it seems the app works on with delgate permission, but I set App permission.That could clarify why i cannot all CallRedcords.if Icreated a subscription for a app which has appermision, the webook should called on ever Call.
So have 2 big problem:
Why there are not all notifications send?
How can i get an valid access token which works with app permissions and not with delegate permissions?
Update:
Now it seems i get all notifications, point 1 & 2 or irrelvant?
not use postman accessing subscriptions, i get no valid token for postman what ever I tried (Oauth2 Authentification copying token from the notificationurl handler), it seems the effect of the applicatiobn access policy.
Has anybody a solution for that?
Update 15.09.2021:
CallRecords Records seems to work fine, there was an error on postman enviroment.
I ignored other manuals and followed the steps to use postman from microsoft for that (see https://learn.microsoft.com/de-de/graph/use-postman). Creating subscription with the application permission and it seems I get all notifications.
So getting all notification seems to work. So I will close it now.
CallRecords Records seems to work fine, there was an error on postman enviroment. I ignored other manuals and followed the steps to use postman from microsoft for that (see https://learn.microsoft.com/de-de/graph/use-postman). Creating subscription with the application permission and it seems I get all notifications.
So getting all notification seems to work.
So I could close it generally, beacuse concerning question in this context needs own questions.
A controll check if I get all notification is the onyl open point on this question.
So I wait a few days, if there is no answer I close this question.

Azure Bot: There was an error sending this message to your bot: HTTP status code Forbidden

PROBLEM: When I try to test my bot using the web chat in the MS Azure GUI, it gives me the error
There was an error sending this message to your bot: HTTP status code Forbidden
I've done the following:
Created a bot using the Microsoft Bot Framework, LUIS, and NodeJS
Created resource for the bot in MS azure
Successfully tested the bot locally using the bot emulator (without using the bot ID and password)
Set up continuous deployment so all updates made to my repo are reflected in the Azure bot service
Defined all environment variables in the application settings tab of the azure bot service (bot id and password are correct and included)
Included web.config, iisnode.yml, and publish.js files
Heeelp. I've googled this, tried alternative solutions mentioned for similar problems, but no luck.
NEVERMIND! I had stopped the application weeks ago, that's why it gave the forbidden error. I didn't realize until I tried to make a GET request in Postman to the bot endpoint.

MS Azure bot service Slack bot integration issue

Dear Stackoverflow community,
I've got "Sad bot is sad because An error occurred processing the request. Please resubmit Slack credentials." issue during Slack authorization of my NLSQL application created on Azure Bot service (Please find also print-screen of an issue).
I've tried to resubmit same credentials with no success.
Please let me know any ideas how to solve this issue and integrate my app to Slack?
validation issue
On Slack app select the OAuth & Permissions tab.
Click Add a new Redirect URL.
Enter https://slack.botframework.com BUT NOT https://slack.botframework.com/dev/validate
https://slack.com/oauth/authorize?scope=bot&client_id=337679718484.338671411941&redirect_uri=https%3a%2f%2fslack.botframework.com%2fHome%2fauth&state=nlsql

How to get the token of the user in TFS through an API Call when creating tickets from Slack

I am using Microsoft bot-framework for Nodejs that is hooked with slack. My bot basically listens for commands, for example,
Me: #bot create a bug
bot: Created a bug
David: #bot create a bug
bot: Created a bug
The problem is, I have my token hardcoded inside the program. So, David is basically creating a ticket as me. Is there anyway to get the token of the user who sends the command and create a ticket as that specific user?
Thanks

Slack Bot to see all Direct Message Channels

I am trying to implement a Bot which can get all the Direct Message Channels, all the workspace Users and send Direct Messages to them.
If I work with my development workspace everything works as expected but when I try with my company workspace, my Bot is only capable to retrieve the Direct Message Channel it is belonging to.
Any idea on how to fix by production Bot.
You can't. Due to the security architecture of Slack one can only see the messages of channels he is part of. Its the same even for the "super admin" of a Slack team (the primary owner). Bots and apps inherit that right from the user who installed it (= authed the access token).
The reason it works on your development Slack, is that your user has probably created all private channels on Slack, and/or is the same that authed the access token your app uses.
Thanks to Slack support I got my answer:
The OAuth Token issued is specific to the user who has installed your app and represents the permission(s) to perform actions on behalf of the user. More detailed information here - https://api.slack.com/docs/oauth.
The token can only perform the same actions as the user who installed the app i.e If the user can’t view or post in the channel, they can’t grant permission to something they do not have.

Resources