Skip to content

Gatsby source plugin for loading responses from AskNicely

License

Notifications You must be signed in to change notification settings

t1mmen/gatsby-source-asknicely

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Mar 29, 2018
7d27216 · Mar 29, 2018

History

7 Commits
Mar 29, 2018
Mar 28, 2018
Mar 28, 2018
Mar 29, 2018
Mar 28, 2018
Mar 29, 2018
Mar 29, 2018
Mar 29, 2018

Repository files navigation

gatsby-source-asknicely

Loads testimonials from AskNicely into Gatsby.js

Installation

npm install gatsby-source-asknicely

Usage

To use this source you need to supply an AskNicely API key and your AskNicely subdomain. You can create an API key by logging into AskNicely and going to Cog > API. You can see your subdomain by logging into your AskNicely backend and checking the URL, e.g. mycompany.asknicely.com.

Next, edit gatsby-config.js to use the plugin:

{
    ...
    plugins: [
    ...
    {
      resolve: 'gatsby-source-asknicely',
      options: {
        subdomain: 'mycompany',
        apiKey: 'abc-123',
        // optional
        queryParams: {
            // See API docs
            // NB: camelCased!
        }
      },
    },
  ]
}

By default, gatsby-source-asknicely will only retrieve testimonials that are published. To change this behavior, you can also supply an optional queryParams parameter inside of options. Possible query parameters are detailed in AskNicely's API Documentation, but camelCased! (ie, pagesize = pageSize, since_time = sinceTime)

Querying

You can query the nodes created by the plugin as follows:

{
    allAskNicelyTestimonial {
        edges {
            node {
                ...
            }
        }
    }
}

Thanks

Based on @tumblbug's gatsby-source-workable

About

Gatsby source plugin for loading responses from AskNicely

Resources

License

Stars

Watchers

Forks

Packages

No packages published