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.
The POST /phone-numbers endpoint must be enabled manually with support team as each invocation bills your account for a phone number rental of one month. This is because telecom providers only rent phone numbers for a minimum of one month. If this is desired behaviour please contact support. For more information see the subscriptions page.
Viewing numbers
Use the PhoneControllerApi to manage phone numbers.
Loading...
List and view SMS messages
Use the SmsControllerApi to view and download SMS messages.
Loading...
You can fetch individual messages using the message's ID.
Loading...
Send a test message
You can instruct MailSlurp to send a test message to your phone number using the test messages:
Loading...
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
Loading...
Use SMS webhooks
Have SMS messages sent via HTTP POST to your server with TXT Webhooks
Loading...