Creating Nice Alerts with sweetAlert

i wondering if i can echo out sweet alert script?
this is my code
echo “< script> swal(“heres a message”)< /script>”;