Skip to content

Instantly share code, notes, and snippets.

@DanyF-github
Created October 29, 2021 10:06
Show Gist options
  • Save DanyF-github/0d7fb5aa2dba22bcdc23780f71506bcb to your computer and use it in GitHub Desktop.
Save DanyF-github/0d7fb5aa2dba22bcdc23780f71506bcb to your computer and use it in GitHub Desktop.
app.post('/signup', function(req, res) {
let phone = req.body.number;
vonage.channel.send(
{ type: 'whatsapp', number: phone },
{ type: 'whatsapp', number: process.env.WHATSAPP_NUM },
{ content: {
type: 'text',
text: 'Welcome to Nice Cool Shoes! What should we call you?'
}}, (e, data) => {
if (e) {
console.error(e);
} else {
db.run('INSERT INTO State (phone, state) VALUES ($phone, $state)', {
$phone: parseInt(phone),
$state: states.getUsername
}, (err) => {
if (err) {
console.error(err);
}
});
}
}
);
res.send({});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment