Confused about coproduct in $\mathbf{Ab}$: what are the inclusion maps, and what is the unique map from coproduct to arbitrary object? Note that I have looked at similar questions/answers on this topic, but have not found the clarity I need yet as they have been a bit out of my reach of understanding.
I have heard that the coproduct for abelian groups coincides with its construction of the product. I am struggling to understand however how the inclusion maps would technically be defined, or how the unique map (up to unique isomorphism) would be defined from the direct sum of two groups to another group.
I'll set the stage. So we have groups $\mathcal{G}$ and $\mathcal{H}$, and because the direct sum coincides with the direct product, we can notate its direct sum as $\mathcal{G} \times \mathcal{H}$. To talk about coproduct, we want an arbitrary abelian group $\mathcal{X}$ that we will have a unique homomorphism $\theta\colon\ \mathcal{G}\times\mathcal{H} \to \mathcal{X}$ to.
To construct this, we must also have homomorphisms $\phi \colon\ \mathcal{G} \to \mathcal{X}$, $\psi \colon\ \mathcal{H} \to \mathcal{X}$ from both of our fixed groups.
What are our inclusion maps $$\iota_\mathcal{G} \colon\ \mathcal{G} \to \mathcal{G} \times \mathcal{H}
\\
\iota_\mathcal{H} \colon\ \mathcal{H} \to \mathcal{G} \times \mathcal{H}$$ defined as?
For a long while, I wasn't even sure how to map a single element of $\iota_\mathcal{G}$, like, $\iota_\mathcal{G}(g) = (g, ?)$, because I could not at all figure out how to make it a valid member of $\mathcal{G} \times \mathcal{H}$. But I think I might have a firmer handle on this now, remembering that each group has a dedicated identity, thus:
$$\iota_\mathcal{G}(g) = (g, e_\mathcal{H}) \qquad \iota_\mathcal{H}(h) = (e_\mathcal{G}, h)$$
Where the resulting group would define its operation componentwise. With that, $$\theta\colon\ \mathcal{G}\times\mathcal{H} \to \mathcal{X}$$
would have to be
$$\theta(g, h) = \begin{cases}
e_\mathcal{X},& g = e_\mathcal{G} \ \& \ h = e_\mathcal{H}\\
\phi(g), & h = e_\mathcal{H} \\
\psi(h), & g = e_\mathcal{G} \\\end{cases}$$
in order for inclusion followed by $\theta$ to be equal to $\phi$ and $\psi$, right?
I am not confident in these things; particularly, I notice how I haven't at all used the abelian properties of the groups here yet. So I am looking for helpful guidance wherever I might be going astray here (as a rather novice student of math). Thank you.
Edit
Thank you Alekos for your insightful answer. A mistake I was making was to understand the actual coproduct object to be only constructable via the inclusion maps. Instead, the inclusion maps are of course (viewed as set functions) injections into the (cartesian product) set representing the direct sum. So, (and this I hadn't realized) the set given by the direct sum is in general (significantly) larger than the set constructed by the union of the inclusion map on $\mathcal{G}$ and the inclusion map on $\mathcal{H}$. Because I was not seeing the object $\mathcal{G} \oplus \mathcal{H}$ as constructed independently of the inclusion maps, I was missing that $\theta$ needs to also be defined for the case where $(g, h)$ are simultaneously not the identity—a case that would not arise when composed with an inclusion map, but which would in general.
Once I understood this, it became obvious to me how this direct sum $\mathcal{G} \oplus \mathcal{H}$ is the same mathematical object as its direct product $\mathcal{G} \times \mathcal{H}$; that is to say, its underlying set is exactly the same and given by the cartesian product. Depending on context, you can map to it using the homomorphism defined for products, or from it using the homomorphism for the direct sum shown here. That is pretty cool!
 A: You are pretty much correct. Be careful to emphasize that $G$ and $H$ are to be understood as being Abelian groups. In the category of groups the coproduct and product are very different. It is customary to denote the neutral element in an Abelian group $A$ by $0_A$, since we typically think of the operation as "addition."
Anyway, the product is commonly written as $G\times H$ and the coproduct is written as $G\oplus H$. As you correctly deduced, the inclusion morphisms are $i_G:G\to G\times H$ by $i_G(g)=(g,0)$ and $i_H:H\to G\times H$ by $i_H(h)=(0,h)$. However, your definition of the induced map is not yet complete. Indeed, you have not defined it in the case where $(g,h)$ has neither $g= 0_G$ nor $h=0_H$. Luckily, you have specified enough information as now the definition
$$ \theta(g,h)=\theta(g,0)+\theta(0,h)=\phi(g)+\psi(h)$$
is forced. As you observed, everything is forced by the condition that the diagram in the coproduct definition commutes.
Exercise: why doesn't this work if we don't assume that that $G,H$ and $X$ (in your notation) are Abelian?
Hint: think about what it means for $\theta$ to be a homomorphism as defined.
