We study a scattering problem for the Helmholtz equation in 2D, which involves non-parallel open waveguides, by means of the halfspace matching method. This method has formerly been applied to periodic media and homogeneous anisotropic media, and we extend it to open waveguides. It allows the reformulation of the Helmholtz equation in an exterior domain to a set of equations for particular traces of the solution, reducing the overall dimension of the problem by 1, making it accessible for numerical discretisation. We show the well-posedness of the halfspace matching method for a model problem in the exterior of a triangular domain, assuming the presence of absorption. Furthermore, we introduce a numerical discretisation which allows the realisation of transparent boundary conditions by a system of coupled integral equations. To illustrate the practicality of this method, we study a number of optimisation examples involving junctions of open waveguides by means of material optimisation.