Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ChatConnector

Connects a UniversalBot to multiple channels via the Bot Framework.

Hierarchy

  • ChatConnector

Implements

Index

Constructors

constructor

  • Creates a new instnace of the ChatConnector.

    Parameters

    • Optional settings: IChatConnectorSettings

      (Optional) config params that let you specify the bots App ID & Password you were assigned in the Bot Frameworks developer portal.

    Returns ChatConnector

Properties

Protected settings

Configuration parameters for the connector.

Methods

delete

  • delete(address: IAddress, done: function): void
  • Deletes an existing message.

    Parameters

    • address: IAddress
    • done: function
        • (err: Error): void
        • Parameters

          • err: Error

          Returns void

    Returns void

getAccessToken

  • getAccessToken(callback: function): void
  • Gets the current access token for the bot.

    Parameters

    • callback: function
        • (err: Error, accessToken: string): void
        • Parameters

          • err: Error
          • accessToken: string

          Returns void

    Returns void

getData

listen

  • listen(): function
  • Registers an Express or Restify style hook to listen for new messages.

    Returns function

      • (req: any, res: any): void
      • Parameters

        • req: any
        • res: any

        Returns void

Protected onDispatchEvents

  • onDispatchEvents(events: IEvent[], callback: function): void
  • Called after the connector receives, authenticates, and prepares an event. Derived classes can override this to filter out incoming events before they're dispatched to the bot. Calling super.onDispatchMessage(event, callback) will perform the connectors default logic.

    Parameters

    • events: IEvent[]

      Array of 0 or more events to dispatch.

    • callback: function

      Function that will be called after all events have been dispatched.

        • (err: Error, body: any, status?: number): void
        • Parameters

          • err: Error
          • body: any
          • Optional status: number

          Returns void

    Returns void

onEvent

  • onEvent(handler: function): void
  • Called by the UniversalBot at registration time to register a handler for receiving incoming events from a channel.

    Parameters

    • handler: function
        • (events: IEvent[], callback?: function): void
        • Parameters

          • events: IEvent[]
          • Optional callback: function
              • (err: Error): void
              • Parameters

                • err: Error

                Returns void

          Returns void

    Returns void

onInvoke

  • onInvoke(handler: function): void
  • Used to register a handler for receiving incoming invoke events.

    Parameters

    • handler: function
        • (event: IEvent, cb?: function): void
        • Parameters

          • event: IEvent
          • Optional cb: function
              • (err: Error, body: any, status?: number): void
              • Parameters

                • err: Error
                • body: any
                • Optional status: number

                Returns void

          Returns void

    Returns void

saveData

send

  • send(messages: IMessage[], done: function): void
  • Called by the UniversalBot to deliver outgoing messages to a user.

    Parameters

    • messages: IMessage[]
    • done: function
        • (err: Error, addresses?: IAddress[]): void
        • Parameters

          • err: Error
          • Optional addresses: IAddress[]

          Returns void

    Returns void

startConversation

  • startConversation(address: IAddress, done: function): void
  • Called when a UniversalBot wants to start a new proactive conversation with a user. The connector should return a properly formated address object with a populated conversation field.

    Parameters

    • address: IAddress
    • done: function
        • (err: Error, address?: IAddress): void
        • Parameters

          Returns void

    Returns void

update

  • update(message: IMessage, done: function): void
  • Replaces an existing message with a new one.

    Parameters

    • message: IMessage
    • done: function
        • (err: Error, address?: IAddress): void
        • Parameters

          Returns void

    Returns void

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method