Extract a verification code from messaging app on Android

Hi,
I am trying to automate an Android app which requires that user enters a verification code which is been sent via an SMS in order to log in or complete registration.

The SMS contains some texts and the verification code. I also need to know how to extract the code from the SMS.

I am using python for the automation.

Thanks

I have been able to figure it out. I used driver.open_notifications() to locate the message and then used regex to extract the code from the SMS.

check mobile: listSms: https://github.com/appium/appium/blob/master/docs/en/commands/mobile-command.md