Detect if user has the app

My users would get messages with text links from Twilio. Can I detect if the user has the app and open the app if they have it, but open the corresponding web page if they do not?