title: Sending a greeting/welcome message from the bot as soon as the Webchat control is loaded
body: <p>I'm developing a bot using Microsoft's Bot framework in C#. I'm trying to send a welcome message to the user as an introduction before he/she sends anything.</p>
  
  <p>After researching, I somewhat achieved this using <code>HandleSystemMessage</code> function and sending the message in the case of a <code>ConversationUpdate</code> as follows:</p>
  
  <pre><code>if (activity.Type == ActivityTypes.ConversationUpdate) 
  {
      IConversationUpdateActivity update = activity;
      if (update.MembersAdded.Any())
      {
          foreach (var newMember in update.MembersAdded)
          {
              if (newMember.Id != activity.Recipient.Id)
              {
                  ConnectorClient connector = new ConnectorClient(new Uri(activity.ServiceUrl));
  
                  Activity reply = activity.CreateReply();
                  reply.Text("Hello, how can I help you?");
                  await connector.Conversations.ReplyToActivityAsync((Activity)bubble);
              }
          }
      }
  }
  </code></pre>
  
  <p>The problem I am facing with this method:</p>
  
  <ul>
  <li>In the Emulator, the welcome message appears when you hit the refresh button above or when the user starts typing if it has been idle for a while. This is the behavior I'm looking for and it is working as intended. </li>
  <li>Now when using the <a href="https://github.com/Microsoft/BotFramework-WebChat" rel="nofollow noreferrer">Bot Framework Web Chat</a> component, this message is send when the user initiate the conversation, i.e. when the user types something and sends it to the bot. This is not what I want, but rather, I'd like the message to be shown from the bot as soon as the web chat control is loaded as the message will contain some instructions on how to use the bot.</li>
  </ul>
  
  <p>I assume my problem could be solved using another <code>ActivityType</code> perhaps or some Javascript 'hacky' way but I couldn't find a solution up until now.</p>