I am trying to figure out the conditions under which you can glue together a collection of (differentiable) stacks by equivalences, and get a differentiable stack.

More precisely, I have a collection of stacks $U_i$ and open substacks $U_i|_j\hookrightarrow U_i$ with equivalences $\varphi_{ij}:U_i|_j\to U_j|_i$ so that $\varphi_{ij}\circ \varphi_{ji}\cong \operatorname{Id}_{U_i|_j}$. I want to know when and how this determines a differentiable stack.

If we assume the $U_i$'s are manifolds and the $\varphi_{ij}$'s satisfy the cocycle condition $\varphi_{jk}\circ \varphi_{ij}=\varphi_{ik}$ (after restricting the domains), then gluing along the $\varphi_{ij}$'s will give us a (possibly non-Hausdorff) manifold $M$. We can think of $M$ as the coequalizer of the groupoid $\coprod_{ij} U_i|_j\rightrightarrows\coprod_i U_i$ where source map is inclusion, target is $\varphi_{ij}$ composed with inclusion, etc. (This is just a reverse-engineered Cech groupoid)

My hope/guess is that the picture for stacks works roughly this way, that maybe if we have some weak cocycle condition ($\varphi_{jk}\circ \varphi_{ij}\cong\varphi_{ik}$), maybe we can glue everything together as a (weak?) coequalizer of the appropriate groupoid (which is now a groupoid internal to the category of stacks). I'm not sure if this is right, and even if it is I don't really know how to show it.

Any thoughts/references would be much appreciated, thanks!