Use inbound TXT/SMS
MailSlurp supports creation and management of real mobile phone numbers in multiple regions. Phone numbers can receive inbound SMS text messages that can be read and received in code, tests, or online.
Common use for SMS includes testing OTP codes. See the tutorials for examples:
Creating phone numbers
First add a phone plan to your account subscription. Then provision a phone number for the plan in the MailSlurp dashboard. Phone numbers have an ID and a number. When fetching the phone number use the ID.
Use the PhoneControllerApi to manage phone numbers.
List and view SMS messages
Use the SmsControllerApi to view and download SMS messages.
You can fetch individual messages using the message's ID.
Send a test message
You can instruct MailSlurp to send a test message to your phone number using the test messages:
Wait for new SMS messages
Use the WaitForControllerApi
waitForSms methods to hold a connection open until an expected count of SMS messages is present in a phone number
Use SMS webhooks
Have SMS messages sent via HTTP POST to your server with TXT Webhooks