### YamlMime:UniversalReference
items:
  - uid: botbuilder.ConsoleAdapter
    name: ConsoleAdapter
    fullName: ConsoleAdapter
    children:
      - botbuilder.ConsoleAdapter.constructor
      - botbuilder.ConsoleAdapter.continueConversation
      - botbuilder.ConsoleAdapter.deleteActivity
      - botbuilder.ConsoleAdapter.listen
      - botbuilder.ConsoleAdapter.sendActivities
      - botbuilder.ConsoleAdapter.updateActivity
    langs:
      - typeScript
    type: class
    summary: Lets a user communicate with a bot from a console window.
    extends:
      name: botbuilder.ConsoleAdapter
    package: botbuilder
    remarks: |-
      The following example shows the typical adapter setup:


      ```JavaScript
      const { ConsoleAdapter } = require('botbuilder');

      const adapter = new ConsoleAdapter();
      const closeFn = adapter.listen(async (context) => {
         await context.sendActivity(`Hello World`);
      });
      ```
  - uid: botbuilder.ConsoleAdapter.constructor
    name: ConsoleAdapter
    children: []
    type: constructor
    langs:
      - typeScript
    summary: Creates a new ConsoleAdapter instance.
    syntax:
      content: 'new ConsoleAdapter(reference?: ConversationReference)'
      parameters:
        - id: reference
          type:
            - ConversationReference
          description: >
            (Optional) reference used to customize the address information of
            activites sent from the adapter.
          optional: true
  - uid: botbuilder.ConsoleAdapter.continueConversation
    name: continueConversation
    children: []
    type: method
    langs:
      - typeScript
    summary: Lets a bot proactively message the user.
    syntax:
      content: >-
        function continueConversation(reference: ConversationReference, logic:
        (context: TurnContext) => Promiseable<void>)
      parameters:
        - id: reference
          type:
            - ConversationReference
          description: >-
            A `ConversationReference` saved during a previous message from a
            user.  This can be calculated for any incoming activity using
            `TurnContext.getConversationReference(context.activity)`.
        - id: logic
          type:
            - '(context: TurnContext) => Promiseable<void>'
          description: >
            A function handler that will be called to perform the bots logic
            after the the adapters middleware has been run.
      return:
        type:
          - Promise<void>
    remarks: >-
      The processing steps for this method are very similar to
      [listen()](#listen)

      in that a `TurnContext` will be created which is then routed through the
      adapters middleware

      before calling the passed in logic handler. The key difference being that
      since an activity

      wasn't actually received it has to be created.  The created activity will
      have its address

      related fields populated but will have a `context.activity.type ===
      undefined`.


      ```JavaScript

      function delayedNotify(context, message, delay) {
         const reference = TurnContext.getConversationReference(context.activity);
         setTimeout(() => {
            adapter.continueConversation(reference, async (ctx) => {
               await ctx.sendActivity(message);
            });
         }, delay);
      }

      ```
  - uid: botbuilder.ConsoleAdapter.deleteActivity
    name: deleteActivity
    children: []
    type: method
    langs:
      - typeScript
    summary: >-
      Not supported for the ConsoleAdapter.  Calling this method or
      `TurnContext.deleteActivity()`

      will result an error being returned.
    syntax:
      content: >-
        function deleteActivity(context: TurnContext, reference:
        Partial<ConversationReference>)
      parameters:
        - id: context
          type:
            - TurnContext
          description: ''
        - id: reference
          type:
            - Partial<ConversationReference>
          description: ''
      return:
        type:
          - Promise<void>
  - uid: botbuilder.ConsoleAdapter.listen
    name: listen
    children: []
    type: method
    langs:
      - typeScript
    summary: >-
      Begins listening to console input. A function will be returned that can be
      used to stop the

      bot listening and therefore end the process.
    syntax:
      content: 'function listen(logic: (context: TurnContext) => Promiseable<void>)'
      parameters:
        - id: logic
          type:
            - '(context: TurnContext) => Promiseable<void>'
          description: >
            Function which will be called each time a message is input by the
            user.
      return:
        type:
          - Function
    remarks: >-
      Upon receiving input from the console the flow is as follows:


      - An 'message' activity will be created containing the users input text.

      - A revokable `TurnContext` will be created for the activity.

      - The context will be routed through any middleware registered with
      [use()](#use).

      - The bots logic handler that was passed in will be executed.

      - The promise chain setup by the middleware stack will be resolved.

      - The context object will be revoked and any future calls to its members
      will result in a
        `TypeError` being thrown.

      ```JavaScript

      const closeFn = adapter.listen(async (context) => {
         const utterance = context.activity.text.toLowerCase();
         if (utterance.includes('goodbye')) {
            await context.sendActivity(`Ok... Goodbye`);
            closeFn();
         } else {
            await context.sendActivity(`Hello World`);
         }
      });

      ```
  - uid: botbuilder.ConsoleAdapter.sendActivities
    name: sendActivities
    children: []
    type: method
    langs:
      - typeScript
    summary: Logs a set of activities to the console.
    syntax:
      content: >-
        function sendActivities(context: TurnContext, activities:
        Partial<Activity>[])
      parameters:
        - id: context
          type:
            - TurnContext
          description: Context for the current turn of conversation with the user.
        - id: activities
          type:
            - 'Partial<Activity>[]'
          description: |
            List of activities to send.
      return:
        type:
          - 'Promise<ResourceResponse[]>'
    remarks: >-
      Calling `TurnContext.sendActivities()` or `TurnContext.sendActivity()` is
      the preferred way of

      sending activities as that will ensure that outgoing activities have been
      properly addressed

      and that any interested middleware has been notified.
  - uid: botbuilder.ConsoleAdapter.updateActivity
    name: updateActivity
    children: []
    type: method
    langs:
      - typeScript
    summary: >-
      Not supported for the ConsoleAdapter.  Calling this method or
      `TurnContext.updateActivity()`

      will result an error being returned.
    syntax:
      content: >-
        function updateActivity(context: TurnContext, activity:
        Partial<Activity>)
      parameters:
        - id: context
          type:
            - TurnContext
          description: ''
        - id: activity
          type:
            - Partial<Activity>
          description: ''
      return:
        type:
          - Promise<void>
references:
  - uid: botbuilder.WebRequest
    spec.typeScript:
      - name: WebRequest
        fullName: WebRequest
        uid: botbuilder.WebRequest
