Microsoft Teams webhook payload contains unusable Teams ID - httprequest

I have created an outgoing webhook for MS Teams. I pointed this to an Azure Function App which checks the authentication token and then forwards the payload through another webhook to a Flow (Power Automate) which replies to the original message in Teams.
This post addresses only one of the many problems this roadmap has, namely that the payload contains (amongst much else) the Teams Message ID, the Teams Channel ID and the Teams Team ID, as follows:
messageid=1578517604597 CORRECT. This is great
teamsChannelId=19:99c0a47caa884ffeabefc59305523414#thread.skype. This may look wierd but it's correct
teamsTeamId=19:c374b6b6d8cf4f17a9c77cd45399e90c#thread.skype Well this appears to just be wrong.
If I ask Flow to post a reply to the message on teams it will complain that the group ID is incorrect. It is referring to the Team ID.
If I open the original teams message in a browser and look at the URL I find the message ID and the channel ID as above. But the groupID is as follows:
groupId=006ff9ad-fdcc-4705-b651-93eef04361dc
Putting this in Flow works!
But if I search for this value in the JSON payload it is nowhere to be found!
Can it somehow be derived from the TeamID?
Any help is appreciated.
Thanks

Related

how to get the names of non-contact member in a skype group conversation?

I want to know how to get the names of non-friends in multi-person conversation in web.skype.com.
For example: in a multi-person conversation, there is a user A who is not my contact, but the web.skype web page can display the name of user A. Through Chrome's network tools, I am only getting a conversation history message record request I have seen the name of user A, but if user A has not sent a message, all the data obtained by request does not contain the name of user A.
If anyone knows and tells me how to get it, I would appreciate it
Skype dont provide an API who can do that, you need to implement a bot to give you this information.

How can a telegram bot broadcast a message to active chats / users

