Please add the below script under Field and Form rules for that specific template.
if ($CS.isAttachmentEmpty() == true){
alert("message");
$CS.mandateField(["ATTACHMENT"]);
}
Screenshot for reference: