Make bot send message every day at specific timewhat happens to ASP.NET exceptions from created non-threadpool thread?Databinding issue with stopwatched elapsedString not getting value from string in requete.csNetMQ - messages only work on reply to incoming message, not to other portUnable to find Use.RunTimePageInfo() method in startup.cs file in aspnet corec# Serialize with JSON.NET inherited private fieldsXamarin.Forms Google API Authenticating Users with an Identity Providercannot convert from threading task<bool> to system actionBot Framework sending OPTIONS messageCannot send message to Bot

Some numbers are more equivalent than others

Reply 'no position' while the job posting is still there

Engineer refusing to file/disclose patents

Are lightweight LN wallets vulnerable to transaction withholding?

Why do IPv6 unique local addresses have to have a /48 prefix?

Proving a function is onto where f(x)=|x|.

Did arcade monitors have same pixel aspect ratio as TV sets?

Why has "pence" been used in this sentence, not "pences"?

How do I repair my stair bannister?

Can I use my Chinese passport to enter China after I acquired another citizenship?

Is camera lens focus an exact point or a range?

How do ground effect vehicles perform turns?

Divine apple island

Greco-Roman egalitarianism

Java - What do constructor type arguments mean when placed *before* the type?

Can someone explain how this makes sense electrically?

Why is Arduino resetting while driving motors?

Fly on a jet pack vs fly with a jet pack?

Has Darkwing Duck ever met Scrooge McDuck?

What is this type of notehead called?

ArcGIS not connecting to PostgreSQL db with all upper-case name

Is XSS in canonical link possible?

Diode in opposite direction?

Longest common substring in linear time



Make bot send message every day at specific time


what happens to ASP.NET exceptions from created non-threadpool thread?Databinding issue with stopwatched elapsedString not getting value from string in requete.csNetMQ - messages only work on reply to incoming message, not to other portUnable to find Use.RunTimePageInfo() method in startup.cs file in aspnet corec# Serialize with JSON.NET inherited private fieldsXamarin.Forms Google API Authenticating Users with an Identity Providercannot convert from threading task<bool> to system actionBot Framework sending OPTIONS messageCannot send message to Bot













4















I am building a bot with Bot Framework, that is supposed to run in MS Teams and I want it to send me a message every day at 6:30 in the morning.



I have a method that is called every day at 6:30 inside the Program file.
And I have a method that sends a message from the bot.



This is the code for my timer:



private static Timer _timer;

private static int count = 1;


public static void Main(string[] args)

//Initialization of _timer
_timer = new Timer(x => callTimerMethod(); , null, Timeout.Infinite, Timeout.Infinite);
Setup_Timer();

BuildWebHost(args).Run();


/// <summary>
/// This method will execute every day at 06:30.
/// </summary>
public static void callTimerMethod()

System.Diagnostics.Debug.WriteLine(string.Format("Method is called"));
System.Diagnostics.Debug.Write(DateTime.Now.ToString("dddd, dd MMMM yyyy HH:mm:ss"));
count = count + 1;


/// <summary>
/// This method will set the timer execution time and will change the
/// tick time of timer.
/// </summary>
private static void Setup_Timer()

DateTime currentTime = DateTime.Now;
DateTime timerRunningTime = new DateTime(currentTime.Year, currentTime.Month, currentTime.Day, 6, 30, 0);
timerRunningTime = timerRunningTime.AddDays(1);

double tickTime = (double)(timerRunningTime - DateTime.Now).TotalSeconds;

_timer.Change(TimeSpan.FromSeconds(tickTime),
TimeSpan.FromSeconds(tickTime));



And what i want to archive is that I want to change the content of callTimerMethod() to this method:



public async Task AlertSubscribers(ITurnContext turncontext, CancellationToken cancellationToken = default(CancellationToken))

using (var db = new DataBaseContext())

var msg = "";
var today = DateTime.Today.ToString("dddd");
var product = db linq code;

foreach(var prod in product)

msg = $"Reminder! prod.bla";


// Get the conversation state from the turn context.
var state = await _accessors.CounterState.GetAsync(turncontext, () => new CounterState());

// Set the property using the accessor.
await _accessors.CounterState.SetAsync(turncontext, state);

// Save the new turn count into the conversation state.
await _accessors.ConversationState.SaveChangesAsync(turncontext);