We are building an internal bot to monitor / control our software. It is NOT exposed to the public and will be used by other team members, either directly (as a direct chat) or through a few channels depending which side of the software is on topic.
The bot should do two things:
reply to commands; the reply should go to the user that originated it.
send notices to all users / channels it is involved in.
When a message arrives, I can get the channel id and the user id; while the user id is kind of guaranteed to exist for while, what is the situation with the channel?
Can I store the channel id and broadcast messages to all channels the bot is involved in? what happens if a channel is closed? do channel ids have lifetimes?
I can't really find anything online about the best practice regarding this scenario.
I have doubt Understand what you want but it seems better know these things :
ID's are unique in Telegram and even in all others applications so
they are lifetime
Channel ID , Groups ID , User ID have same behavior but their difference is on their integer. (User ID's are Positive but channels and groups are Negative. check example here)
Users can just send message in channels that they have admin permission in it right? Bots are same. so if your bot isn't admin anymore , the Telegram gives you error in response and you can check it and after facing that error delete that channel ID in your channels list.
I hope this information help you but if you have any other question feel free to leave a comment and I'll update the post and answer you immediately.

Identify unique user in Dialogflow V1

So I am testing out Dialogflow and one of the first questions I have is: how does my bot know who it is talking to? I need to identify a user and keep that information for as long as I can. The basic scenario being:
User starts his/her first conversation.
Chatbot send a fulfillment request to the server trying to match a user within its own database.
The user is found, the information (as a JWT or some other token) is sent back to Dialogflow and stored there for further communication. In reality, this part would involve asking for user email, sending a verification code to that email and then verifying the user with the code.
User then starts chatting with a bot and all fulfillment requests get the unique token stored for this very user, so that my REST API knows which user is being served with the response.
Couldn't find anything about it in the docs (maybe I am looking in the wrong places).
There will be several integrations, like Messenger, Viber, Telegram. I dunno, maybe those APIs add some unique information on the user?...
Thanks for the help!
Sorry, I know it's been a while, but maybe this will help someone else.
The right solution here is a user id, not a session id. A user id is provided by the chat platform (Facebook, Slack etc) and is consistent across sessions for the same user.
To get the user id, go to the Fulfillment tab, enable the editor and use a function like so:
let r = request.body.originalDetectIntentRequest
//this makes sure that you're on an integration
if (r["source"]){
return r.payload.data.sender.id;
}
To tie together ids from different platforms, you probably have to have some kind of log-in process every time you encounter a new id on a platform.
Pop,
Sessions are built in already into DialogFlow requests to your fulfilment service, if you check the payload you will find a sessionId, it remains the same for the same client until it expires.
However if you want to identify the user from any of the clients that you can connect to DialogFlow like Messenger then from the same request payload to you you will notice that there is an object named originalRequest that is only available when requests are coming from those clients.
You can personalize those users response eg using their FB firstname in a message to them.

Sharing private survey with service account email address

I've created a service account from the initial guide and am using the same sample code published on the Google Surveys GitHub repo.
I see that I have to add my service account email as an owner to the individual survey from other answers to get the results, but so far this isn't working. It looks like an email is sent to that address to verify ownership, but nothing is sent to me. Is there another way to confirm this please?
I'm using the correct credentials JSON file in oauth.py but all requests return the following:
Error fetching survey results: <HttpError 403 when requesting https://www.googleapis.com/surveys/v2/surveys/{id}/results?alt=media returned "Forbidden">
Am I missing something? Thanks in advance for any help.
To check the current owners of the survey, you have two options:
1) Google Surveys UI. Click on the survey on the Your Surveys page. Next, click on the Confirm Survey tab and look at the Details section at the bottom of the page. This will show you the current owners of the survey, and give you the option to add one.
2) Use the OAuth Playground (the Getting Started Guide has detailed directions). Call "get" on the survey to see its owners list (see "Send a GET request to examine a survey").
You can use the API to update the owners without the need for a confirmation email.
Follow the directions in the Getting Started Guide to set up the OAuth Playground with credentials attached to the Google account that owns this particular survey.
Then, use the PUT method on your survey to update the owners. Make a request in the OAuth Playground with:
HTTP Method: PUT
Request URI: https://www.googleapis.com/surveys/v2/surveys/{survey id}
Enter request body: { "owners": ["my_service_account#something.gserviceaccount.com"] }
Hope this helps! I'm on the Google Surveys team; if you have any further issues, feel free to send me the request ID for your failed request, so I can debug in more detail.

RabbitMQ - how to avoid to receive own messages

I am creating a service (accessible via web and app) where users belong to a team. Whenever a user does something, all the other online users (*) in his/her team must be notified. I am evaluating RabbitMQ for this.
(*) Note that it is possible that the same user has multiple sessions at the same time: he could be logged in in different browsers at the same time, or more likely in the browser and and app at the same time.
My current approach is to create a topic exchange for each team:
When a user logs in, an auto-delete queue is created and bound to the exchange of his/her team.
When a user did an update, the backend sends a message to the exchange of the corresponding team.
Finally, all active queues - that is, all active sessions - receive the update message.
This is great, because the update message must only be sent once by the backend. However, the problem here is that the initiator also receives his own update. I would like to avoid that. Is that possible? Or should I have another design?
Ofcourse, I can always add the user identifier of the initiator in the payload of the update message and filter on that field when receiving an update message, but the message is still received.
That is an interesting question. After thinking about this for a while with this particular design, when the user wants to get the update and also make some changes while others should know about it I feel like you need to think of some other design.
With Topic as an Exchange you will always get the notification as the queue is created when you logged into the system. And Topic will broadcast it.
The topic is more for a subscription kind of thing where you can not specify easily where you want to skip one subscription or not.
One design I can think of which is bit complicated is as follow:
Create one Topic Exchange per person in the team.
When another User logs in he will subscribe to the Exchange of all other team members.
When a user makes an update it is sent to his own Exchange where all others are listening.
That way the user will not get his own update as he is listening to others topics.