Greywater reuse

Can water from bathroom (excluding WC), kitchen, sink, basin, washing machine etc be used for rainwater harvesting. Is there a way to use this water to give to plants. I am worried that the soap in this water may damage the plants or make the soil saline over the course of time. What type of treatment should be provided for reuse of greywater for the purpose mentioned above. Thank you