// Echo back to the user whatever msg is.
await turncontext.SendActivityAsync(msg);




But I can't find a way to archive it... Would really appreciate some help, I have searched around a lot but havent found a similar problem.



The problem is all the namespaces (for an example ITurncontext, Conversationstate, and so on...)



Hope that describes my problem...



Thanks in advance!



EDIT:



It doesn't nessessarly need to be the AlertSubscribers() method, but a function och just code that does the similar thing.



I have tried this code but i cant get it to make the bot send a message to the user(in this case me in the Emulator):



public static void callTimerMethod()

IMessageActivity message = Activity.CreateMessageActivity();

message.Text = "Hello!";
message.TextFormat = "plain";
message.Locale = "en-Us";
message.ChannelId = "emulator";
message.Id = "A guid";
message.InputHint = "acceptingInput";
message.LocalTimestamp = DateTimeOffset.Now;
message.ReplyToId = "A guid";
message.ServiceUrl = "http://localhost:50265";
message.Timestamp = DateTimeOffset.Now;
message.Type = "ConversationUpdate";

message.AsConversationUpdateActivity();




I am new to Bot framework so my code and my thaughts may be wrong...











share|improve this question




























    4















    I am building a bot with Bot Framework, that is supposed to run in MS Teams and I want it to send me a message every day at 6:30 in the morning.



    I have a method that is called every day at 6:30 inside the Program file.
    And I have a method that sends a message from the bot.



    This is the code for my timer:



    private static Timer _timer;

    private static int count = 1;


    public static void Main(string[] args)

    //Initialization of _timer
    _timer = new Timer(x => callTimerMethod(); , null, Timeout.Infinite, Timeout.Infinite);
    Setup_Timer();

    BuildWebHost(args).Run();


    /// <summary>
    /// This method will execute every day at 06:30.
    /// </summary>
    public static void callTimerMethod()

    System.Diagnostics.Debug.WriteLine(string.Format("Method is called"));
    System.Diagnostics.Debug.Write(DateTime.Now.ToString("dddd, dd MMMM yyyy HH:mm:ss"));
    count = count + 1;


    /// <summary>
    /// This method will set the timer execution time and will change the
    /// tick time of timer.
    /// </summary>
    private static void Setup_Timer()

    DateTime currentTime = DateTime.Now;
    DateTime timerRunningTime = new DateTime(currentTime.Year, currentTime.Month, currentTime.Day, 6, 30, 0);
    timerRunningTime = timerRunningTime.AddDays(1);

    double tickTime = (double)(timerRunningTime - DateTime.Now).TotalSeconds;

    _timer.Change(TimeSpan.FromSeconds(tickTime),
    TimeSpan.FromSeconds(tickTime));



    And what i want to archive is that I want to change the content of callTimerMethod() to this method:



    public async Task AlertSubscribers(ITurnContext turncontext, CancellationToken cancellationToken = default(CancellationToken))

    using (var db = new DataBaseContext())

    var msg = "";
    var today = DateTime.Today.ToString("dddd");
    var product = db linq code;

    foreach(var prod in product)

    msg = $"Reminder! prod.bla";


    // Get the conversation state from the turn context.
    var state = await _accessors.CounterState.GetAsync(turncontext, () => new CounterState());

    // Set the property using the accessor.
    await _accessors.CounterState.SetAsync(turncontext, state);

    // Save the new turn count into the conversation state.
    await _accessors.ConversationState.SaveChangesAsync(turncontext);

    // Echo back to the user whatever msg is.
    await turncontext.SendActivityAsync(msg);




    But I can't find a way to archive it... Would really appreciate some help, I have searched around a lot but havent found a similar problem.



    The problem is all the namespaces (for an example ITurncontext, Conversationstate, and so on...)



    Hope that describes my problem...



    Thanks in advance!



    EDIT:



    It doesn't nessessarly need to be the AlertSubscribers() method, but a function och just code that does the similar thing.



    I have tried this code but i cant get it to make the bot send a message to the user(in this case me in the Emulator):



    public static void callTimerMethod()

    IMessageActivity message = Activity.CreateMessageActivity();

    message.Text = "Hello!";
    message.TextFormat = "plain";
    message.Locale = "en-Us";
    message.ChannelId = "emulator";
    message.Id = "A guid";
    message.InputHint = "acceptingInput";
    message.LocalTimestamp = DateTimeOffset.Now;
    message.ReplyToId = "A guid";
    message.ServiceUrl = "http://localhost:50265";
    message.Timestamp = DateTimeOffset.Now;
    message.Type = "ConversationUpdate";

    message.AsConversationUpdateActivity();




    I am new to Bot framework so my code and my thaughts may be wrong...











    share|improve this question


























      4












      4








      4








      I am building a bot with Bot Framework, that is supposed to run in MS Teams and I want it to send me a message every day at 6:30 in the morning.



      I have a method that is called every day at 6:30 inside the Program file.
      And I have a method that sends a message from the bot.



      This is the code for my timer:



      private static Timer _timer;

      private static int count = 1;


      public static void Main(string[] args)

      //Initialization of _timer
      _timer = new Timer(x => callTimerMethod(); , null, Timeout.Infinite, Timeout.Infinite);
      Setup_Timer();

      BuildWebHost(args).Run();


      /// <summary>
      /// This method will execute every day at 06:30.
      /// </summary>
      public static void callTimerMethod()

      System.Diagnostics.Debug.WriteLine(string.Format("Method is called"));
      System.Diagnostics.Debug.Write(DateTime.Now.ToString("dddd, dd MMMM yyyy HH:mm:ss"));
      count = count + 1;


      /// <summary>
      /// This method will set the timer execution time and will change the
      /// tick time of timer.
      /// </summary>
      private static void Setup_Timer()

      DateTime currentTime = DateTime.Now;
      DateTime timerRunningTime = new DateTime(currentTime.Year, currentTime.Month, currentTime.Day, 6, 30, 0);
      timerRunningTime = timerRunningTime.AddDays(1);

      double tickTime = (double)(timerRunningTime - DateTime.Now).TotalSeconds;

      _timer.Change(TimeSpan.FromSeconds(tickTime),
      TimeSpan.FromSeconds(tickTime));



      And what i want to archive is that I want to change the content of callTimerMethod() to this method:



      public async Task AlertSubscribers(ITurnContext turncontext, CancellationToken cancellationToken = default(CancellationToken))

      using (var db = new DataBaseContext())

      var msg = "";
      var today = DateTime.Today.ToString("dddd");
      var product = db linq code;

      foreach(var prod in product)

      msg = $"Reminder! prod.bla";


      // Get the conversation state from the turn context.
      var state = await _accessors.CounterState.GetAsync(turncontext, () => new CounterState());

      // Set the property using the accessor.
      await _accessors.CounterState.SetAsync(turncontext, state);

      // Save the new turn count into the conversation state.
      await _accessors.ConversationState.SaveChangesAsync(turncontext);

      // Echo back to the user whatever msg is.
      await turncontext.SendActivityAsync(msg);




      But I can't find a way to archive it... Would really appreciate some help, I have searched around a lot but havent found a similar problem.



      The problem is all the namespaces (for an example ITurncontext, Conversationstate, and so on...)



      Hope that describes my problem...



      Thanks in advance!



      EDIT:



      It doesn't nessessarly need to be the AlertSubscribers() method, but a function och just code that does the similar thing.



      I have tried this code but i cant get it to make the bot send a message to the user(in this case me in the Emulator):



      public static void callTimerMethod()

      IMessageActivity message = Activity.CreateMessageActivity();

      message.Text = "Hello!";
      message.TextFormat = "plain";
      message.Locale = "en-Us";
      message.ChannelId = "emulator";
      message.Id = "A guid";
      message.InputHint = "acceptingInput";
      message.LocalTimestamp = DateTimeOffset.Now;
      message.ReplyToId = "A guid";
      message.ServiceUrl = "http://localhost:50265";
      message.Timestamp = DateTimeOffset.Now;
      message.Type = "ConversationUpdate";

      message.AsConversationUpdateActivity();




      I am new to Bot framework so my code and my thaughts may be wrong...











      share|improve this question
















      I am building a bot with Bot Framework, that is supposed to run in MS Teams and I want it to send me a message every day at 6:30 in the morning.



      I have a method that is called every day at 6:30 inside the Program file.
      And I have a method that sends a message from the bot.



      This is the code for my timer:



      private static Timer _timer;

      private static int count = 1;


      public static void Main(string[] args)

      //Initialization of _timer
      _timer = new Timer(x => callTimerMethod(); , null, Timeout.Infinite, Timeout.Infinite);
      Setup_Timer();

      BuildWebHost(args).Run();


      /// <summary>
      /// This method will execute every day at 06:30.
      /// </summary>
      public static void callTimerMethod()

      System.Diagnostics.Debug.WriteLine(string.Format("Method is called"));
      System.Diagnostics.Debug.Write(DateTime.Now.ToString("dddd, dd MMMM yyyy HH:mm:ss"));
      count = count + 1;


      /// <summary>
      /// This method will set the timer execution time and will change the
      /// tick time of timer.
      /// </summary>
      private static void Setup_Timer()

      DateTime currentTime = DateTime.Now;
      DateTime timerRunningTime = new DateTime(currentTime.Year, currentTime.Month, currentTime.Day, 6, 30, 0);
      timerRunningTime = timerRunningTime.AddDays(1);

      double tickTime = (double)(timerRunningTime - DateTime.Now).TotalSeconds;

      _timer.Change(TimeSpan.FromSeconds(tickTime),
      TimeSpan.FromSeconds(tickTime));



      And what i want to archive is that I want to change the content of callTimerMethod() to this method:



      public async Task AlertSubscribers(ITurnContext turncontext, CancellationToken cancellationToken = default(CancellationToken))

      using (var db = new DataBaseContext())

      var msg = "";
      var today = DateTime.Today.ToString("dddd");
      var product = db linq code;

      foreach(var prod in product)

      msg = $"Reminder! prod.bla";


      // Get the conversation state from the turn context.
      var state = await _accessors.CounterState.GetAsync(turncontext, () => new CounterState());

      // Set the property using the accessor.
      await _accessors.CounterState.SetAsync(turncontext, state);

      // Save the new turn count into the conversation state.
      await _accessors.ConversationState.SaveChangesAsync(turncontext);

      // Echo back to the user whatever msg is.
      await turncontext.SendActivityAsync(msg);




      But I can't find a way to archive it... Would really appreciate some help, I have searched around a lot but havent found a similar problem.



      The problem is all the namespaces (for an example ITurncontext, Conversationstate, and so on...)



      Hope that describes my problem...



      Thanks in advance!



      EDIT:



      It doesn't nessessarly need to be the AlertSubscribers() method, but a function och just code that does the similar thing.



      I have tried this code but i cant get it to make the bot send a message to the user(in this case me in the Emulator):



      public static void callTimerMethod()

      IMessageActivity message = Activity.CreateMessageActivity();

      message.Text = "Hello!";
      message.TextFormat = "plain";
      message.Locale = "en-Us";
      message.ChannelId = "emulator";
      message.Id = "A guid";
      message.InputHint = "acceptingInput";
      message.LocalTimestamp = DateTimeOffset.Now;
      message.ReplyToId = "A guid";
      message.ServiceUrl = "http://localhost:50265";
      message.Timestamp = DateTimeOffset.Now;
      message.Type = "ConversationUpdate";

      message.AsConversationUpdateActivity();




      I am new to Bot framework so my code and my thaughts may be wrong...








      c# .net botframework bots






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 8 at 12:51







      luddep

















      asked Mar 6 at 10:23









      luddepluddep

      9712




      9712






















          1 Answer
          1






          active

          oldest

          votes


















          0














          Solved it!



          public static async void callTimerMethod()

          await ConversationStarter.Resume("conversationId", "emulator");



          I had to change the callTimerMethod() to an async method and create a ConversationStarter class that handles the message for me.



          This is ConversationStarter :



          public class ConversationStarter

          public static string fromId;
          public static string fromName;
          public static string toId;
          public static string toName;
          public static string serviceUrl;
          public static string channelId;
          public static string conversationId;


          public static async Task Resume(string conversationId, string channelId)

          conversationId = await Talk(conversationId, channelId, $"Hi there!");
          conversationId = await Talk(conversationId, channelId, $"This is a notification!");


          private static async Task<string> Talk(string conversationId, string channelId, string msg)

          var userAccount = new ChannelAccount(toId, toName);
          var botAccount = new ChannelAccount(fromId, fromName);
          var connector = new ConnectorClient(new Uri(serviceUrl));

          IMessageActivity message = Activity.CreateMessageActivity();
          if (!string.IsNullOrEmpty(conversationId) && !string.IsNullOrEmpty(channelId))

          message.ChannelId = channelId;

          else

          conversationId = (await connector.Conversations.CreateDirectConversationAsync(botAccount, userAccount)).Id;

          message.From = botAccount;
          message.Recipient = userAccount;
          message.Conversation = new ConversationAccount(id: conversationId);
          message.Text = msg;
          message.Locale = "en-Us";
          await connector.Conversations.SendToConversationAsync((Activity)message);
          return conversationId;








          share|improve this answer
























            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55020753%2fmake-bot-send-message-every-day-at-specific-time%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            Solved it!



            public static async void callTimerMethod()

            await ConversationStarter.Resume("conversationId", "emulator");



            I had to change the callTimerMethod() to an async method and create a ConversationStarter class that handles the message for me.



            This is ConversationStarter :



            public class ConversationStarter

            public static string fromId;
            public static string fromName;
            public static string toId;
            public static string toName;
            public static string serviceUrl;
            public static string channelId;
            public static string conversationId;


            public static async Task Resume(string conversationId, string channelId)

            conversationId = await Talk(conversationId, channelId, $"Hi there!");
            conversationId = await Talk(conversationId, channelId, $"This is a notification!");


            private static async Task<string> Talk(string conversationId, string channelId, string msg)

            var userAccount = new ChannelAccount(toId, toName);
            var botAccount = new ChannelAccount(fromId, fromName);
            var connector = new ConnectorClient(new Uri(serviceUrl));

            IMessageActivity message = Activity.CreateMessageActivity();
            if (!string.IsNullOrEmpty(conversationId) && !string.IsNullOrEmpty(channelId))

            message.ChannelId = channelId;

            else

            conversationId = (await connector.Conversations.CreateDirectConversationAsync(botAccount, userAccount)).Id;

            message.From = botAccount;
            message.Recipient = userAccount;
            message.Conversation = new ConversationAccount(id: conversationId);
            message.Text = msg;
            message.Locale = "en-Us";
            await connector.Conversations.SendToConversationAsync((Activity)message);
            return conversationId;








            share|improve this answer





























              0














              Solved it!



              public static async void callTimerMethod()

              await ConversationStarter.Resume("conversationId", "emulator");



              I had to change the callTimerMethod() to an async method and create a ConversationStarter class that handles the message for me.



              This is ConversationStarter :



              public class ConversationStarter

              public static string fromId;
              public static string fromName;
              public static string toId;
              public static string toName;
              public static string serviceUrl;
              public static string channelId;
              public static string conversationId;


              public static async Task Resume(string conversationId, string channelId)

              conversationId = await Talk(conversationId, channelId, $"Hi there!");
              conversationId = await Talk(conversationId, channelId, $"This is a notification!");


              private static async Task<string> Talk(string conversationId, string channelId, string msg)

              var userAccount = new ChannelAccount(toId, toName);
              var botAccount = new ChannelAccount(fromId, fromName);
              var connector = new ConnectorClient(new Uri(serviceUrl));

              IMessageActivity message = Activity.CreateMessageActivity();
              if (!string.IsNullOrEmpty(conversationId) && !string.IsNullOrEmpty(channelId))

              message.ChannelId = channelId;

              else

              conversationId = (await connector.Conversations.CreateDirectConversationAsync(botAccount, userAccount)).Id;

              message.From = botAccount;
              message.Recipient = userAccount;
              message.Conversation = new ConversationAccount(id: conversationId);
              message.Text = msg;
              message.Locale = "en-Us";
              await connector.Conversations.SendToConversationAsync((Activity)message);
              return conversationId;








              share|improve this answer



























                0












                0








                0







                Solved it!



                public static async void callTimerMethod()

                await ConversationStarter.Resume("conversationId", "emulator");



                I had to change the callTimerMethod() to an async method and create a ConversationStarter class that handles the message for me.



                This is ConversationStarter :



                public class ConversationStarter

                public static string fromId;
                public static string fromName;
                public static string toId;
                public static string toName;
                public static string serviceUrl;
                public static string channelId;
                public static string conversationId;


                public static async Task Resume(string conversationId, string channelId)

                conversationId = await Talk(conversationId, channelId, $"Hi there!");
                conversationId = await Talk(conversationId, channelId, $"This is a notification!");


                private static async Task<string> Talk(string conversationId, string channelId, string msg)

                var userAccount = new ChannelAccount(toId, toName);
                var botAccount = new ChannelAccount(fromId, fromName);
                var connector = new ConnectorClient(new Uri(serviceUrl));

                IMessageActivity message = Activity.CreateMessageActivity();
                if (!string.IsNullOrEmpty(conversationId) && !string.IsNullOrEmpty(channelId))

                message.ChannelId = channelId;

                else

                conversationId = (await connector.Conversations.CreateDirectConversationAsync(botAccount, userAccount)).Id;

                message.From = botAccount;
                message.Recipient = userAccount;
                message.Conversation = new ConversationAccount(id: conversationId);
                message.Text = msg;
                message.Locale = "en-Us";
                await connector.Conversations.SendToConversationAsync((Activity)message);
                return conversationId;








                share|improve this answer















                Solved it!



                public static async void callTimerMethod()

                await ConversationStarter.Resume("conversationId", "emulator");



                I had to change the callTimerMethod() to an async method and create a ConversationStarter class that handles the message for me.



                This is ConversationStarter :



                public class ConversationStarter

                public static string fromId;
                public static string fromName;
                public static string toId;
                public static string toName;
                public static string serviceUrl;
                public static string channelId;
                public static string conversationId;


                public static async Task Resume(string conversationId, string channelId)

                conversationId = await Talk(conversationId, channelId, $"Hi there!");
                conversationId = await Talk(conversationId, channelId, $"This is a notification!");


                private static async Task<string> Talk(string conversationId, string channelId, string msg)

                var userAccount = new ChannelAccount(toId, toName);
                var botAccount = new ChannelAccount(fromId, fromName);
                var connector = new ConnectorClient(new Uri(serviceUrl));

                IMessageActivity message = Activity.CreateMessageActivity();
                if (!string.IsNullOrEmpty(conversationId) && !string.IsNullOrEmpty(channelId))

                message.ChannelId = channelId;

                else

                conversationId = (await connector.Conversations.CreateDirectConversationAsync(botAccount, userAccount)).Id;

                message.From = botAccount;
                message.Recipient = userAccount;
                message.Conversation = new ConversationAccount(id: conversationId);
                message.Text = msg;
                message.Locale = "en-Us";
                await connector.Conversations.SendToConversationAsync((Activity)message);
                return conversationId;









                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Mar 15 at 8:53









                Bernard Vander Beken

                2,69853258




                2,69853258










                answered Mar 15 at 8:31









                luddepluddep

                9712




                9712





























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55020753%2fmake-bot-send-message-every-day-at-specific-time%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Save data to MySQL database using ExtJS and PHP [closed]2019 Community Moderator ElectionHow can I prevent SQL injection in PHP?Which MySQL data type to use for storing boolean valuesPHP: Delete an element from an arrayHow do I connect to a MySQL Database in Python?Should I use the datetime or timestamp data type in MySQL?How to get a list of MySQL user accountsHow Do You Parse and Process HTML/XML in PHP?Reference — What does this symbol mean in PHP?How does PHP 'foreach' actually work?Why shouldn't I use mysql_* functions in PHP?

                    Compiling GNU Global with universal-ctags support Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Tags for Emacs: Relationship between etags, ebrowse, cscope, GNU Global and exuberant ctagsVim and Ctags tips and trickscscope or ctags why choose one over the other?scons and ctagsctags cannot open option file “.ctags”Adding tag scopes in universal-ctagsShould I use Universal-ctags?Universal ctags on WindowsHow do I install GNU Global with universal ctags support using Homebrew?Universal ctags with emacsHow to highlight ctags generated by Universal Ctags in Vim?

                    Add ONERROR event to image from jsp tldHow to add an image to a JPanel?Saving image from PHP URLHTML img scalingCheck if an image is loaded (no errors) with jQueryHow to force an <img> to take up width, even if the image is not loadedHow do I populate hidden form field with a value set in Spring ControllerStyling Raw elements Generated from JSP tagds with Jquery MobileLimit resizing of images with explicitly set width and height attributeserror TLD use in a jsp fileJsp tld files cannot be resolved