Nov 27 2021 04:47 AM
Hello, I need to send notifications to my colleagues using Teams in case of emergency which is detected by monitoring system. These messages must be sent on behalf of background service which cannot follow interactive user authentication flow and therefore cannot get Authorization Code to authenticate on behalf of user.
I can connect to Azure AD using Graph SDK for Golang and get all users of my organization. But I cannot use Chat API because it's not allowed in "application only context".
Is there a way to send personal user messages from daemon service?
Dec 01 2021 01:12 AM
@DVTitov -We are looking into this I will get back to you soon.
Dec 07 2021 12:44 AM - edited Dec 07 2021 12:47 AM
@DVTitov - You can send a personal messages to different users in Teams with daemon service but you will need to store their information like Service URL, conversation id in storage while installing the bot.
You can do it like below:
var conversationReference = new ConversationReference
{
ServiceUrl = serviceUrl,
Conversation = new ConversationAccount
{
Id = conversationId,
},
};
await this.botAdapter.ContinueConversationAsync(
botAppId: this.microsoftAppId,
reference: conversationReference,
callback: async (turnContext, cancellationToken) =>
{
// Send message.
var activityResponse = await policy.ExecuteAsync(async () => await turnContext.SendActivityAsync(message));
return response;
}
Reference link:
BotAdapter.ContinueConversationAsync Method (Microsoft.Bot.Builder) | Microsoft Docs
Dec 07 2021 02:14 AM
Dec 07 2021 11:55 PM
Dec 08 2021 12:21 AM
Dec 08 2021 11:29 PM - edited Dec 09 2021 10:43 PM
Solution@DVTitov - We got a confirmation from engineering team that
"To post as a background service, the user must use a bot."
So currently we do not have any way to send the direct message to user using Graph API.
Thanks,
Chetan Sharma
----------------------------------------------------------------------------------------
If the response is helpful, please click "**Mark as Best Response**" and like it. You can share your feedback via Microsoft Teams Developer Feedback link. Click here to escalate.
Feb 27 2024 05:35 AM
Dec 08 2021 11:29 PM - edited Dec 09 2021 10:43 PM
Solution@DVTitov - We got a confirmation from engineering team that
"To post as a background service, the user must use a bot."
So currently we do not have any way to send the direct message to user using Graph API.
Thanks,
Chetan Sharma
----------------------------------------------------------------------------------------
If the response is helpful, please click "**Mark as Best Response**" and like it. You can share your feedback via Microsoft Teams Developer Feedback link. Click here to escalate.