Botframework how log history -


do have idea how log outgoing/incoming messages? not sure how capture outgoing messages.

i use chains , forms. example

await conversation.sendasync(activity, rootdialog.buildchain); 

and

activity.createreply(.....); 

i found better solution

    public class bottouserlogger : ibottouser {     private readonly imessageactivity _tobot;     private readonly iconnectorclient _client;      public bottouserlogger(imessageactivity tobot, iconnectorclient client)     {         setfield.notnull(out _tobot, nameof(tobot), tobot);         setfield.notnull(out _client, nameof(client), client);     }      public imessageactivity makemessage()     {         var tobotactivity = (activity)_tobot;         return tobotactivity.createreply();     }      public async task postasync(imessageactivity message, cancellationtoken cancellationtoken = default(cancellationtoken))     {         await _client.conversations.replytoactivityasync((activity)message, cancellationtoken);     } }  public class bottouserdatabasewriter : ibottouser {     private readonly ibottouser _inner;     public bottouserdatabasewriter(ibottouser inner)     {         setfield.notnull(out _inner, nameof(inner), inner);     }     public imessageactivity makemessage()     {         return _inner.makemessage();     }      public async task postasync(imessageactivity message, cancellationtoken cancellationtoken = default(cancellationtoken))     {         // loging outgoing message         debug.writeline(message.text);          //todo log message example db          await _inner.postasync(message, cancellationtoken);     } 

in controller use

 public messagescontroller()     {         var builder = new containerbuilder();         builder.registertype<bottouserlogger>()             .asself()             .instanceperlifetimescope();          builder.register(c => new bottousertextwriter(c.resolve<bottouserlogger>()))             .asimplementedinterfaces()             .instanceperlifetimescope();         builder.update(microsoft.bot.builder.dialogs.conversation.container);     } 

Comments