gatsby-source-trustpilot-api

1.2.9 • Public • Published

Commitizen friendly

Description

Creates Trustpilot api integration for your gatsby website. This source plugin fetches data from Trustpilot API and makes it available through GraphQL nodes. The generated Query nodes can be viewed using gatsby's GraphiQL editor. This plugin just fetches the public business unit information from Trustpilot. More features will be added in further releases.

How to integrate it with Gatsby?

  1. install the plugin npm install gatsby-source-trustpilot-api
  2. configure the plugin in your gatsby-config.js file
   module.exports = {
     siteMetadata: {
         title: 'Title of your website'
     },
     plugins: [
         {
             resolve: 'gatsby-source-trustpilot-api',
             options: {
                 apiKey: 'YOUR_TRUSTPILOT_API_KEY',
                 domainName: 'YOUR_DOMAIN_NAME' // ex: trustpilot.com
             }
         }
     ]
   };

Config Options

The plugin takes two REQUIRED config options,

  1. apiKey : This is your Trustpilot API key. If you dont have one yet, here is a link - Get Started - Trustpilot API
  2. domainName: This is the domain name that you want to fetch TrustPilot Data for.

How to query for data?

If all goes well, you should be able to access nodes created by the plugin in your site's GraphiQL editor. For example:

{
  trustPilotPublicBusinessUnit {
    id
    displayName
    trustScore
    stars
    country
    numberOfReviews {
      total
      oneStar
      twoStars
      threeStars
      fourStars
      fiveStars
    }
  }
}

Package Sidebar

Install

npm i gatsby-source-trustpilot-api

Weekly Downloads

227

Version

1.2.9

License

MIT

Unpacked Size

15.6 kB

Total Files

6

Last publish

Collaborators

  • mandarm2593