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...)
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 want user id of the subscribers. In the documentation, it only shows the callbacks like :
{
"event":"conversation_started",
"timestamp":1457764197627,
"message_token":4912661846655238145,
"type":"open",
"context":"context information",
"user":{
"id":"01234567890A=",
"name":"John McClane",
"avatar":"http://avatar.example.com",
"country":"UK",
"language":"en",
"api_version":1
},
"subscribed":false
}
Link to documentation you provided is about Webhook Events that comes when some particular user subscribed.
What you can do is to get information about your subscribers using Get Account Info endpoint. Its response contains subscribers_count and members (list with fields: id, name, avatar and role).
P.S. the only thing that you need to check is if the public account subscribers are chat bot subscribers too.
When sending SMS using the Notify API, I get back a Notify sid.
Body:
"sid":"NT49cefe1c684f470648e59883c1bcc556",
In the dashboard at Twilio.com, I've configured Notify with a Messaging Service. That Messaging Service has been configured to call my custom web service (webhook in Twilio terminology). I am getting status coming through for every binding the message was sent to, but no ID of the originating Notify 'event' so I can tie them together.
I was expecting to see the "NT" id somewhere.
Body:
SmsSid=SM89ca8924434306734be97ecb28c5b5cc
SmsStatus=delivered
MessageStatus=delivered
MessagingServiceSid=MG767836bd41ab8b07c00d41582f15f2a1
MessageSid=SM89ca8924434306734be97ecb28c5b5cc
How can I tie these webhook statuses to the originating Notify?
Twilio provides no way to link notifications to the individual messages. (see https://stackoverflow.com/a/52157927/1196148)
However, you can use the status_callback parameter to specify a custom webhook URL that is unique to this notification. Add an extra parameter so the webhook can find the resource that triggered the notification:
$notification = $client
->notify->services( $serviceSid )
->notifications->create( [
"toBinding" => [
'{"binding_type":"sms", "address":"+15555555555"}',
'{"binding_type":"sms", "address":"+16666666666"}',
],
"body" => "Hello",
"sms" => [
"status_callback" => "https://example.com/status/?id=" . $some_id,
],
] );
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
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?