Table of Contents

Tutorials

If you have not read it yet, start with Introduction.

Send a custom SMS from your code

Before you run this, complete SMS in the Admin Panel for the relevant culture (Settings — Tutorials: SMS). Then inject ISmsService and call Send with an E.164 number and your message text.

The following example shows the idea in a small handler-style class: it sends a one-off promotional line to a sample number. Place equivalent code in your project (for example a MediatR handler, minimal API endpoint, or background job) and replace the number with a real recipient.

using CodeBlock.DevKit.Application.Services;

public sealed class WelcomeSmsSender
{
    private readonly ISmsService _sms;

    public WelcomeSmsSender(ISmsService sms) => _sms = sms;

    public Task NotifySampleUserAsync()
    {
        const string toE164 = "+15551234567"; // replace with a real, verified destination
        const string message = "Welcome to our product — your trial is active.";

        return _sms.Send(toE164, message);
    }
}