1
0
mirror of https://github.com/oceanprotocol/webtasks synced 2025-01-08 13:02:53 +01:00

Merge pull request #5 from oceanprotocol/feature/errors

be more helpful in server repsonses
This commit is contained in:
Matthias Kretschmann 2018-06-26 13:55:14 +02:00 committed by GitHub
commit 9fa56716c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -34,10 +34,25 @@ const sendRequest = (options, res) => {
}) })
} }
server.get('/', (req, res) => {
res.send(`
<h3>Please provide one of these endpoints:</h3>
- <code>/newsletter/:data</code><br />
- <code>/crm/:data</code>
`)
})
// //
// Subscribe to newsletter via Zoho Campaigns API // Subscribe to newsletter via Zoho Campaigns API
// https://www.zoho.com/campaigns/newhelp/api/contact-subscribe.html // https://www.zoho.com/campaigns/newhelp/api/contact-subscribe.html
// //
server.get('/newsletter', (req, res) => {
res.send(`
<h3>Please pass your data in the following format</h3>
- <code>/newsletter/{Contact Email:info@oceanprotocol.com}</code><br />
`)
})
server.get('/newsletter/:data', (req, res) => { server.get('/newsletter/:data', (req, res) => {
const { ZOHO_CAMPAIGNS_TOKEN, ZOHO_CAMPAIGNS_LIST_KEY } = req.webtaskContext.secrets const { ZOHO_CAMPAIGNS_TOKEN, ZOHO_CAMPAIGNS_LIST_KEY } = req.webtaskContext.secrets
const { data } = req.params const { data } = req.params
@ -52,6 +67,11 @@ server.get('/newsletter/:data', (req, res) => {
// Create a new lead via Zoho CRM API // Create a new lead via Zoho CRM API
// https://www.zoho.com/crm/help/api/v2/#create-specify-records // https://www.zoho.com/crm/help/api/v2/#create-specify-records
// //
server.get('/crm', (req, res) => {
res.send(`<h3>Please pass your data in the following format</h3>
- <code>/crm/{First Name:First Name, Last Name:Last Name,Contact Email:info@oceanprotocol.com}</code>`) // eslint-disable-line max-len
})
server.get('/crm/:data', (req, res) => { server.get('/crm/:data', (req, res) => {
const { ZOHO_CRM_TOKEN } = req.webtaskContext.secrets const { ZOHO_CRM_TOKEN } = req.webtaskContext.secrets
const { data } = req.params const { data } = req.params