Please do the following steps to configure iMessage:
1. Go to the phone Settings
2. Go to Messages
3. Toggle iMessage OFF and back ON
4. Tap on Send & Receive
5. Uncheck your mobile number and select your email address. You will be able to send and receive iMessage with your data connection by doing this.
How to configure my eSIM to work? (iOS)