Services
If you have not read it yet, start with Introduction.
Your application code depends on ISmsService when it needs to send an SMS. DevKit registers a default implementation at runtime; you only work against this interface.
The contract is defined in ISmsService.cs in the Application layer:
// Copyright (c) CodeBlock.Dev. All rights reserved.
// For more information visit https://codeblock.dev
namespace CodeBlock.DevKit.Application.Services;
/// <summary>
/// Service interface for sending SMS messages.
/// Provides SMS delivery functionality for notifications and communications.
/// </summary>
public interface ISmsService
{
/// <summary>
/// Sends an SMS message to the specified phone number.
/// </summary>
/// <param name="to">The phone number of the recipient (should be in E.164 format).</param>
/// <param name="message">The text message content to send.</param>
/// <returns>A task representing the asynchronous SMS sending operation.</returns>
Task Send(string to, string message);
}
to— Recipient phone number in E.164 form (for example+15551234567) so carriers accept it reliably.message— Full body text you want delivered (build it in code or from Settings templates before callingSend).
Inject ISmsService in handlers, Blazor components, or API endpoints the same way you inject other application services. Use await on Send so the task completes and any failures are visible to your host.
Whether a message is actually sent still depends on Settings (SMS enabled, valid provider configuration); see Configuration and Settings — Tutorials: SMS.