arnm / clientresponse-demo

Example implementation of the Bazaarvoice Client Response API using OAuth2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build Status

Client Response Demo Application

This repository contains an example implementation of the Bazaarvoice Client Response API for our clients to reference in building their own integrations.

This project was bootstrapped with Create React App. For details on how to perform some common tasks, refer to this.

Getting Started

  • Open the Command Line or Terminal.

  • Run the following commands to get a copy of this repository on your PC and navigate into it.

    git clone https://github.com/bazaarvoice/clientresponse-demo.git
    cd clientresponse-demo
    
  • Make sure you have Docker 18.03.0-ce installed.

    • For instructions on installing Docker, see this

Local Deployment

  • Modify server/server-config.js file to contain your backend credentials for different services.
  • Modify client/src/utils/config.js file to contain your client-side credentials for different services.
  • Make sure you are in the cloned directory and run following commands from your terminal:
    docker build -t clientresponse-demo .
    docker run -p 127.0.0.1:5000:5000/tcp -i -t clientresponse-demo:latest
    
  • You can use the application by going to http://localhost:5000 in your browser.

Application Architecture

This application is split into two components - a Node.js Express server and a client-side React app. You can read more about this kind of setup here.

  • The server makes calls to the Bazaarvoice OAuth2 service for authentication and exposes endpoints to interact with the Client Response API.
  • On the client-side, client.js provides modular functions which are used by front-end components to interact with the application's back-end, and with Bazaarvoice Conversations API to fetch reviews.
  • The core front-end consists of two pages which are composed from four React components:
    • Search Page: This is a simple page with a search bar which expects user to enter a Review ID which leads them to the Review Page.
    • Review Page: This page expects a Review ID from the query parameters. It then queries the Conversation's API to fetch the corresponding review. Further, it queries the Client Response API to fetch all client responses for that review and renders the ClientResponsesSection component with that data. In turn, this section renders each client response as a ClientResponse component.

Application Limitations

  • The application cannot maintain proper user sessions

    The express server currently uses just short-lived cookies for storing OAuth2 tokens. In a production application, you should maintain user sessions using cookies and session storage.

  • Current server implementation does not explicitly all handle error responses from API

    All of the Bazaarvoice APIs send different error responses for invalid calls and a production application should handle and display them properly to the end user. Currently, this application assumes most calls to be valid and doesn't do explicit error handling.

License

This project is licensed under the Apache 2.0 License - see the LICENSE file for details.

Contributing

Found a bug or missing feature? Please open an issue! Send your feedback. Send your pull requests. All contributions are appreciated.

About

Example implementation of the Bazaarvoice Client Response API using OAuth2

License:Other


Languages

Language:JavaScript 98.4%Language:CSS 1.0%Language:HTML 0.6%