Advice needed..

I had unprotected sex last night with someone.. how soon after can I take doxycycline to treat chlamydia. (I didn’t know at the time was told after).