fleet/website/api/controllers/deliver-demo-signup.js
eashaw 5f777729f0
Add Q&A signup form to Fleet homepage (#4224)
* create deliver-demo-signup action

* register call to action and styles

* Update homepage.less

* Update deliver-demo-signup.js

* Update homepage.less

* Update homepage.ejs

* Update deliver-demo-signup.js

* update message
2022-02-16 11:15:55 +09:00

47 lines
1.2 KiB
JavaScript
Vendored

module.exports = {
friendlyName: 'Deliver demo signup',
description: 'Delivers a message to an internal slack channel to notify us when someone signs up for our live Q&A',
inputs: {
emailAddress: {
required: true,
type: 'string',
description: 'The email address that will be invited to join a Fleet Q&A.',
example: 'hermione@hogwarts.edu'
}
},
exits: {
success: {
description: 'The message was sent successfully.'
}
},
fn: async function({emailAddress}) {
if (!sails.config.custom.slackWebhookUrlForContactForm) {
throw new Error(
'Message not delivered: slackWebhookUrlForContactForm needs to be configured in sails.config.custom. Here\'s the undelivered message: ' +
`New demo session signup: (Remember: we have to invite them to the next demo session.) cc @sales `+
`Email: ${emailAddress}`
);
} else {
await sails.helpers.http.post(sails.config.custom.slackWebhookUrlForContactForm, {
text: `New demo session signup: (Remember: we have to invite them to the next demo session.) cc @sales \n`+
`Email: ${emailAddress}`
});
}
}
};