Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface IConnector

Implemented by connector plugins for the UniversalBot.

Hierarchy

  • IConnector

Implemented by

Index

Methods

Optional delete

  • delete(address: IAddress, callback: function): void
  • (Optional) method that can be called to delete a message that was previously sent using send().

    Parameters

    • address: IAddress

      The address of the message to delete.

    • callback: function

      Function to invoke once the operation is completed.

        • (err: Error): void
        • Parameters

          • err: Error

            Any error that occurred while replacing the message.

          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

      The function that should be called anytime an event is received that is not of type "invoke".

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

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

                • err: Error

                Returns void

          Returns void

    Returns void

Optional onInvoke

  • onInvoke(handler: function): void
  • (Optional) Called by the UniversalBot at registration time to register a handler for receiving incoming invoke events. Invoke events are special events which are expected to return a body inline as part of the response to the received request.

    Parameters

    • handler: function

      The function that should be called anytime an "invoke" event is received.

        • (event: IEvent, callback?: function): void
        • Parameters

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

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

                Returns void

          Returns void

    Returns void

send

  • send(messages: IMessage[], callback: function): void
  • Sends outgoing message(s) to a user. This method will ultimately get called anytime you call UniversalBot.send() or Session.send().

    You can manually call this method using session.connector.send() as a convenient way of getting the address of the message that was sent. You can then store this address and use it at a later point in time to either update or delete the message. The one thing to keep in mind is that if you manually call session.connector.send() you will bypass any middleware that the outgoing message would normally run through. Calling session.send(msg).sendBatch(function (err, addresses) { }) does the same thing but ensures that the outgoing message is sent through middleware.

    Parameters

    • messages: IMessage[]

      Array of message(s) to send the user.

    • callback: function

      Function to invoke once the operation is completed.

        • (err: Error, addresses?: IAddress[]): void
        • Parameters

          • err: Error

            Any error that occurred during the send.

          • Optional addresses: IAddress[]

            An array of address objects returned for each individual message within the batch. These address objects contain the ID of the posted messages so can be used to update or delete a message in the future.

          Returns void

    Returns void

startConversation

  • startConversation(address: IAddress, callback: function): void
  • Called when a UniversalBot wants to start a new proactive conversation with a user. The connector should return an address with a properly formated IAddress.conversation field. This will typically be called when you call UniversalBot.beginDialog() but will also be called anytime IAddress.conversation is null for a message being sent.

    Parameters

    • address: IAddress

      The address of the user to start the conversation for. The IAddress.conversation field should be null.

    • callback: function

      Function to invoke once the operation is completed.

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

          • err: Error

            Any error that occurred while attempting to start the conversation.

          • Optional address: IAddress

            The address of the conversation that was started. This can be used to send future messages to the conversation.

          Returns void

    Returns void

Optional update

  • update(message: IMessage, callback: function): void
  • (Optional) method that can be called to replace a message that was previously sent using send().

    Parameters

    • message: IMessage

      The message to overwrite an existing message with. The message.address field should contain an address returned from a previous call to send().

    • callback: function

      Function to invoke once the operation is completed.

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

          • err: Error

            Any error that occurred while replacing the message.

          • Optional address: IAddress

            The address of the new message. For some channels this may different from the original messages address.

          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