To send an SMS from VB.NET, post JSON to https://api.tryready.com/v1/messages with HttpClient, your key in an X-API-Key header and an Idempotency-Key header. The body holds to, body and consent_attested. A 2xx status means the text was accepted.
Plenty of line-of-business software still runs on VB.NET: dispatch tools, scheduling apps, back-office systems that already know who to tell and when. Adding texting means one HTTP call, not a new platform. We make Ready, so the example uses only the request shape we document. If you're on C# instead, the C# and .NET guide covers the same call.
What you need first
- An API key from Ready, kept in app settings or an environment variable, not in source control.
- A card on file and a number of your own, which is $2 a month.
- A record that each recipient agreed to texts.
consent_attestedis your statement that they did. - .NET 6 or later (the
System.Text.JsonandHttpClienttypes below ship with it).
Each text costs $0.0075 per segment plus the $0.0045 carrier fee. Details are on the pricing page.
The code
Imports System.Net.Http
Imports System.Text
Imports System.Text.Json
Public Module Texting
Private ReadOnly Client As New HttpClient With {
.BaseAddress = New Uri("https://api.tryready.com"),
.Timeout = TimeSpan.FromSeconds(15)
}
Public Async Function SendText(toNumber As String, message As String,
idempotencyKey As String) As Task(Of Integer)
Dim payload = JsonSerializer.Serialize(New With {
.to = toNumber,
.body = message,
.consent_attested = True
})
Using req As New HttpRequestMessage(HttpMethod.Post, "/v1/messages")
req.Headers.Add("X-API-Key", Environment.GetEnvironmentVariable("READY_API_KEY"))
req.Headers.Add("Idempotency-Key", idempotencyKey)
req.Content = New StringContent(payload, Encoding.UTF8, "application/json")
Using res = Await Client.SendAsync(req)
Return CInt(res.StatusCode)
End Using
End Using
End Function
End Module Keep one shared HttpClient for the life of the app. Creating a new one per call can exhaust sockets under load. Use E.164 numbers such as +12125550199.
Handling the result
| Status | Meaning | Your code |
|---|---|---|
| 2xx | Accepted | Store it, mark the job done |
409 QUIET_HOURS_BLOCK | Recipient is in quiet hours, window further than 6 hours away | Try again once the window opens |
403 api_consent_attested_required | Attestation missing | Fix the body |
| 5xx or timeout | Transient | Retry with the same key |
Opted-out and Ban list numbers are refused up front and not charged, so treat that refusal as final. The retries and failure handling post has a full decision table.
A pattern for WinForms, WPF and services
Don't call the API from a button handler and wait. Put the send on a background task or a small queue so the UI stays responsive, and write the idempotency key to your own table before the call. If the app closes mid-request, the next start can resend the same row with the same key and the recipient still gets one text.
Frequently asked questions
Does VB.NET need a special library? No. HttpClient and System.Text.Json are enough, and both ship with modern .NET.
Can I use this from .NET Framework 4.8? Yes, with HttpClient and a JSON library such as Newtonsoft.Json in place of System.Text.Json.
How do I read replies? Replies arrive as webhooks to an endpoint you host. See receiving SMS with inbound webhooks.
Next step
Send one text to your own phone, then call the function twice with one key and confirm a single message arrives. The API quickstart walks through creating the key.
Accounts opened before November 12, 2026 keep their signup prices, shown under Billing.