1) The custom among Ashkenazim is that both the father and mother recite the bracha of hatov v’hameitiv [ברוך אתה ה’ אלקינו מלך העולם הטוב והמטיב] immediately upon hearing the joyous news that their child is a boy. (S.A. 223:1)
2) While some ashkenazim have adopted the custom of not reciting this bracha and there were poskim who attempted to justify this custom, (See Aruch Hashulchan and Divrei Yetziv 88) the majority of ashkenazik poskim stress that for normative halacha both the parents should recite the bracha of hatov v’hameitiv. This is especially so if the parents feel strongly that they want to express their appreciation to Hashem, they are permitted to recite the bracha. (See Igros Moshe 5:43:5, Emes L’Yaakov 223, Vsein Bracha vol. 2 page 19, Teshuvos V’Hanhagos 200)
3) The custom among Sefardim is not to recite the bracha of hatov v’hameitiv upon the birth of a boy. However, they should have in mind to praise Hashem for the birth of their son when they say the fourth bracha of birchas hamazon, the bracha of hatov v’hameitiv. (See Vzos Habracha page 170)
4) The mother should first wash her hands before reciting the bracha, since many times during childbirth her hands become dirty. (Halichos Ketanim Utenokos page 16)
5) The husband should recite the bracha while standing. It is often difficult for the new mother to stand in order to recite the bracha and therefore she may recite it while seated. (ibid.)
6) The bracha is recited upon the birth of a boy even if the couple already has a son. (Aruch Hashulchan 223:9)
7) The bracha should be recited right away after the birth. Harav Moshe Shternbuch shlit”a writes that “The bracha should be recited after the immediate pain of labor subsides and after the child is initially checked by the doctors and the parents are assured that the child is b”h healthy. This is generally moments after labor.” (Teshuvos V’Hanhagos 1:200)
8) If the bracha was not recited at that point one can still recite the bracha as long as one still clearly feels the joy. The poskim explain that it is unclear as to how long that is practically. (See Ketzos Hashulchan 64 Badei Hashulchan 11) A) Harav Yaakov Emden zt”l (Mor Uketzia 224) writes that the bracha can be said only for the first three days after birth. If three days have passed, they should have in mind to praise Hashem for the birth of their son when they say the fourth bracha of birchas hamazon, the bracha of hatov v’hameitiv. B) Harav Moshe Shternbuch shlit”a maintains that the bracha can be recited as long as one is still telling his immediate friends and family that he just had a boy. Harav Yitzchak Fuchs shlit”a writes that generally one is still informing others of the simcha until the bris. (Halichos Ketanim Utenokos page 17)
9) The bracha of hatov v’hameitiv was instituted for the birth of a boy and not for a daughter. The Shulchan Aruch (223) also makes no mention of reciting a shehechiyanu for the birth of a daughter.
Nevertheless, the Baal Hatania (Birchas Hanehenin 2:12) and Mishnah Berurah (223:2) rules that when the father or mother sees their newborn girl for the first time they should recite shehechiyanu. This is because seeing a friend who you haven’t seen for a long time is in and of itself a reason to recite shehechiyanu. This is also the view of Harav Moshe Feinstein zt”l. (Igros Moshe 5:47:5)
Other poskim, including Harav Shlomo Zalman Auerbach zt”l and the Sanz Klausenberger Rebbe zt”l, state that a bracha should not be made when they see their newborn daughter for the first time. (See Halichos Shlomo page 270 and Netai Gavriel Niddah vol. 3 page 564)
10) The Mishnah Berurah concludes that grandparents should not recite a bracha of hatov v’hameitiv, for their new grandson, or a shehechiyanu, for their new granddaughter. (See Biur Halacha 223) However, Harav Chaim Naeh zt”l maintains that if they are really happy and they wish to thank Hashem, they may recite the bracha of hatov v’hameitiv on hearing of the news that they have a grandson and they may recite shehechiyanu upon seeing the granddaughter for the first time. (Ketzos Hashulchan 64 Badei Hashulchan 11) For normative halacha, a rabbi should be consulted.
11) If parents adopt a child no bracha is recited, even if the adopted child brings them joy. (Halichos Tenokos Uketanim page 19)