I spent several hours trying to solve this stuff.
I need to subscribe a gmb business to pub/sub push notifications. I was able to send/receive messages via gcloud console. Successfully created a topic and a subscription. The problem is that i need to subscribe gmb accounts , but I'm getting this error:
(had to edit this question, the code is better than images)
The request:
PUT https://mybusiness.googleapis.com/v4/accounts/102834134483270918765/notifications
{
"topicName": "projects/probable-pager-194417/topics/fetchReviews",
"notificationTypes": [
"NEW_REVIEW", "UPDATED_REVIEW", "GOOGLE_UPDATE"
]
}
The Response:
{
"error": {
"code": 400,
"message": "Request contains an invalid argument.",
"status": "INVALID_ARGUMENT",
"details": [
{
"#type": "type.googleapis.com/google.mybusiness.v4.ValidationError",
"errorDetails": [
{
"code": 3,
"message": "Invalid topic name provided for subscription. Ensure that the topic exists and is shared with the GMB API service account.",
"value": "projects/probable-pager-194417/topics/fetchReviews"
}
]
}
]
}
}
Finally i found the solution. You need to give Pub/Sub Publisher permission in your topic to this account: 'mybusiness-api-pubsub#system.gserviceaccount.com. Have no idea why.
**Exactly that string
Related
I have been trying to figure out how to use the beta notifications resource to send push notifications to users in Teams, but I cannot get past step 1.
User signs in to your application, which creates a subscription with the Microsoft Graph notification service.
I am not using a language with Microsoft library support so I cannot use their SDKs. Instead, I am manually sending http requests. I have tried many, but I can't even nail down what the "resource" is supposed to be in the subscription type. Here are some of the things I have tried and the results:
Sending this message:
{
"changeType": "created",
"notificationUrl": "https://(...)/notifications",
"resource": "me/notifications",
"expirationDateTime": "2020-11-04T18:23:45.9356913Z"
}
Results in:
{
"error": {
"code": "InvalidRequest",
"message": "Subscription for resource 'me/notifications' is not supported.",
"innerError": {
"date": "2020-11-04T17:12:24",
"request-id": "66172d3c-298d-47d4-babb-52d96ef42179",
"client-request-id": "1c20849c-fcda-0b07-56e3-5bed08bb28e4"
}
}
}
The above message also correctly calls my server's /notifications route with this param:
Validation: Testing client application reachability for subscription Request-Id: 2f3cc3b8-b2c2-5922-451c-433add43bc74
Sending this one:
{
"changeType": "created",
"notificationUrl": "https://(...)/notifications",
"resource": "notification",
"expirationDateTime": "2020-11-04T18:23:45.9356913Z"
}
Results in:
{
"error": {
"code": "BadRequest",
"message": "Resource not found for the segment 'notification'.",
"innerError": {
"date": "2020-11-04T17:21:15",
"request-id": "d894c93b-9dac-4051-a3af-cb6039f1394b",
"client-request-id": "84d18ec7-2c67-8240-b576-03641b3b5a59"
}
}
}
I have also tried "notifications", "users/me/notifications", and a few others to no avail. What's the deal, Microsoft? This resource isn't even listed under the possible subscription types in the beta docs, so is it supported or not?
At this point I'm pretty sure this functionality just doesn't work/exist.
I have created a private channel in a team and added members to it using the Microsoft graph beta API. But I'm not able to remove a member from the channel.
I call this method DELETE https://graph.microsoft.com/beta/teams/{teamid}/channels/{channelid}/members/{id}, but I receive this response "error": {
"code": "BadRequest",
"message": "Invalid id '{id}' provided.",
"innerError": {
"request-id": "11d58a76-d953-49ce-a086-418ce5eea09b",
"date": "2020-05-29T04:37:21"
}
}
According to the documentation I might be getting this if channel isn't private. But in my case, it is. Also I am able to retrieve the user by calling this: https://graph.microsoft.com/beta/users/{id}.
Does this sound familiar to anyone else? What am I doing wrong?
I am trying to send a message from a bot to a teams user who hasn't already installed the bot and doesn't need to install the bot via REST API.
I have tried following this document.
It clearly states:
"Sending a message to start a new conversation thread is different than sending a message in response to an existing conversation: when your bot starts a new a conversation, there is no pre-existing conversation to post the message to. In order to send a proactive message you need to:"
As far as I understand, this means that what I am trying to do is possible. I have tried to run this sample.
However, as far as I can tell it needs a conversation id. Without a conversation id it doesn't work.
I have tried to send a request like this with a bot network token ( which is normally used to respond to an activity request by the user):
POST /v3/conversations
{
"bot": {
"id": "28:10j12ou0d812-2o1098-c1mjojzldxcj-1098028n ",
"name": "The Bot"
},
"members": [
{
"id": "29:012d20j1cjo20211"
}
],
"channelData": {
"tenant": {
"id": "197231joe-1209j01821-012kdjoj"
}
}
}
However, it fails with the following message:
Send Message to https://graph.microsoft.com/v3/conversations failed: (401) {
"error": {
"code": "InvalidAuthenticationToken",
"message": "Access token validation failure. Invalid audience.",
"innerError": {
"request-id": "92922235-8c87-47ed-92bc-4ba17469611a",
"date": "2019-09-24T14:43:59"
}
}
}
I am guessing that this maybe because I didn't send MicrosoftAppCredentials.TrustServiceUrl first. But this is a c# call. How do I make the same call in REST API?
Please take a look at Bot Framework REST APIs documentation.
Here are steps to generate the access token which you could use to call Create Conversation APIs.
POST https://login.microsoftonline.com/botframework.com/oauth2/v2.0/token
Host: login.microsoftonline.com
Content-Type: application/x-www-form-urlencoded
grant_type=client_credentials&client_id=MICROSOFT-APP-ID&client_secret=MICROSOFT-APP-PASSWORD&scope=https%3A%2F%2Fapi.botframework.com%2F.default
When I create a group in MS Teams using REST API in postman.
URL: https://graph.microsoft.com/beta/groups
Request Body:
{
"description": "Self help community for golf",
"displayName": "Golf Assist",
"groupTypes": [
"Unified"
],
"mailEnabled": true,
"mailNickname": "golfassist",
"securityEnabled": false
}
I got an error. Error is given below.
{
"error": {
"code": "InternalServerError",
"message": "Value cannot be null.\r\nParameter name: value",
"innerError": {
"request-id": "4a57c3e2-47a4-46bd-a5bb-a00a612fd613",
"date": "2019-04-02T16:31:30"
}
}
}
How can I correct this issue?
We've checked the logs on your request and it appears that you are calling the graph with a Microsoft Account (aka MSA) versus an Azure Active Directory (Azure AD) account. Microsoft Graph APIs for Teams do not support MSA accounts, only Azure AD accounts.
I am seeing the Same exact error when trying to Create a Shift in Teams.
This one is still in Beta.
I am trying to use Google Cloud Logging API to write log entries from a web application I'm developing (happens to be .net).
To do this, I must use the logging.projects.logs.entries.write request. This request dictates that I provide a serviceName argument:
{
"entries": [
{
"textPayload": "test",
"metadata":
{
"serviceName": "compute.googleapis.com"
"projectId": "...",
"region": "us-central1",
"zone": "us-central1-a",
"severity": "DEFAULT",
"timestamp": "2015-01-13T19:17:01Z",
"userId": "",
}
}]
}
Unless I specify "compute.googleapis.com" as the serviceName I get an error 400 response:
{
"error":
{
"code": 400,
"message": "Unsupported service specified",
"status": "INVALID_ARGUMENT"
}
}
For now using "compute.googleapis.com" seems to work but I'm asking - what service name should I give, given that I'm not using Google Compute Engine or Google App Engine here?
The Cloud Logging API currently only officially supports Google resources, so the best course of action is to continue to use "compute.googleapis.com" as the service and supply the labels "compute.googleapis.com/resource_type" and "compute.googleapis.com/resource_id", which are used for indexing and visible in the UI drop-downs.
We also currently permit the service name "custom.googleapis.com" with index labels "custom.googleapis.com/primary_key" and "custom.googleapis.com/secondary_key" but that is not officially supported and subject to change in a future release.