# Way to filter chat messages before they are displayed?

**URL:** <https://forum.mattermost.com/t/way-to-filter-chat-messages-before-they-are-displayed/1421>\
**Category:** Troubleshooting\
**Created:** [May 3, 2016, 2:03am UTC](https://forum.mattermost.com/t/way-to-filter-chat-messages-before-they-are-displayed/1421 "2016-05-03T02:03:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![hamzeh](https://avatars.discourse-cdn.com/v4/letter/h/54ee81/32.png) [@hamzeh](https://forum.mattermost.com/u/hamzeh)\
**Post date:** [May 3, 2016, 2:03am UTC](https://forum.mattermost.com/t/way-to-filter-chat-messages-before-they-are-displayed/1421/1 "2016-05-03T02:03:30Z")

</div>

Is there a clean way to hook in a snippet of code that sees every post before it is allowed to show up?

---

<div class="post-metadata">

**Author:** ![jwilander](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/jwilander/32/8440_2.png) [@jwilander](https://forum.mattermost.com/u/jwilander)\
**Post date:** [May 3, 2016, 11:33am UTC](https://forum.mattermost.com/t/way-to-filter-chat-messages-before-they-are-displayed/1421/2 "2016-05-03T11:33:02Z")

</div>

Hi @hamzeh,

We do our rendering of posts inside of `webapp/components/posts_view.jsx`. Maybe take a look in there to see if that’s what you’re looking for? Be warned though that that file is in queue to be refactored.

---

<div class="post-metadata">

**Author:** ![hamzeh](https://avatars.discourse-cdn.com/v4/letter/h/54ee81/32.png) [@hamzeh](https://forum.mattermost.com/u/hamzeh)\
**Post date:** [May 4, 2016, 2:44am UTC](https://forum.mattermost.com/t/way-to-filter-chat-messages-before-they-are-displayed/1421/3 "2016-05-04T02:44:55Z")

</div>

I see, that file seems to be frontend, where as we’d like to process the post on the backend, before it gets to the point of being rendered. We’d like to put a handler on the backend that sees every single post and gets a chance to modify it or otherwise act with it, before it gets rendered.

So I am curious whether there are any tips for doing that cleanly.

---

<div class="post-metadata">

**Author:** ![jwilander](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/jwilander/32/8440_2.png) [@jwilander](https://forum.mattermost.com/u/jwilander)\
**Post date:** [May 13, 2016, 12:32pm UTC](https://forum.mattermost.com/t/way-to-filter-chat-messages-before-they-are-displayed/1421/4 "2016-05-13T12:32:06Z")

</div>

You can take a look inside `api/post.go` and `store/sql_post_store.go` if you’d like to see the server code that deals with handling posts.
