A Node.js script to sync a Young Living account with an Infusionsoft one.
There is a bit of hard-coded stuff in here for my specific infusionsoft app. If you're interested in using this, you will need to modify it to you needs. Specifically you'll need to adjust the custom field ID's in main.js
to match your Infusionsoft setup.
I assume you have an account with Young Living, an account with Infusionsoft, and an Infusionsoft developer account with an app set up for this. I also assume you've created the necessary custom fields in your Infusionsoft account to sync with your Young Living ones. See my example in the code for a list.
- Clone or fork this repo
- Modify it to your needs
- Create a
.env
file to store your access credentials for Young Living and Infusionsoft (see the example) - Create a file called
REFRESH
(no extension) and add your Infusionsoft refresh token (get this from https://accounts.infusionsoft.com/app/central/home) into it as JSON:{"refresh_token":"xxxxxxxxxxx21345aadsfaxx"}
$ npm install
$ node index.js
By default, this syncs every 6 hours starting at midnight derver time. You can adjust that in schedule.js
- Follow all the steps for syncing once. This will let you test to see if everything works properly and make adjustments.
- Install PM2:
$ npm install pm2 -g
- Setup the daemon to run forever:
$ pm2 start schedule.js --name inf_yl_sync
- Setup the daemon to restart on server reboot:
pm2 startup
(follow the instructions it gives you)
This code seems to work for me and my particular connection. It may not work for you. I've provided it as a way to help you get started with your own solution. In other words, it's for educational purposes only. As such, I'm not responsible for how you use it and any data loss or other damages you may incur.
Code responsibly!