Thanks for the reply Hemraj94.
Thanks for trying those steps. Since that didn't resolve the issue, next will be to narrow down what's causing it a bit. First will be to boot your Mac to safe mode to see if the same issue occurs. This narrows down the issue if it's OS related.
Start up your Mac in safe mode
Another step to narrow down the issue is to create a test user profile, log in to it, then test the Messages app. This will narrow down the issue to your user profile or not.
Change Users & Groups settings on Mac
Reply back with what you discover.
All the best.