This is a Node.js app that uses Salesforce and Webex Oauth to sync contacts from Salesforce to Webex. It is intended to be used as a reference for developers who want to build a similar integration.
This project creates a locally running Node.js web server which lets you authenticate using a Webex Integration OAuth redirect URL flow. It then sets up a cron job to continually refresh the access token. In example, the project refreshes the token ever 24 hours.
Project then uses the access token to sync contacts from Salesforce to Webex.
Clone this repository and change directory:
git clone https://github.com/sieteunoseis/salesforce-webex-contact-sync.git && cd salesforce-webex-contact-sync
Rename the example environment file from .env.example
to .env
:
cp env.example .env
Configure the environment file for the Salesforce/Webex OAuth Integration.
Additional guide on where to get these values is below
SALESFORCE_CLIENT_ID=<CLIENT_ID> SALESFORCE_CLIENT_SECRET=<CLIENT_SECRET> SALESFORCE_USERNAME=<USERNAME> SALESFORCE_PASSWORD=<PASSWORD> SALESFORCE_SECURITYTOKEN=<SECURITY_TOKEN> WEBEX_ORG_ID=<ORG_ID> WEBEX_APP_CLIENT_ID=<CLIENT_ID> WEBEX_APP_CLIENT_SECRET=<CLIENT_SECRET> WEBEX_APP_RETURN_URL=http://localhost:3000 WEBEX_APP_REDIRECT_URL=http://localhost:3000/oauth WEBEX_APP_AUTHORIZATION_URL=https://webexapis.com/v1/authorize WEBEX_APP_TOKEN_URL=https://webexapis.com/v1/access_token WEBEX_APP_SCOPES=Identity:contact PORT=3000
Install project:
npm install
Start the server in development mode (using a local env file):
npm run dev
or start the server in production mode:
npm run start
Navigate using your browser to the link below to begin the OAuth flow which will give this project a refresh and access token based off your Webex Account:
http://localhost:3000
npm run docker:build
npm run docker:run
Note: Update the config section of the package.json file to change the name and platform.
docker run -d -p 3000:3000 --name salesforce-webex-sync --restart=always --env-file=.env -v ./data:/app/data sieteunoseis/salesforce-webex-contact-sync:latest
Navigate to this page to create a new Webex Integration using your Webex Account:
https://developer.webex.com/my-apps
Click on Create a New App
Click on Integration
Fill out your intergration details, enter any name and decription and select any icon:
/oauth
)Identity:contact
Scroll to the bottom and click Add Integration.
Take a note of the Client ID and Client Secret for the environment file configuration above
Setup
Apps
App Manager
New Connected App
/oauth
)Manage user data via APIs (api)
Save
Manage Consumer Details
Manage
at the top and then Edit Policies
OAuth Policies
select All users may self-authorized
Relax IP restrictions
Save
OAuth and OpenID Connect Settings
select Allow OAuth Username-Password Flows
All contents are licensed under the MIT license. Please see license for details.
If you would like to support my work and the time I put in creating the code, you can click the image below to get me a coffee. I would really appreciate it (but is not required).
Owner
Contributors
Categories
Products
WebexProgramming Languages
JavaScriptLicense
Code Exchange Community
Get help, share code, and collaborate with other developers in the Code Exchange community.View Community