I'm using the Create channel endpoint of the Microsoft Graph to create Channels in my Teams.
When creating multiple Channels in the same Team within a short amount of time (I have a delay of 2s between each call), not all Channels are created.
The API call returns a 201 Created response for each Channel and, in the General channel, it shows that all my channels are created but they aren't all clickable (and they do not show in the channels overview):
Channel creation message in General channel
List of Channels
Same happens when using the connector in Flow and Logic Apps.
Do I need more delay between calls? Is this a known issue that is not listed on the Know Issues page? Quirks with the beta endpoint I just have to deal with?
EDIT:
As requested:
TeamId: 6d36a694-22f2-4691-9884-faa2c4517a1f
TenantId: b868e8f4-7920-4c24-8c95-7f432eba848b
Request headers (Input1 en Input4 have working Channels): https://gist.github.com/YannickRe/0be8dc213f44c5eb9b33bd31425af219
Additional thing I noticed through Graph Explorer: Get Channels does not show all Channels, but when using Get Team Channel and a specific id, all Channels can be found.
EDIT2, more Gists as requested:
TeamId: 4b915404-d27d-43ee-9ad2-781c6395f059
TenantId: b868e8f4-7920-4c24-8c95-7f432eba848b
Headers (input2 and input3 resulted in working channels): https://gist.github.com/YannickRe/a701e2d3cbcba798a23f1fb3ca7439df
Related
I have been using "https://graph.microsoft.com/beta/chats/{id}/messages" this Ms-Graph API to retrieve the Chat Messages for (Direct/Group Chat) in Microsoft Teams. I get first set of response (i.e. 20 Messages) but when i try to get the next set of messages using the "#odata.nextLink" property i encountered "Bad Request" error.
Is there any other way to retrieve the Next set of Chat Messages from Group/Direct Chat in Microsoft Teams?
Please use the query parameters $skip in conjunction with $top to have finer control over the result if nextLink is not working ( could be because it's still in Beta).
For example, use the below query to get 30 entries after skipping 30 entries
https://graph.microsoft.com/beta/chats/{id}/messages?$top=30&$skip=30
I am able to go to a specific channel using :
msteams://teams.microsoft.com/l/channel/channelid/General?groupId=groupid&tenantId=tenantid
but how do i send a message to the channel using deep linking URI?
I tried
msteams://teams.microsoft.com/l/channel/channelid/General?groupId=groupid&tenantId=tenantid&message=hello
but it just opens the channel in MSTeams
You can use share-to-teams button for posting message to teams channel withtout using api.
It really looks like MS doesn't support doing this via a simple URL (as of October 2021). As noted, the graph API should provide a way to do it but is complex to setup and get started with.
The best option I've found is to use an HTML mailto: link (see https://www.w3docs.com/snippets/html/how-to-create-mailto-links.html) and set the mail's "To" to the address from the team's "..." > "Get email address" dialog.
This pops up a compose window in your mail client (e.g. Outlook) and all you have to do is click Send to post it to your team channel. It supports passing through formatted text, and the email's subject is displayed prominently as the title of a new MS Teams Conversation.
I'm starting out with the Slack API and trying to just get a list of messages.
Here are my steps:
Created a Slack app and gave it channels:read and channels:history scope (also re-installed it)
Queried the list of channels with conversations.list (this worked fine)
From the output of conversations.list, I found a channel that I use and copied the id
Used the conversations.history api with the channelid from step 3
Result:
{ "ok": false, "error": "not_in_channel" }
I'm not at all sure what is happening here. I definitely have messages in the channel, and the documentation page for that api does not say anything about this "not_in_channel" error code.
What am I doing wrong?
After a long time of investigations (~2 hours), I found an easy approach. For Caleb's answer, I didn't understand how to invite a Bot to the channel. Hence, I am posting this answer.
Go to your Slack Channel and type the following as a message.
/invite #BOT_NAME
Eg: If your Bot name is SRE Incident Manager the command would be as follows.
/invite #sre_incident_manager
As soon as you start typing #, Slack will automatically suggest. So it becomes easy. For this, the Bot needs to be added to your Slack Workspace.
PS: Original answer.
The error not_in_channel has the exact meaning, your custom Slack app should be added to the channel.
Exact solution 1
To resolve the error, in the Web Slack interface:
Open channel settings
Click on the Integrations tab
Click Add apps and find your custom app.
Slack app might have different interface, see Iryna Vernik's answer.
Alternative solution 2
Give access to the bot to all channels by adding workspace wide scope, for example, chat:write.public. Depends on your needs and security requirements.
Alternative solution 3
To access the channel chat from API specify Incoming webhook. Slack will generate a unique URL with the token per each channel. Only convenient for a few channels.
This error arises when you are using the bot oauth token and the bot is not invited to the channel. To solve this you need to
Invite the bot(slack app) to join the channel.
Use the OAuth Access Token instead
To add Bot to your channel you need to write /invite #Bot_name in the slack channel
I also didn't understand how to invite a Bot to the channel. Way that was proposed by Caleb and Keet was not clear for me or not working. From my side, 'invite' work after
open channel
in Details tab, choose a 'More'clause
in dropdown menu, chouse an 'add app'
in pop-up look for you app (bot)
Also i was use Bot User OAuth Access Token, because i need this functionality in private channel (additionaly, you should add for bot groups:history scope)
FOr me, instead of invite a user/bot, I invite the app.
I'm getting started with the Slack API as well, and I've come to realize that not_in_channel simply means that the user/bot you are using the token for hasn't joined that particular channel you're trying to perform an action on.
Think of it this way: if you're using Slack on the web-browser or web-app, you wouldn't be able to post a message on a channel you haven't either joined or was invited to.
☝️ You'll also never run into this issue through the Slack UI/UX because you're not even able to access the channels UNTIL you are invited or join it.
Click to see png example of a slack message stating my bot being added to a channel
However, because we're using the API we can essentially skip some steps, and in this case we skipped the step where a user/bot has joined the channel before doing the action we're trying to perform (writing a message, grabbing information, etc).
💪 How to address this
There's probably plenty of ways to do it that I'm not versed in, but if you're just concerned about a specific channel or two without the concern of scaling to x channels I'll list the way that worked for me.
📇 /invite Slash Command
As others have mentioned, putting /invite in the message box lets you use Slack's slash command shortcut to add users. What's important is this way also allows us to invite bots to the channel.
Putting "#" triggers Slack to start auto-suggesting, which is why it then becomes easy to find your bot name in the list.
Click here to see screenshot example of the /invite command with #bot_name_here
Hope this helps answer people's question on why it's happening, and thank you to the original posts that got me out of my initial mess. 🙏
As all others said, you need to join each channel.
The bot can join channel programmatically by using API below:
https://api.slack.com/methods/conversations.join
Don't forget to add permission of conversations.join
How to get YouTube channel page id for creating Google BigQuery Data Transfer Service YouTube Channel as data source.
Trying to create transfer service from BQ console and CLI. Getting the following error from console and CLI.
Now I am using the pageId from this YouTube Channel URL: https://www.youtube.com/channel/XXXXXXXXXYYYYYYYYYY
From CLI:
bq mk --transfer_config --project_id=test-dts --target_dataset=YTChannelDTS --display_name='YTChannelTest' --params='{"page_id":"XXXXXXXXXYYYYYYYYYY","table_suffix":"MT","configure_jobs":"true"}' --data_source='youtube_channel'
BigQuery error in mk operation: Request contains an invalid argument.
From Console: refer the below image(error marked in red colour).
Navigate to https://www.youtube.com/account_advanced in order to see your YouTube account settings. You will then see a value for YouTube Channel ID. This is what you pass to BigQuery.
Update: After trying to replicate the above steps on a project that I was the Owner on, I encountered the same error message. The workaround was to:
Go to the IAM admin page
Select the project that will be housing your data transfer BigQuery dataset
Find your account
Add the BigQuery Admin privilege to your account
Retry the steps to set up your data transfer
Besides "Channel page ID", the help button says that it needs "The page ID of the Google+ page associated with the channel."
You can get it by visiting Google plus and then clicking on profile. The pageID will get appended to the URL:
https://plus.google.com/< pageID >
I cannot fully test this because I have just set up a reporting job and it can take up to 48 hours to get created so, for me, right now it fails with a "No reporting jobs found - please ensure that reporting jobs exist." but it looks that the transfer itself was created correctly.
On a side note, Gplus will soon be discontinued for personal accounts so, for such transfers to still work after April 2 on such accounts, I think you'll probably need to "Move channel to Brand Account". This option can be found under Account settings
I'm trying to leverage the beta api for assigning azure users to applications.
I looked at the documentation and tried a variety of attempts in a C# console app using HttpClient and WebClient and couldn't succeed. I then went to the Microsoft graph explorer https://developer.microsoft.com/en-us/graph/graph-explorer . I couldn't get it to work.
I looked at the documentation
https://developer.microsoft.com/en-us/graph/docs/api-reference/beta/api/approleassignment_get
The document's actual documentation of the HTTP request which doesn't match the Example. The Graph Explorer seems to hint that the example is correct, but through various attempts, I can only get a response of
{
"error": {
"code": "Request_UnsupportedQuery",
"message": "Direct queries to this resource type are not supported.",
...
}
}
My essential url is
https://graph.microsoft.com/beta/appRoleAssignments/
The example says {id} but I have no idea what to put in. I put in several guids, user ids, object ids, resource ids, and none worked.
It isn't saying any access denied messages so I assume it has nothing to do with Scopes (all though the documentation is a little empty regarding that as well).
Ideally, I'd be able to see if for a given Guest Azure User has access to a particular App, then I'd be able to go and Update the assignment. I'll probably also need to delete the assignment as well.
[Edit (2021-07-06): Use Microsoft Graph v1.0 for all of this.]
It looks like the Microsoft Graph API's beta endpoint doesn't currently allow you to list AppRoleAssignments.
[Edit (2018-10-11): The Microsoft Graph beta endpoint now supports the ability to list AppRoleAssignments, though you should still use Azure AD Graph for any production application, until it gets to v1.0.] Fortunately, the Azure AD Graph API does work for this (plus, it's not a beta endpoint, so it's more likely to be stable).
To list all app roles a user is assigned with Microsoft Graph:
https://graph.microsoft.com/v1.0/users/{id}/appRoleAssignments
To list all app roles a group is assigned:
https://graph.microsoft.com/v1.0/groups/{id}/appRoleAssignments
To do the reverse, and list all users or groups assigned to an app:
https://graph.microsoft.com/v1.0/servicePrincipals/{id}/appRoleAssignedTo
Azure AD Graph is deprecated and all support for it will cease in June 2022. The equivalent requests were (in the same order as above):
https://graph.windows.net/{tenant-id}/users/{id}/appRoleAssignments?api-version=1.6
https://graph.windows.net/{tenant-id}/groups/{id}/appRoleAssignments?api-version=1.6
https://graph.windows.net/{tenant-id}/servicePrincipals/{id}/appRoleAssignedTo?api-version=1.6
In the new Azure portal, under "Enterprise applications" > (your app) > "Users and groups", you'll see the list of users who are assigned to the application, as well as the app role they are assigned to. After testing , you could do the equivalent thing using Microsoft Graph API request :
https://graph.microsoft.com/beta/servicePrincipals/d0790296-0a14-4ab1-8f6c-4e4d3eb03036/appRoleAssignments
Your could get the service principal under "Enterprise applications" > (your app) >Properties>Object ID .Here is sample of the response :
id is the role id , In your scenario ,you could check whether record exists when the principalId matches the object id of the specific user , and principalType is user .