Extracting codes from SMS and email
Learn how to test verification codes found in SMS and email messages with SMSByrd.
Before you begin
The examples shown below are based on two key assumptions:
- That you have already create a basic automated test using our getting started guides.
- You have a chosen assertion library that you will use to test the values shown below.
Links within SMS and email text content
When an email or SMS message is sent with plain text content, SMSByrd automatically extracts anything that look like a verification code and makes these available via the text.codes array. Each code has a value property, representing the code itself.
//code snippet
Links within email HTML content
As with links found within the text content of a message, SMSByrd also detects and extracts codes found within the HTML of any email.
These are made available viable via the html.codes array.
What if my code is not detected?
SMSByrd automatically detects most common verification code patterns, however you can still write your own regular expressions to meet more specific requirements.