@kudobuzz/reviews-schema

2.3.6 • Public • Published

Overview

Exposes apis to:

  1. Validate any type of review accepted by Kudobuzz. This includes Yelp, Facebook, and Google+ reviews, etc
  2. Transform any type of external review to a Kudobuzz review

Installation

npm install @kudobuzz/reviews-schema

Usage

Validating External Reviews

Supported platforms - facebook, google, yelp, etsy

const {validate} = require('@kudobuzz/reviews-schema')

const reviews = validate(transformedReviews)

Transforming Reviews

Supported platforms - facebook

'use strict'

const {transformToKudobuzzReview} = require('@kudobuzz/reviews-schema')

transformToKudobuzzReview(review)

See [Facebook transformer example]('example/transformers/facebook.js') for Facebook post, comment and rating 
transformation example

(WIP) Review Schema

Below is the general schema that external reviews should conform to before they are saved

{ external_id: String, external_parent_id: String, external_link: url external_unique_id:String, thirdparty_account:{ external_id : String, name: String, platform: String, ['facebook', 'twitter', 'instagram', 'yelp'], sub_account:{ external_id: String, name: String, handle: String, } }, platform: String // ['facebook', 'instagram', 'twitter', 'kudobuzz', 'google', 'yelp', 'import’] source:String // ['facebook_post', 'facebook_comment', 'facebook_review', 'instagram_post', 'instagram_comment', 'twitter', 'twitter_favourite', 'twitter_mention', 'custom', 'widget', 'apm', 'sharePage', 'yelp', 'google', 'import'], title: String, message: String, rating: Number, images: [{ thumbnail: String, standard: String, original: String }], reviewer: { external_reviewer_id:String, channel: ['email', 'facebook', 'twitter', 'instagram', 'linkedin', 'yahoo', 'google', 'yelp'] display_name:String, first_name:String, last_name:String, email:String, profile_url:String, }, created_at_platform: Date, updated_at_platform: Date }

Validation Terms

value Description
not-needed This means they are and excepted field in the overall schema but not needed for a specific external review
date Date and required
string String and required
optional Optional

Facebook post

field Validation Description
external_id string This should be the post id
external_link url This url links back to the post
rating not-needed None. A post does not have any rating
external_unique_id not-needed A post doesnot need an external_unique_id
message string, optional. Some post dont come with messages but images The post message
created_at_platform date in seconds The time the post was created on the platform
updated_at_platform date in seconds The time the post was updated on the platform
title string and optional The title of the post
images array of Objects. It can any of the following thumbnail, original and standard The images attached to a post
platform facebook
source facebook_post
reviewer.email not-needed This would have been cool but we cannot get the email of the person that made the post.Not yet
reviewer.display_name string The reviewers name
reviewer.last_name not-needed The reviewers last_name
reviewer.first_name not-needed The reviewers first name
reviewer.email not-needed The reviewers email
reviewer.external_reviewer_id String The reviewers id
thirdparty_account.external_id not needed The account id of the post
thirdparty_account.name not-needed The name of the page
thirdparty_account.platform String facebook
thirdparty_account.sub_account.external_id String The id of the page
thirdparty_account.sub_account.name not-needed The id of the page
thirdparty_account.sub_account.handle not-needed The id of the page

Facebook comment

field Validation Description
external_id string This should be the post id
external_link url This url links back to the post
external_parent_id string This should be the parent comment id
rating not-needed None. A comment does not have any rating
external_unique_id not-needed A comment doesnot need an external_unique_id
message string, optional. Some post dont come with messages but images The post message
created_at_platform date in seconds The time the comment was created on the platform
updated_at_platform date in seconds The time the comment was updated on the platform
title string and optional The title of the comment
images array of Objects. It can any of the following thumbnail, original and standard The images attached to a post
platform facebook
source facebook_comment
reviewer.email not-needed This would have been cool but we cannot get the email of the person that made the post.Not yet
reviewer.display_name string The reviewers name
reviewer.last_name not-needed The reviewers last_name
reviewer.first_name not-needed The reviewers first name
reviewer.email not-needed The reviewers email
reviewer.external_reviewer_id String The reviewers id
thirdparty_account.external_id not needed The account id of the post
thirdparty_account.name not-needed The name of the page
thirdparty_account.platform String facebook
thirdparty_account.sub_account.external_id String The id of the page
thirdparty_account.sub_account.name not-needed The id of the page
thirdparty_account.sub_account.handle not-needed The id of the page

facebook review

field Validation Description
external_id string This should be the post id
external_link url This url links back to the post
rating Number Rating should be between 1 to 5 only
external_unique_id not-needed A post doesnot need an external_unique_id
message string The review message
created_at_platform date in seconds The time the review was created on the platform
updated_at_platform date in seconds The time the review was updated on the platform
title string and optional The title of the post
images array of Objects. It can have any of the following thumbnail, original and standard The images attached to a post
platform facebook
source facebook_review
reviewer.email not-needed This would have been cool but we cannot get the email of the person that made the post.Not yet
reviewer.display_name string The reviewers name
reviewer.last_name not-needed The reviewers last_name
reviewer.first_name not-needed The reviewers first name
reviewer.email not-needed The reviewers email
reviewer.external_reviewer_id String The reviewers id
thirdparty_account.external_id not needed The account id of the post
thirdparty_account.name not-needed The name of the page
thirdparty_account.platform String facebook
thirdparty_account.sub_account.external_id String The id of the page
thirdparty_account.sub_account.name not-needed The id of the page
thirdparty_account.sub_account.handle not-needed The id of the page

yelp

field Validation Description
external_id string This is an internally generated ID
external_link url This is the Yelp page url
rating Number Rating should be between 1 to 5 only
message string The review message
created_at_platform date in seconds The time the review was created on the platform
updated_at_platform date in seconds The time the review was updated on the platform
images array of Objects. It can have any of the following thumbnail, original and standard The images attached to a post
platform yelp
source yelp
reviewer.display_name string The reviewer's name
reviewer.external_reviewer_id String The reviewer's id
reviewer.image.profile_url String The reviewer's image url
thirdparty_account.external_id url This is the Yelp page url
thirdparty_account.platform String yelp

google

field Validation Description
external_id string This is an internally generated ID
external_link url This is a unique url to find that specific review
rating Number, optional Rating should be between 1 to 5 only
message string, optinal The review message
created_at_platform date in seconds The time the review was created on the platform
updated_at_platform date in seconds The time the review was updated on the platform. If we dont know the recent update we can use the craeted date to replace this
images array of Objects,optional It can have any of the following thumbnail, original and standard
platform google
source google_review
reviewer.display_name string, optional The reviewer's name
reviewer.external_reviewer_id String The reviewer's id
reviewer.profile_url String A link to the profile url of the reviewer
reviewer.image.profile_url String Image link to reviewer
reviewer.channel google
thirdparty_acccount.google_places_id url,optional
thirdparty_account.external_id url Sample google maps url. eg https://www.google.com/maps/place/Sky+Bar+25/@5.5937815,-0.22513,13z/data=!4m8!1m2!2m1!1sRestaurants!3m4!1s0xfdf9b0dedfd9c33:0x5631471f9ad654e7!8m2!3d5.619905!4d-0.18044?hl=en-GH
thirdparty_account.platform String google

Etsy

field Validation Description
external_id string This is an internally generated ID
external_link url This is a unique url to etsy.eg. https://www.etsy.com/shop/lolka/reviews?page=3. If we can find a unique url for the review that will be ok
rating Number, optional Rating should be between 1 to 5 only
message string, optinal The review message
created_at_platform date in seconds The time the review was created on the platform
updated_at_platform date in seconds The time the review was updated on the platform. If we dont know the recent update we can use the craeted date to replace this
images array of Objects,optional It can have any of the following thumbnail, original and standard
platform etsy
source etsy_review
reviewer.display_name string, optional The reviewer's name
reviewer.external_reviewer_id String The reviewer's id
reviewer.profile_url String A link to the profile url of the reviewer
reviewer.image.profile_url String Image link to reviewer
reviewer.channel etsy
thirdparty_account.external_id url Sample google maps url. eg https://www.etsy.com/shop/lolka/reviews
thirdparty_account.platform String google

Amazon

field Validation Description
external_id string This is an internally generated ID
external_link url This is a unique url to amazon.eg. https://www.amazon.com/WinSpin-Tabletop-Spinning-Prize-Fortune/product-reviews/B00OZH6EPO/ref=cm_cr_getr_d_paging_btm_2?ie=UTF8&reviewerType=all_reviews&sortBy=recent&filterByStar=all_stars&pageNumber=2#R3J4K2F5ZJLYG0
rating Number, optional Rating should be between 1 to 5 only
message string, optinal The review message
created_at_platform date in seconds The time the review was created on the platform
updated_at_platform date in seconds The time the review was updated on the platform. If we dont know the recent update we can use the craeted date to replace this
images array of Objects,optional It can have any of the following thumbnail, original and standard
platform amazon
source amazon_review
reviewer.display_name string, optional The reviewer's name
reviewer.external_reviewer_id String The reviewer's id
reviewer.profile_url String A link to the profile url of the reviewer
reviewer.image.profile_url String Image link to reviewer
reviewer.channel amazon
thirdparty_account.external_id url Sample amazon product url with reviews. eg https://www.amazon.com/WinSpin-Tabletop-Spinning-Prize-Fortune/dp/B00OZH6EPO/ref=cm_cr_arp_d_product_top?ie=UTF8
thirdparty_account.platform String amazon

Readme

Keywords

none

Package Sidebar

Install

npm i @kudobuzz/reviews-schema

Weekly Downloads

34

Version

2.3.6

License

UNLICENSED

Unpacked Size

90.3 kB

Total Files

53

Last publish

Collaborators

  • kud.bz