I'm implementing the Slack Incoming Webhook into my application but it seems to crash if values are empty. Does slack allow empty strings to be passed?
{
type: "plain_text",
text: req.body.contactNumber,
emoji: true,
},
So for example, the contact number won't always have a value inside the string. What's the best way to allow the message to be sent even if it is empty?
You could add a default value in case there is none:
{
type: "plain_text",
text: req.body.contactNumber || 'none',
emoji: true,
},