Giter Club home page Giter Club logo

reference-webchat-proxy's Introduction

Webchat Proxy - Reference Implementation

This is a reference implementation of an API which departments who want to integrate webchat or virtual assistants on GOV.UK must expose.

Motivation

Most engagement products require the addition of "tags" to pages that they wish to add webchat or virtual assistants to. These are essentially third-party scripts which are loaded on to that page.

We do not include third-party JavaScript on GOV.UK (except for Google Analytics). Doing so essentially provides that third party with complete control over the user's experience of GOV.UK, which has significant security and usability concerns.

The API documented here is the standard to which we expect all integrations to adhere.

The code in this repository is a reference implementation example of how a department or service could normalise a Webchat implementation to the GOV.UK Webchat Component needs. This particular implementation is for eGain, but the external API is applicable in all cases.

This proxy will give departments flexibility over implementing caching or changing internals of their endpoint, without GOV.UK's input, while maintaining the security of GOV.UK.

Webchat Indentifier Mappings

Currently we keep a hardcoded mapping of URLs to their respective Webchat APIs. In the future we plan to allow these to be set in the Publishing Admin interface, but currently these will need to be handled in collaboration with GOV.UK.

API Description

Anything other than a 200 response is a failure mode, JSON is returned, and CORS headers are set so this can be accessed by a browser.


GET /availability/:id

:id should be the unique Webchat 'room' identifier

This endpoint is for checking the availability of a Webchat instance.

Responses

Webchat has a technical error

Any response that does not conform to an available response type will render a technical error, as will a non 200 type response.

  {
    status: "failure",
    response: "error-message-related-to-the-techincal-error"
  }

Webchat is available
  response code: 200
  {
    status: "success",
    response: "AVAILABLE"
  }
WebChat is unavailable
  response code: 200
  {
    status: "success",
    response: "UNAVAILABLE"
  }
WebChat is busy
  response code: 200
  {
    status: "success",
    response: "BUSY"
  }

GET /open/:id

:id should be the unique Webchat room identifier

This URL is used by the Webchat Component to open the correct Webchat instance. The Webchat component should be able to call window.open on this endpoint and open a Webchat instance in a new window.

In our reference example, we redirect to the underlying eGain API endpoint but this would change depending on your Webchat provider.

This projects' dependencies

  • ruby (2.1>)
  • bundler

How to run this project

git clone [email protected]:alphagov/reference-webchat-proxy.git
cd reference-webchat-proxy
bundle install
ruby app.rb

Further documentation

The JavaScript and HTML side of this API is documented here in the public code for GOV.UK's frontend.

reference-webchat-proxy's People

Contributors

benthorner avatar dependabot[bot] avatar huminmiah avatar leenagupte avatar mcgoooo avatar murilodalri avatar nicholsj avatar nickcolley avatar rubenarakelyan avatar timblair avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.