2.3.6 • Published 6 months ago

@kudobuzz/reviews-schema v2.3.6

Weekly downloads
184
License
UNLICENSED
Repository
github
Last release
6 months ago

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

valueDescription
not-neededThis means they are and excepted field in the overall schema but not needed for a specific external review
dateDate and required
stringString and required
optionalOptional

Facebook post

fieldValidationDescription
external_idstringThis should be the post id
external_linkurlThis url links back to the post
ratingnot-neededNone. A post does not have any rating
external_unique_idnot-neededA post doesnot need an external_unique_id
messagestring, optional. Some post dont come with messages but imagesThe post message
created_at_platformdate in secondsThe time the post was created on the platform
updated_at_platformdate in secondsThe time the post was updated on the platform
titlestring and optionalThe title of the post
imagesarray of Objects. It can any of the following thumbnail, original and standardThe images attached to a post
platformfacebook
sourcefacebook_post
reviewer.emailnot-neededThis would have been cool but we cannot get the email of the person that made the post.Not yet
reviewer.display_namestringThe reviewers name
reviewer.last_namenot-neededThe reviewers last_name
reviewer.first_namenot-neededThe reviewers first name
reviewer.emailnot-neededThe reviewers email
reviewer.external_reviewer_idStringThe reviewers id
thirdparty_account.external_idnot neededThe account id of the post
thirdparty_account.namenot-neededThe name of the page
thirdparty_account.platformStringfacebook
thirdparty_account.sub_account.external_idStringThe id of the page
thirdparty_account.sub_account.namenot-neededThe id of the page
thirdparty_account.sub_account.handlenot-neededThe id of the page

Facebook comment

fieldValidationDescription
external_idstringThis should be the post id
external_linkurlThis url links back to the post
external_parent_idstringThis should be the parent comment id
ratingnot-neededNone. A comment does not have any rating
external_unique_idnot-neededA comment doesnot need an external_unique_id
messagestring, optional. Some post dont come with messages but imagesThe post message
created_at_platformdate in secondsThe time the comment was created on the platform
updated_at_platformdate in secondsThe time the comment was updated on the platform
titlestring and optionalThe title of the comment
imagesarray of Objects. It can any of the following thumbnail, original and standardThe images attached to a post
platformfacebook
sourcefacebook_comment
reviewer.emailnot-neededThis would have been cool but we cannot get the email of the person that made the post.Not yet
reviewer.display_namestringThe reviewers name
reviewer.last_namenot-neededThe reviewers last_name
reviewer.first_namenot-neededThe reviewers first name
reviewer.emailnot-neededThe reviewers email
reviewer.external_reviewer_idStringThe reviewers id
thirdparty_account.external_idnot neededThe account id of the post
thirdparty_account.namenot-neededThe name of the page
thirdparty_account.platformStringfacebook
thirdparty_account.sub_account.external_idStringThe id of the page
thirdparty_account.sub_account.namenot-neededThe id of the page
thirdparty_account.sub_account.handlenot-neededThe id of the page

facebook review

fieldValidationDescription
external_idstringThis should be the post id
external_linkurlThis url links back to the post
ratingNumberRating should be between 1 to 5 only
external_unique_idnot-neededA post doesnot need an external_unique_id
messagestringThe review message
created_at_platformdate in secondsThe time the review was created on the platform
updated_at_platformdate in secondsThe time the review was updated on the platform
titlestring and optionalThe title of the post
imagesarray of Objects. It can have any of the following thumbnail, original and standardThe images attached to a post
platformfacebook
sourcefacebook_review
reviewer.emailnot-neededThis would have been cool but we cannot get the email of the person that made the post.Not yet
reviewer.display_namestringThe reviewers name
reviewer.last_namenot-neededThe reviewers last_name
reviewer.first_namenot-neededThe reviewers first name
reviewer.emailnot-neededThe reviewers email
reviewer.external_reviewer_idStringThe reviewers id
thirdparty_account.external_idnot neededThe account id of the post
thirdparty_account.namenot-neededThe name of the page
thirdparty_account.platformStringfacebook
thirdparty_account.sub_account.external_idStringThe id of the page
thirdparty_account.sub_account.namenot-neededThe id of the page
thirdparty_account.sub_account.handlenot-neededThe id of the page

