When is the right time -- the first torah service that you're able to physically attend, or is there some stricter standard?
What do you do that day in shul?
Is the answer different for a woman or a minor? (Are they obligated to gomel? If not obligated, permitted?)
One should attend synagogue as soon as one can (preferably within 3 days).
One should try to get an Aliya to the Torah. (This is considered a chiuv).