So I've recently been working on a server-side application which collects message lists from users, based on history id. I am doing full syncs.
Normally, I get responses like this:
{
"messages": [
{
"id": "14d9c91dbba84646",
"threadId": "14d9a7f9b36c65ae"
},
],
"nextPageToken": "14788016228466612591",
"resultSizeEstimate": 832
}
which is precisely what I get in 99% of cases. However, for some users, I get only this:
{"resultSizeEstimate":0}
with no other information. Note that this is on a full sync. I find this odd, because even on brand new email accounts, I receive the oldest information. One of the emails providing this result is an #yahoo.com email. Which in itself is not so odd, since non-gmail accounts can have OAuth credentials. However, normally when a user has no gmail inbox I instead get a 400 error with failedPrecondition. Can anybody provide some insight on this behaviour?
Related
I am exporting Teams chat history to html and need to work out how to query for the chat name.
When I know the chat id I can get the chat with
graphClient.me().chats("19:xxxxgbl.spaces").messages()
I can then page through the collection and output all the chats.
However, I don't know how to get the chat id from the API in the first place.
I was able to find the first one from the Graph Explorer with /beta/me/chats and then searching the preview for a channel name and finding the name in the topic field.
The same section/value doesn't exist for one on one chats with a colleague though. When I search the output of /beta/me/chats for my colleagues name it doesn't find it.
When I scroll down the output I see it has a webUrl field. Clicking on the 3rd item of the response to /beta/me/chats shows me the 3rd chats in the sidebar of Teams.
How can I find the chat id with the Java API if I know my colleagues name that I am chatting with?
Have you tried using the Search endpoint https://learn.microsoft.com/en-us/graph/search-concept-chat-messages . You can query on To, From or use Participants which would return anything where the target either sends or received a chat message eg
POST https://graph.microsoft.com/v1.0/search/query
{
"requests": [
{
"entityTypes": [
"chatMessage"
],
"query": {
"queryString": "participants:blah#blah.com"
}
}
]
}
This then returns both the ChatId and the MessageId
There is also an Export API https://learn.microsoft.com/en-us/microsoftteams/export-teams-content (it has a cost involved) if you where doing things a tenant level.
I'm sending messages as individual/group, but the are identified by Whatapp Business Account Entrprise as but how are identified enterprise as group/individual, and I'm trying to figure out why.
This is the facebook for developers pages documenting Sending Group Messages
Here's an example of sending a message
http://localhost:8080/v1/messages type -post
Request :
{
"to": "{{Recipient-WA-ID}}",
"type": "text",
"recipient_type": "individual",
"text": {
"body": "I am Akash"
}
}
The API properly returns an ID for the message, but how can distinguish whether this message was sent from an individual Person versus a Whats-app group?
When I send a message as an individual person, the API response ID for the message seems to arrive the same was as if it was sent from a group. How can I figure out if it is from a group of the Enterprise (example clients include SBI Bank, JP Morgan, U.S. Bankcorp, etc...)
I have two projects Project-A and Project-B.
On Project-A I have a service account loader#project-a.iam.gserviceaccount.com which I want to use to read messages from Project-B PubSub topic.
I've created a topic subscription on Project-B projects/project-b/subscriptions/data. Then added loader#project-a.iam.gserviceaccount.com in Permissions tab as a Subscriber. I believe it should give me access.
But if I try:
TestIamPermissionsRequest iamreq = new TestIamPermissionsRequest();
iamreq.setPermissions(Arrays.asList(
"pubsub.subscriptions.consume",
"pubsub.subscriptions.get"
));
pubsub.projects().subscriptions()
.testIamPermissions(topicSubscription, iamreq).execute();
It returns empty list of permissions.
And for actual pull request:
PullRequest pull = new PullRequest();
pull.setMaxMessages(1);
pull.setReturnImmediately(true);
pubsub.projects().subscriptions().pull(topicSubsription, pull).execute();
It fails with:
com.google.api.client.googleapis.json.GoogleJsonResponseException: 403
{
"code" : 403,
"errors" : [ {
"domain" : "global",
"message" : "User not authorized to perform this action.",
"reason" : "forbidden"
} ],
"message" : "User not authorized to perform this action.",
"status" : "PERMISSION_DENIED"
}
I've double checked that service account is in Subscribers list, also tried to remove/add it again, etc. Tried with different project. It doesn't change anything.
If I have PubSub Topic Subscription and Service Account under same Cloud Project, then it works fine, for both testIamPermissions and pull requests. Does it mean that IAM Service Account cannot be used to get access to PubSub from another project?
Please note that it works fine for Storage access from other project. Which means that problem is specific only to PubSub. That's why I think I've missed something on PubSub configuration side. But what exactly?
To consume from Topic Subscription role "Subscriber" should be given to the Subscription. Unfortunately it's not possible with Cloud Console right now.
The problem was that Cloud Console is misleading, by selecting a Topic I expect to setup permissions to Topic Subscriptions also (because there're no separate UI for Topic Subscriptions after all). But it's doesn't work like this, Permissions form applies changes only to selected Topic, ignoring all existing Topic subscriptions. Basically you cannot view or edit Subscriber permissions, there're no such UI currently.
PS There're a way to do that via API, though. But it doesn't work for my situation
We have an API with Googe App Engine. The API consist on a search engine, when a user requests a productID the API returns a json with a group of other productIDs (with a specific criteria). This is the current configuration:
<instance-class>F4_1G</instance-class>
<automatic-scaling>
<min-idle-instances>3</min-idle-instances>
<max-idle-instances>automatic</max-idle-instances>
<min-pending-latency>automatic</min-pending-latency>
<max-pending-latency>automatic</max-pending-latency>
</automatic-scaling>
We use app_engine_release=1.9.23
The process does as follows. We have two calls to datastore and a call with urlfetch (to an external API).
The problem consist on that from time to time we receive en error 204 with this trace:
ms=594 cpu_ms=0 exit_code=204 app_engine_release=1.9.23
A problem was encountered with the process that handled this request, causing it to exit. This is likely to cause a new process to be used for the next request to your application. (Error code 204)
This is what we got in the client:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "backendError",
"message": ""
}
],
"code": 503,
"message": ""
}
}
We changed the number of resident instances from 3 to 7 and we got the same error. Also the errors occur in the same instances. We see 4 errors within a very small amount of time.
We found that the problem was with the urlfecth call. If we put a high timeout, then it returns a lot of errors.
any idea why this is happening???
I believe I have found the problem. The problem was related to the urlfetch call. I did many tests until I isolate the problem. When i did calls only to datastore everything worked as expected. However when I added the urlfetch call it produced the 204 errors. It happened always so I believe that could be a bug.
What I did to get rid of the error was to remove the cloud end point from Google and use a basic servlet. I found that mixing the servlet with the urlfetch call we don't get the error, therefore the problem might not be only related to urlfetch but a combination of urlfetch and Google cloud end point.
When you verify signed JSON which comes when a user has completed transaction there is obvious need to verify that this particular purchase was made by a particular user. It especially important to prevent the possibility of changing the userId when you send for example userId and signed JSON to your server for verification purposes. But there are no such fields in signed JSON.
So is it OK to place some userId in developerPayload field ?
{ "nonce" : 1836535032137741465,
"orders" :
[{ "notificationId" : "android.test.purchased",
"orderId" : "transactionId.android.test.purchased",
"packageName" : "com.example.dungeons",
"productId" : "android.test.purchased",
"developerPayload" : "bGoa+V7g/yqDXvKRqq+JTFn4uQZbPiQJo4pf9RzJ",
"purchaseTime" : 1290114783411,
"purchaseState" : 0,
"purchaseToken" : "rojeslcdyyiapnqcynkjyyjh" }]
}
Yes. It is OK to place some user identity in the developer payload. When you receive that back in the PURCHASE_STATE_CHANGED broadcast you can then send this on to your own server.
This is especially relevant to unmanaged items where you need to maintain purchase and use of those items per user on your own server.
The real question is what user identity are you going to send and where are you going to get it from. It can't be device specific because a user may have multiple devices. It really needs to be an identity provided by Google Play. But I don't know how to find that.