I found out my boyfriend was texting his ex. Advice please?

So a while back I figured out that my boyfriend was secretly messaging his ex. Im not proud of how I found out, I looked threw his phone. I know its wrong because its an invasion of his privacy and I should be able to trust him or confront. I just knew things were off and he was being more secretive, I only looked threw it to put my mind at rest because I thought I was being paranoid. What I saw was that he was texting his ex till about three in the morning (the last message when I found it). I dont know how long it was going on for and what was truly said because all but three messages were deleted. Texting his ex wasn't the main problem, but I admit I wouldn't be too happy however I can't tell him who can talk to, but he hid it and deleted the messages which tells me there was something that was bad enough for me not to see. I told him I knew he was talking to his ex and admitted to him what I did and asked him what was going on. He admitted that he was talking to her and flirting with her for an ego boost. She was the girl that cheated on him in school. We are both in our 20s now. I asked him what he said but he told me he can't remember and when I first asked him what was going on before he knew I looked through his phone, he said I could check his messages. That's when I told him I knew he deleted them. It was obvious enough.
He did apologise for it and didn't get mad at me going through his phone. He accepted he was in the wrong. The next time she contacted him he blocked her and said that he didn't want to talk to her anymore for the sake of our relationship. While I have forgiven him, Im still a bit bothered by it. Did I over react? Should I have reacted differently. I thought I made him happy why did he need her to give him an ego boost? I really want to know what was said and I know Ill never get an answer. I thought we were happy and we get along so well. This is my first relationship so some advice and others opinions would be really helpful.
Thanks :)
Updates
+1 y
Hey thanks for all the opinions and advice I don't really have anyone non biased I can talk to you and unfortunately I know my friend is one of telling stories.
For a bit of background we are together for about two years and are currently living with one another. He is a really great guy and can have a heart of gold. We get along so well and he says he's never been more himself and comfortable in a relationship. But this threw me for a loop.
I found out my boyfriend was texting his ex. Advice please?
Post Opinion