Context : The physical conditions during high-mass star formation are poorly understood . Outflow and infall motions have been detected around massive protostellar objects , but their dependence on mass , luminosity , and age is unclear . In addition , physical conditions and molecular abundances are often estimated using simple assumptions such as spherical shape and chemical homogeneity , which may limit the accuracy . Aims : We aim to characterize the dust and gas distribution and kinematics of the envelopes of high-mass protostars . In particular , we search for infall motions , abundance variations , and deviations from spherical symmetry , using Herschel data from the WISH program . Methods : We use HIFI maps of the 987 GHz H _ { 2 } O 2 _ { 02 } – 1 _ { 11 } emission to measure the sizes and shapes of 19 high-mass protostellar envelopes . To identify infall , we use HIFI spectra of the optically thin C ^ { 18 } O 9–8 and H _ { 2 } ^ { 18 } O 1 _ { 11 } – 0 _ { 00 } lines . The high- J C ^ { 18 } O traces the warm central material and redshifted H _ { 2 } ^ { 18 } O 1 _ { 11 } – 0 _ { 00 } absorption indicates material falling onto the warm core . We probe small-scale chemical differentiation by comparing H _ { 2 } O 752 and 987 GHz spectra with those of H _ { 2 } ^ { 18 } O . Results : Our measured radii of the central part of the H _ { 2 } O 2 _ { 02 } – 1 _ { 11 } emission are 30-40 % larger than the predictions from spherical envelope models , and axis ratios are < 2 , which we consider good agreement . For 11 of the 19 sources , we find a significant redshift of the H _ { 2 } ^ { 18 } O 1 _ { 11 } – 0 _ { 00 } line relative to C ^ { 18 } O 9–8 . The inferred infall velocities are 0.6–3.2 km s ^ { -1 } , and estimated mass inflow rates range from 7 \times 10 ^ { -5 } to 2 \times 10 ^ { -2 } M _ { \odot } /yr , with the highest mass inflow rates occurring toward the sources with the highest masses , and possibly the youngest ages . The other sources show either expanding motions or H _ { 2 } ^ { 18 } O lines in emission . The H _ { 2 } ^ { 18 } O 1 _ { 11 } – 0 _ { 00 } line profiles are remarkably similar to the differences between the H _ { 2 } O 2 _ { 02 } – 1 _ { 11 } and 2 _ { 11 } – 2 _ { 02 } profiles , suggesting that the H _ { 2 } ^ { 18 } O line and the H _ { 2 } O 2 _ { 02 } – 1 _ { 11 } absorption originate just inside the radius where water evaporates from grains , typically 1000–5000 au from the center . In some sources , the H _ { 2 } ^ { 18 } O line is detectable in the outflow , where no C ^ { 18 } O emission is seen . Conclusions : Together , the H _ { 2 } ^ { 18 } O absorption and C ^ { 18 } O emission profiles show that the water abundance around high-mass protostars has at least three levels : low in the cool outer envelope , high within the 100 K radius , and very high in the outflowing gas . Thus , despite the small regions , the combination of lines presented here reveals systematic inflows and chemical information about the outflows .