yelp

fieldValidationDescription
external_idstringThis is an internally generated ID
external_linkurlThis is the Yelp page url
ratingNumberRating should be between 1 to 5 only
messagestringThe review message
created_at_platformdate in secondsThe time the review was created on the platform
updated_at_platformdate in secondsThe time the review was updated on the platform
imagesarray of Objects. It can have any of the following thumbnail, original and standardThe images attached to a post
platformyelp
sourceyelp
reviewer.display_namestringThe reviewer's name
reviewer.external_reviewer_idStringThe reviewer's id
reviewer.image.profile_urlStringThe reviewer's image url
thirdparty_account.external_idurlThis is the Yelp page url
thirdparty_account.platformStringyelp

google

fieldValidationDescription
external_idstringThis is an internally generated ID
external_linkurlThis is a unique url to find that specific review
ratingNumber, optionalRating should be between 1 to 5 only
messagestring, optinalThe review message
created_at_platformdate in secondsThe time the review was created on the platform
updated_at_platformdate in secondsThe time the review was updated on the platform. If we dont know the recent update we can use the craeted date to replace this
imagesarray of Objects,optionalIt can have any of the following thumbnail, original and standardThe images attached to a post
platformgoogle
sourcegoogle_review
reviewer.display_namestring, optionalThe reviewer's name
reviewer.external_reviewer_idStringThe reviewer's id
reviewer.profile_urlStringA link to the profile url of the reviewer
reviewer.image.profile_urlStringImage link to reviewer
reviewer.channelgoogle
thirdparty_acccount.google_places_idurl,optional
thirdparty_account.external_idurlSample 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.platformStringgoogle

Etsy

fieldValidationDescription
external_idstringThis is an internally generated ID
external_linkurlThis 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
ratingNumber, optionalRating should be between 1 to 5 only
messagestring, optinalThe review message
created_at_platformdate in secondsThe time the review was created on the platform
updated_at_platformdate in secondsThe time the review was updated on the platform. If we dont know the recent update we can use the craeted date to replace this
imagesarray of Objects,optionalIt can have any of the following thumbnail, original and standardThe images attached to a post
platformetsy
sourceetsy_review
reviewer.display_namestring, optionalThe reviewer's name
reviewer.external_reviewer_idStringThe reviewer's id
reviewer.profile_urlStringA link to the profile url of the reviewer
reviewer.image.profile_urlStringImage link to reviewer
reviewer.channeletsy
thirdparty_account.external_idurlSample google maps url. eg https://www.etsy.com/shop/lolka/reviews
thirdparty_account.platformStringgoogle

Amazon

fieldValidationDescription
external_idstringThis is an internally generated ID
external_linkurlThis 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
ratingNumber, optionalRating should be between 1 to 5 only
messagestring, optinalThe review message
created_at_platformdate in secondsThe time the review was created on the platform
updated_at_platformdate in secondsThe time the review was updated on the platform. If we dont know the recent update we can use the craeted date to replace this
imagesarray of Objects,optionalIt can have any of the following thumbnail, original and standardThe images attached to a post
platformamazon
sourceamazon_review
reviewer.display_namestring, optionalThe reviewer's name
reviewer.external_reviewer_idStringThe reviewer's id
reviewer.profile_urlStringA link to the profile url of the reviewer
reviewer.image.profile_urlStringImage link to reviewer
reviewer.channelamazon
thirdparty_account.external_idurlSample 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.platformStringamazon
2.3.4

10 months ago

2.3.3

10 months ago

2.3.6

6 months ago

2.3.5

10 months ago

2.3.2

2 years ago

2.3.0

2 years ago

2.3.1

2 years ago

2.2.9

2 years ago

2.2.8

3 years ago

2.2.7

3 years ago

2.2.6

3 years ago

2.2.5

4 years ago

2.2.4

4 years ago

2.2.3

5 years ago

2.2.2

5 years ago

2.2.1

6 years ago

2.2.0

6 years ago

2.1.6

6 years ago

2.1.5

6 years ago

2.1.4

6 years ago

2.1.3

6 years ago

2.1.0

6 years ago

2.0.2

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago