question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

role property is not set for messages sent by bot

See original GitHub issue

Description (Actual behavior)

I noticed that in the the Web Chat channel

  • the role property is not set in from 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:closed
  • Created 4 years ago
  • Comments:18 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
tdurnfordcommented, Apr 19, 2019

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.

adapter.use(new TranscriptLoggerMiddleware(new ConsoleTranscriptLogger()));

Emulator Untitled

WebChat Untitled1

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

0reactions
hansmbakkercommented, Sep 11, 2019

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found