I am trying to register on my website via whatsapp but my code and api is running before even im enterring my email and other requirements. i want to ask user for email and wait for user input and adter that i will ask password and so on. after all this the api should run. anyone know whats the error in my code.
else if (lastMsgId && lastMsgId === 'MainMenu' && text == 1) {
await chat.sendMessage(`Please provide following details to register as seller:`);
await chat.sendMessage(`Email Id`);
user['lastMsgId'] = 'Email Id';
await chat.sendMessage('Username')
user['username'] = 'Username';
await chat.sendMessage('Password')
user['password'] = 'Password';
await axios.post('mydomain.com/wp-json/wp/v2/users',{
email: user['lastMsgId'],
username: user['username'],
password: user['password'],
roles: 'Store Vendor'
})
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});