Table of Contents

Tutorials: SMS

SMS in DevKit is dynamic: it is stored with the rest of Settings and edited from the Admin Panel per language (culture). There is no SMS block in client appsettings.json.

For how ISmsService is implemented, registered, and used from code—including the Identity OTP consumer—see the supporting SMS service documentation.

Note: Outbound SMS uses Twilio. SendGrid (and other providers) appear under Settings for email, not for SMS.


1. Create or sign in to Twilio

  1. Create a Twilio account (trial or paid).
  2. In the Twilio Console, copy Account SID and Auth Token (keep the token secret; DevKit encrypts it when saved).
  3. Obtain a sender phone number Twilio can use:
    • Trial: Twilio issues a trial number; you can only send to verified recipient numbers until you upgrade.
    • Production: Buy a phone number in Phone Numbers → Manage → Buy a number for the countries you support.
  4. Use the number in E.164 form (for example +15551234567) as the From value in Settings.

Twilio’s own docs cover trial limits and messaging onboarding.


2. Open SMS settings in the Admin Panel

  1. Sign in to the Admin Panel with a user that can edit Settings.
  2. Open Settings and choose the language you are configuring (the same picker used for other localized Settings content).
  3. Locate the SMS section for that culture.

Enable SMS, choose provider Twilio, and paste:

Field Value
Account SID From Twilio Console dashboard.
Auth token From Twilio Console; stored encrypted in the database.
From phone number Your Twilio sender, E.164.

Save changes. Repeat for each culture that should send SMS in its own language or with different templates.


3. Message templates (per culture)

Three templates are required when SMS is enabled:

Template Typical use
Reset password Text sent when the user resets a password using mobile OTP.
Mobile confirmation Text sent to confirm a mobile number.
Two-factor Text sent for 2FA codes.

Built-in flows (see SendUserPasswordToUserMobile in Identity) replace these placeholders in the saved strings:

  • {PASSWORD} — the generated code or secret fragment for that SMS.
  • {APPLICATION_NAME} — the default application display name from Application settings.

You can change the wording per language; keep the placeholders if you still rely on Identity’s replacement logic.

Default layouts that combine localized labels with those placeholders are built in code via SmsTemplates (CodeBlock.DevKit.Settings.Helpers.SmsTemplates) for seeding or tooling; operators ultimately edit the stored template text in the admin UI.


4. Verify end-to-end

  1. Ensure the target mobile is allowed by your Twilio mode (verified numbers on a trial account).
  2. Trigger a flow that raises OtpCreated with ContactType.Mobile (for example Identity two-factor or mobile confirmation), or call ISmsService.Send from your own handler.
  3. Watch logs if messages do not arrive—when SMS is disabled, SmsService logs a warning and skips Twilio.