Pre-requisite: set up an integrations folder (step-by-step guide).
Edit the nango.yaml configuration
In your nango-integrations folder, open the nango.yaml configuration file (reference).
Configure a sync
This examplenango.yaml configuration describes a sync that continuously fetches contacts from Salesforce:
nango.yaml
Configure an action
This examplenango.yaml configuration describes an action that synchronously fetches a contact by ID from Salesforce:
nango.yaml
Write an integration script
Generate the integration script scaffolding
Everytime that you modify thenango.yaml configuration, run:
Start script development mode
Before you plan to modify your scripts, run:Write a sync script
Open the generated sync script (named[sync-name].ts) which should contain the following scaffolding :
salesforce-contacts.ts
fetchData method with your integration code (in the example here, we fetch tasks from Salesforce):
salesforce-contacts.ts
nango.lastSyncDateis the last date at which the sync has runawait nango.batchSave()to persist external data in Nango’s cacheawait nango.get()to perform an API request (automatically authenticated by Nango)await nango.log()to print console logs (replacesconsole.log())
Write an action script
Open the generated action script (named[action-name].ts) which should contain the following scaffolding :
salesforce-contact-fields.ts
runAction method with your integration code (in the example here, we fetch available contact fields from Salesforce):
salesforce-contact-fields.ts
await nango.get()to perform an API request (automatically authenticated by Nango)nango.ActionError()to report errors in the execution of the scriptawait nango.log()to print console logs (replacesconsole.log())returnwill synchronously return results from the action trigger request
Test your scripts locally
Easily test your scripts locally as you develop them with thedryrun function of the CLI (reference):