Skip to main content

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.

sms-basic

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.

Create phone

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...