Context. Messier 8 (M8), one of the brightest H II regions in our Galaxy, is powered by massive O-type stars and is associated with recent and ongoing massive star formation. Two prominent massive star-forming regions associated with M8 are M8-Main, the particularly bright part of the large-scale H II region (mainly) ionized by the stellar system Herschel 36 (Her 36) and M8 East (M8 E), which is mainly powered by a deeply embedded young stellar object (YSO), the bright infrared (IR) source M8E-IR. Aims. We study the interaction of the massive star-forming region M8 E with its surroundings using observations of assorted diffuse and dense gas tracers that allow quantifying the kinetic temperatures and volume densities in this region. With a multiwavelength view of M8 E, we investigate the cause of star formation. Moreover, we compare the star-forming environments of M8-Main and M8 E, based on their physical conditions and the abundances of the various observed species toward them. Methods. We used the Institut de Radioastronomía Millimétrica 30 m telescope to perform an imaging spectroscopy survey of the ~1 pc scale molecular environment of M8E-IR and also performed deep integrations toward the source itself. We imaged and analyzed data for the J = 1 → 0 rotational transitions of 12CO, 13CO, N2H+, HCN, H13CN, HCO+, H13CO+, HNC, and HN13C observed for the first time toward M8 E. To visualize the distribution of the dense and diffuse gas in M8 E, we compared our velocity-integrated intensity maps of 12CO, 13CO, and N2H+ with ancillary data taken at IR and submillimeter wavelengths. We used techniques that assume local thermodynamic equilibrium (LTE) and non-LTE to determine column densities of the observed species and constrain the physical conditions of the gas that causes their emission. Examining the class 0/ I and class II YSO populations in M8 E, allows us to explore the observed ionization front (IF) as seen in the high resolution Galactic Legacy Infrared Mid-Plane Survey Extraordinaire (GLIMPSE) 8 μm emission image. The difference between the ages of the YSOs and their distribution in M8 E were used to estimate the speed of the IF. Results. We find that 12CO probes the warm diffuse gas also traced by the GLIMPSE 8 μm emission, while N2H+ traces the cool and dense gas following the emission distribution of the APEX Telescope Large Area Survey of the Galaxy 870 μm dust continuum. We find that the star-formation in M8 E appears to be triggered by the earlier formed stellar cluster NGC 6530, which powers an H II region giving rise to an IF that is moving at a speed ≥0.26 km s−1 across M8 E. Based on our qualitative and quantitative analysis, the J = 1 → 0 transition lines of N2H+ and HN13C appear to be more direct tracers of dense molecular gas than the J = 1 → 0 transition lines of HCN and HCO+. We derive temperatures of 80 and 30 K for the warm and cool gas components, respectively, and constrain the H2 volume densities to be in the range of 104–106 cm−3. Comparison of the observed abundances of various species reflects the fact that M8 E is at an earlier stage of massive star formation than M8-Main.