“What prompted you to contact me?”
Your ex-boyfriend called you and invited you to have coffee together. Now you're sitting with him. You want to know why he called and invited you out.
What prompted you to contact me?
To "contact" someone means to call, email, or send a letter to them. Those words are all specific, but "contact" can mean all three.
You can ask "What prompted you to ___?" to find out why someone did something. Specifically, you're asking what event made the person decide to start doing that action.
For example, here's a short conversation:
A: So what prompted you to look for a new job after all of these years working there?
B: Well, they just hired a new manager, who is totally incompetent. I couldn't stand it any longer.
"What prompted you to ___?" is also a little more formal than asking "Why did you ___?"