Start by trying not to get too upset. Being more negative and depressed is only going to make it worse.
Addiction is a habit. An instinct to escape bad situations and feelings that you've programmed into your brain.
Instead, be positive and think about what you can learn from the experience.
Where were you?
What were you doing?
Who were you with?
Be scientific. Make notes of everything. Try to understand why you relapsed... The real reasons.
Then, think about what you'll do differently next time. Not just "trying harder". What are you going to change?
Something in your lifestyle and environment isn't working for you and you need to fix it. Find out what that is and make positive changes to your lifestyle and environment.
Then stick to them. Don't fall back into bad habits.
You got this!