Nacelle Iterable Module
Adds a plugin to integrate the Iterable Api
Requirements
- A Nacelle project set up locally. See https://docs.getnacelle.com for getting started.
- An Iterable account with an API key. Iterable
Setup
Add Module to Nacelle
With an iterable account and API key, can install this module in your project from npm
:
npm install nacelle-nuxt-iterable-api --save
After the package has installed, open nuxt.config.js
. Under modules
add nacelle-nuxt-iterable-module
to the array. It should look something like this:
modules: [
'@nuxtjs/pwa',
'@nuxtjs/dotenv',
'@nacelle/nacelle-nuxt-module',
'@nuxtjs/sitemap',
'nacelle-nuxt-iterable-module'
],
Next you will have to add the Iterable API key to nuxt.config.js
in the nacelle
config object.
In your Iterable account dashboard create an API key by going to "Integrations > API Keys" and clicking "New API key". Create a "Standard" api key and copy it. Then paste that value in the .env
file in your nuxt project like
ITERABLE_API_KEY="<API_KEY>"
Add that value to the nacelle
object in nuxt.config.js
of your project. It should look something like this:
nacelle: {
spaceID: process.env.NACELLE_SPACE_ID,
token: process.env.NACELLE_GRAPHQL_TOKEN,
gaID: process.env.NACELLE_GA_ID,
fbID: process.env.NACELLE_FB_ID,
iterableApiKey: process.env.ITERABLE_API_KEY
},
Use the iterable plugin
With the setup complete, you will be able to use the iterable plugin anywhere in your project like so:
async getIterableLists() {
try {
const lists = await this.$iterable.lists.get()
console.log(lists)
return lists
} catch (error) {
console.log(error)
throw error
}
}
This plugin utilizes the (unofficial) iterable api npm package