Despite the snarky bolding and still incorrect capitalization, your description is quite helpful -- do that first next time. It suggests you want the opposite of what it sounded like before. You want to conditionally modify data received by the "router" before passing it on? That is a standard functionality of connection tracking router/firewalls. For instance, NAT works by modifying the headers of packets flowing through the router, and "deep packet inspection" filters look at the payload as well as the headers.
You will need to do this on the router. Specifically you will need to modify the firewall / routing configuration on your router to send candidate packets (based on standard header criteria like source/destination IP and ports) to a filter application which you will have to write that does the appropriate deep packet inspection and modification before sending them back to the network. The exact APIs you will use depend on what router you are using.
I'm assuming you have limited control over the endpoint devices, since modifying the data in transit is not the best way to do this. Its much better to send the correct information in the first place.
It would be helpful to know what protocol the end devices are speaking. HTTP? TCP? UDP?