Introduction to Sentient Bots

TL;DR: Dive into choices of bot frameworks - a holistic conversational experience framework analysis.

This is not an analysis for notification framework but a holistic conversational experience framework. We can attempt to retrofit and utilise it for notification purposes (in theory) but that is not the primary intent of this article.

Synopsis

Framework Evaluation

  1. Bot Press - Open source conversational AI platform
  2. Bot Framework - Microsoft’s comprehensive bot building framework
  3. Direct Channel Integration - Fallback if frameworks don’t work

Target Channels

  • Web Channel - Smart Website Notifications & Messaging Overlay
  • Web Push - Chrome & Firefox notifications

Implementation Plan

  1. Evaluate aforementioned frameworks
  2. Direct channel integration as fallback
  3. Start with notification channel (external page links sent to user’s preferred channel)

Exploration

Bot Framework Architecture

Figure 1: Bot Framework Architecture Overview

Channel Integration

Figure 2: Channel Integration Flow

Component Interaction

Figure 3: Component Interaction Diagram

Implementation

Refresh Token Strategies

Token management is critical for maintaining user sessions across bot interactions.

Forward Flow

Used to detect non-usage and force re-linking:

  1. Route request through common request provider with requestType, requestBody, requestTokenHandle
  2. Retrieve bearer token based on requestTokenHandle
  3. If bearer token missing → jump to refresh flow
  4. If exists, send request with bearer token to desired service
  5. Handle response:
    • 2xx: Operation complete
    • 4xx: Check for error object
    • 401 with code 503: Token expired/invalid

Token Refresh Process

1. Access refresh token based on requestTokenHandle
2. If missing → alert user and trigger unlink flow
3. Send request to /token/refresh with:
   - refresh_token: <accessed_refresh_token>
   - grant_type: 'refresh_token'
4. On success → receive new AuthenticationToken
5. Use new access_token and retry original request

Backward Flow

Handles lingering notification routes that are no longer accessible:

  1. Notification sent from consumer
  2. Orator verifies user contact relation token validity
  3. Retrieve bearer token
  4. Validate against bot/checkout/health/token
  5. If validation fails:
    • Alert user about extended absence
    • Provide re-link option
    • Trigger unlink flow at trumpet

Component Interaction

The bot system consists of several interconnected components:

ComponentResponsibility
OratorToken validation and routing
TrumpetNotification management
ConsumerMessage processing
AnnouncerExternal communication

Error Handling

HTTP CodeError CodeMeaning
401503Expired/invalid bearer or refresh token
4xx-Runtime or configuration error

This document provides the foundation for implementing conversational bots with proper authentication and session management.