It is advised to consult a healthcare provider before taking melatonin, especially if pregnant or nursing, as melatonin can interact with certain medications.