Last active
July 19, 2017 07:00
-
-
Save jhwheeler/b925c90dfa1f0da1f11b1f25bdded4ba to your computer and use it in GitHub Desktop.
Zoho API function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const AUTH_TOKEN = process.env.AUTH_TOKEN; | |
const API_URL = `https://cors-anywhere.herokuapp.com/https://crm.zoho.com/crm/private/xml/Leads/insertRecords?newFormat=1&authtoken=${AUTH_TOKEN}&scope=crmapi`; | |
const zoho = (answers, result) => { | |
const request = | |
`<Leads> | |
<row no="1"> | |
<FL val="Lead Source">Loans Only App</FL> | |
<FL val="Business Arm">Loans Only</FL> | |
<FL val="First Name">${answers['info-first-name']}</FL> | |
<FL val="Last Name">${answers['info-last-name']}</FL> | |
<FL val="Email">${answers['info-email']}</FL> | |
<FL val="State">${answers['info-state']}</FL> | |
<FL val="Phone">${answers['info-phone']}</FL> | |
<FL val="Applicants">${answers.applicants}</FL> | |
<FL val="Dependents">${answers.dependents}</FL> | |
<FL val="Base Income">${answers['base-income']}</FL> | |
<FL val="Tax-Free Income">${answers['tax-free-income']}</FL> | |
<FL val="Rental Income">${answers['rental-income']}</FL> | |
<FL val="Desired Loan">${answers.borrow}</FL> | |
<FL val="Loan Purpose">${answers.purpose}</FL> | |
<FL val="Rate Type">${answers['rate-type']}</FL> | |
<FL val="Current Loan Amount">${answers['current-loan-amount']}</FL> | |
<FL val="Current Loan Rate">${answers['current-loan-rate']}</FL> | |
<FL val="Total Credit Card Limits">${answers['liabilities-cc-limits']}</FL> | |
<FL val="Monthly Repayment on Personal Loans">${answers['liabilities-personal-loans']}</FL> | |
<FL val="Estimated Borrowing Capacity">${result}</FL> | |
</row> | |
</Leads>`; | |
return `${API_URL}&xmlData=${request}`; | |
} | |
export default zoho; |
Author
jhwheeler
commented
Jul 19, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment