From 5dd379d3e04f0f583368ee218419c2ee7de279a9 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Tue, 26 Jun 2018 13:50:38 +0200 Subject: [PATCH] be more helpful in server repsonses --- webtask-zoho.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/webtask-zoho.js b/webtask-zoho.js index 19c6796..ca5d502 100644 --- a/webtask-zoho.js +++ b/webtask-zoho.js @@ -34,10 +34,25 @@ const sendRequest = (options, res) => { }) } +server.get('/', (req, res) => { + res.send(` +

Please provide one of these endpoints:

+ - /newsletter/:data
+ - /crm/:data + `) +}) + // // Subscribe to newsletter via Zoho Campaigns API // https://www.zoho.com/campaigns/newhelp/api/contact-subscribe.html // +server.get('/newsletter', (req, res) => { + res.send(` +

Please pass your data in the following format

+ - /newsletter/{Contact Email:info@oceanprotocol.com}
+ `) +}) + server.get('/newsletter/:data', (req, res) => { const { ZOHO_CAMPAIGNS_TOKEN, ZOHO_CAMPAIGNS_LIST_KEY } = req.webtaskContext.secrets const { data } = req.params @@ -52,6 +67,11 @@ server.get('/newsletter/:data', (req, res) => { // Create a new lead via Zoho CRM API // https://www.zoho.com/crm/help/api/v2/#create-specify-records // +server.get('/crm', (req, res) => { + res.send(`

Please pass your data in the following format

+ - /crm/{First Name:First Name, Last Name:Last Name,Contact Email:info@oceanprotocol.com}`) // eslint-disable-line max-len +}) + server.get('/crm/:data', (req, res) => { const { ZOHO_CRM_TOKEN } = req.webtaskContext.secrets const { data } = req.params