role property is not set for messages sent by bot
See original GitHub issueDescription (Actual behavior)
I noticed that in the the Web Chat channel
- the
role
property is not set infrom
for messages sent by the bot - the role is set correct for messages sent by the user however
This applies both to
- the embed WebChat from the Azure Portal, hosted at
https://webchat.botframework.com/embed/<botId>?s=<secret>
- self-hosted webchat using the Full Bundle example from the WebChat readme
Therefore, I cannot search for message sent by the bot by filtering
- by
type == "message"
AND - by
role == "bot"
(since role = bot
is not set, zero messages are found)
The bot emulator correctly fills the role property though.
Expected behaviour
When a user has a conversation with the bot, I can get messages sent by the bot by filtering
- by
type == "message"
AND - by
role == "bot"
Workaround
To get bot messages: filter activities in the webchat
- by
type == "message"
AND - by
role != "user"
Related PRs
Issue Analytics
- State:
- Created 4 years ago
- Comments:18 (10 by maintainers)
Top Results From Across the Web
Discord bot js v13, is not removing the specific role and ...
Use guild.members.fetch() for fetching all members from a server. Instead of using message.guild.roles.cache.get(role.id) in has() ...
Read more >Respond with messages in Composer - Microsoft Learn
This property can be defined programmatically, as in the Responding with Text example, or can be set at run-time based on user input....
Read more >Using Oracle Digital Assistant
This property is ignored if the skill does not belong to a digital assistant. No. translate, Overrides the value set for the autoTranslate...
Read more >Choose your bot actions - Knowledge Base - HubSpot
Select your action: Send simple message; Ask a question; Offer email subscription; Set contact property value; Set company property value; Add ...
Read more >Messaging - Messenger Platform - Meta for Developers
To send messages to someone on Messenger, the conversation must be initiated by the user. Messages sent with the Messenger Platform are classified...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Just taking a look at the ConsoleTranscriptLogger, you are correct. The from attribute in Activities sent by the bot are being set properly when client is the emulator but not WebChat. Take a look at the screenshots below.
Emulator
WebChat
I think it’s worth noting that the TranscriptLoggerMiddleware sets the role for Activities sent by the user if it is missing.
https://github.com/Microsoft/botbuilder-dotnet/blob/a5ba0c40aa962188ce52a8a152af1128dcfa7aa1/libraries/Microsoft.Bot.Builder/TranscriptLoggerMiddleware.cs#L55
Ok, I’ll look into writing middleware that does it.
@corinagum @compulim what is the risk of not removing the
bot
role? I don’t understand why it needs to be cleared afterwards.