sendMessage is not defined
# 🤝help
l
I'm performing validation on a captured phone number using AI created code and get the following error: [ReferenceError, sendMessage is not defined] code: const number = event.payload.text if (number.length === 9 && /^\d+$/.test(number)) { workflow.mobileNumber = number } else { await sendMessage("Please enter a 9-digit number.") } Isn't sendMessage a pre-defined botpress function?
a
You can't send messages via code (at least not within botpress). Better to save the message you want to a variable then display that. If you don't, you'll have parts of your conversation in the visual flow editor and others outside, which is going to be confusing.
l
ok. got it. Thanks.