Update patient link and app templates and better handling empty messages from SQL