How Moodle SMS notifications and SMS MFA with AWS work
Moodle's SMS subsystem is the supported way to send text messages from a self-hosted Moodle. It arrived in Moodle 4.5 with an AWS gateway, and Moodle 5.0 added SMS notifications along with a Modica gateway plugin. If your team wants texts for notifications or a second sign-in factor, the work is to configure that subsystem against one gateway and to govern the phone numbers and sending costs that come with it. Confirm the exact gateway settings and the AWS account setup against the Moodle 4.5 release notes and your own Moodle version before you plan the build.
Two features use the gateway, and they are configured separately. SMS notifications deliver messages from Moodle's notification system to users' phones, while the SMS multi-factor authentication factor sends a one-time code at sign-in as one option among Moodle's core MFA factors. Enabling one does not enable the other, so the project should list each feature, its audience and its trigger. Check which factors your sites will offer, because the SMS factor only helps users who have a verified mobile number on their profile and who are allowed to use it in your MFA policy.
Phone numbers are personal data, so the design should settle who may see them, how long they are kept and what happens when a user leaves. Sending cost is the other ongoing item. Each message is billed by the gateway provider, so the reader should ask who holds the gateway account, who approves billing, which users can trigger messages and whether MFA codes or notifications are limited in volume. Ask your provider for current per-message and country pricing in writing, and test sending in a staging site before any production user receives a message.
What you need before enabling SMS in Moodle
SMS notifications and SMS MFA depend on four things lining up: a Moodle release that includes the SMS subsystem and the gateway you choose, a server stack that release supports, a gateway account that is allowed to send, and a network path from the Moodle host to that gateway. Confirm each one before you touch the site configuration, because a gap in any of them usually shows up later as messages that never arrive.
Choose the Moodle release and gateway together
The AWS gateway arrived with the SMS subsystem in Moodle 4.5, and the Modica gateway plugin arrived with SMS notifications in Moodle 5.0. If you want Modica, you need at least 5.0, and if you want AWS, 4.5 is the earliest release that includes it. Decide the gateway first, then pick a release that is still under security support when you go live. Check the current support dates on the Moodle releases page before you commit to a version.
Moodle 4.5 notesConfirm the server stack for that release
Each Moodle release sets its own minimum PHP and database versions, and the upgrade path from your current site is limited to specific starting versions. Check the release notes for the PHP build, database engine and web server layout your chosen release requires. From Moodle 5.1 the web server document root must point to the new public directory, so a web server configured for an older layout can fail after an upgrade. Treat the stack check as a gate before the SMS work starts.
Moodle 5.1 notesGateway account with sending permission
Moodle does not send through AWS or Modica on its own account. You need a gateway account with permission to send SMS messages to the countries where your learners live, plus credentials that Moodle can store and use. Ask who owns the account, who can rotate its credentials, and whether sending is limited by account settings. Sending permission and spending limits are often set outside Moodle, so confirm them with the gateway provider before testing.
Gateway region and sender settings
The AWS region, the sender ID or origination identity, and any registration requirements for your destination countries all affect whether messages are delivered. Confirm these values with AWS or Modica and record them in your configuration notes. A sender that is not permitted in a destination country can cause silent delivery failures, so test with real numbers in each country you serve.
Outbound network path from the Moodle host
The Moodle host, and any cron or task runner that sends messages, must reach the gateway endpoint over HTTPS. Firewalls, egress proxies and private subnets that block outbound traffic will stop sends without an obvious error in the Moodle interface. Ask your network team to allow the gateway endpoint from every host that runs Moodle tasks, and confirm that scheduled tasks run on the same network path.
MFA plugin enabled in core
SMS multi-factor authentication is a factor in Moodle core's MFA tool, alongside TOTP, WebAuthn, email and others. The MFA plugin and the SMS factor must be enabled before users can enrol a phone number for sign-in. Decide which roles or cohorts must use SMS, and confirm that a backup factor exists for users who lose access to their phone, so that the SMS factor does not become the only route back into an account.
How to configure the SMS gateway, notifications and SMS factor
This sequence takes a Moodle site from a confirmed version and scoped AWS credentials to a working SMS gateway, tested notifications and an SMS multi-factor factor rolled out first to a pilot group. Each step ends with a check that shows whether it worked before the next one starts.
Confirm the Moodle version and SMS subsystem
Confirm the running Moodle version against the release notes before any configuration. The SMS subsystem with the AWS gateway arrived in Moodle 4.5, and SMS notifications with the Modica gateway plugin arrived in Moodle 5.0, so a site on an earlier version will not have the options described here. Check the site's PHP and database versions against the release requirements for that build as well. Done means the version is recorded in the change ticket and the SMS gateway settings appear in the site administration.
Create and scope the gateway credentials
Ask the cloud or messaging administrator to create a dedicated AWS identity for Moodle with permission only to send SMS messages, and to keep it separate from any identity used for other systems. Confirm with your AWS account team which sender ID, origination settings and country destinations apply to your organization, since these depend on your account and the regions you use. Store the access key in your secrets manager rather than in a plain configuration file. Done means the credential works from a test call made outside Moodle and is restricted to the messaging actions Moodle needs.
Configure the gateway in the SMS subsystem
A Moodle administrator enters the AWS region and the credential reference in the SMS gateway settings, then saves the configuration on a non-production site first if one exists. Set any default sender identifier and confirm the field names against the Moodle documentation for your version, because they can differ between releases. Restrict who can change these settings to a small administrator group. Done means the gateway saves without errors and the site's configuration report shows the gateway as active.
Send a test message to a controlled number
Send a test message from the gateway settings to a phone number owned by the project team, not to a user's personal number. Use a number that the testers can inspect, and record the time and message identifier in the test log. If the message fails, read the error in the Moodle logs and the AWS messaging logs together before changing settings. Done means the test message arrives on the controlled handset and the matching send record appears in both systems.
Enable notification types one at a time
Turn on SMS notification types individually, starting with the lowest-risk message, and send each to the controlled test number before enabling the next. Review the message text for personal data and avoid placing course names, grades or other sensitive content in the message body. Record which notification types are enabled and who approved them. Done means each enabled type has produced one delivered test message and the approved list is saved with the configuration.
Monitor message volume and cost signals
Before wider use, set up a way to review how many messages the site sends and which notification types generate them, using the AWS usage reporting that your account provides. Ask your AWS account team which billing alerts and budgets are available to you, and confirm the per-message charges for your destination countries rather than assuming them. Schedule a regular review of the send records. Done means someone has been named to watch the usage figures and an alert threshold has been agreed in writing.
Enable the SMS factor for a pilot group
Enable the SMS multi-factor factor in the MFA settings and make it available only to a pilot cohort of users who have agreed to test it. Ask the pilot users to register a phone number, then sign in, complete the SMS challenge and report any problems with codes, timing or number formats. Confirm that phone number data is stored and shown only to the roles that need it. Done means every pilot user has completed a successful sign-in with the SMS factor and the issues log has been reviewed before the factor is offered more widely.
How a Moodle SMS message reaches a phone
The flow starts in the Moodle SMS subsystem on the Moodle host, which hands each message to a configured gateway, either the AWS gateway or the Modica gateway plugin. The gateway is the trust boundary: it sits outside your infrastructure, so the message content and the destination phone number leave your network at that point. From there the carrier network delivers the message to the handset. The MFA branch runs the other way: the user types the code they receive back into Moodle, which checks it against the value it stored. Check which gateway you use, what leaves the host, and where the code is held.
Moodle SMS requests cross the trust boundary to an external gateway before carrier delivery.
Which Moodle user fields and settings feed SMS
This table maps the four places Moodle reads phone-related data from when it sends SMS notifications or runs the SMS factor. Read each row for what the field holds, who can change it and what your team must confirm about number formatting before go-live. The main takeaway is that a phone number can be valid in one place and rejected in another, so the formatting rule should be set once and tested end to end.
| Source | What it holds | Who can edit it | Confirm in your environment |
|---|---|---|---|
| User profile phone field | The number a user or administrator enters on the account, used as the default destination for SMS | The user, if the profile field is editable, and site administrators | Whether the field is shown, required or locked, and whether your identity source overwrites it on each sync |
| Notification preferences | Which message types a user has opted into and on which channels they are delivered | The user in their own preferences, and administrators for site-level defaults | Which notification types are routed to SMS in your build and whether a user without a phone number can still opt in |
| MFA SMS factor enrolment record | The number a user registered for the SMS factor and the verification state of that registration | The user during enrolment, and administrators who reset factors | How a changed phone number triggers re-verification and who approves a reset when a user loses the device |
| Gateway sender settings | The AWS or Modica gateway configuration, sender identity and any country or region setting used to route messages | Site administrators with access to the gateway configuration and the secrets it uses | Which country codes the gateway accepts, the sender ID rules in each destination country, and where credentials are stored |
| Country code handling | The format a number is stored in, such as whether a leading country code is required | Set by site policy and enforced at entry and at send time | Whether numbers are normalized to one format before storage and whether the gateway expects the same format |
Controlling SMS sending costs
SMS notification cost depends on how many notification types are allowed to use the SMS channel. Moodle sends messages through its notification system, and each notification type can be delivered by a chosen set of channels, so the cost decision is made per type rather than once for the whole site. Start by listing every notification the site sends, then decide which ones justify a text message because they are time-sensitive or must reach someone who may not read email. Routine notices, such as forum digests or course announcements, usually belong on email or the site's own notification area.
- Inventory the notification types: Export or review the full list in the notification preferences before enabling SMS for anything, so no type is turned on by default.
- Reserve SMS for time-sensitive events: Limit SMS to notices where a delay causes harm, such as account security alerts or urgent assessment changes.
- Keep high-volume types on email: Digests and bulk course messages can produce large message counts, so keep them on email unless a specific need is documented.
- Set defaults for new users: Confirm what channels new users receive, because a permissive default multiplies volume across every account.
- Test with a small group: Enable SMS for one notification type with a pilot cohort and count the messages before widening access.
Before go-live, confirm with your team which notification types the business has approved for SMS and record that list as part of the configuration baseline.",
The SMS multi-factor authentication factor sends a one-time code each time a user is challenged. Cost therefore scales with the number of sign-ins that trigger the factor, not only with the number of accounts. Moodle's MFA system is built from factors, and core factors include admin, auth, capability, cohort, email, grace, IP range, no setup, role, SMS, token, TOTP and WebAuthn. Rules can decide who is challenged, so the SMS factor can be applied to the users who need it while others use a factor that costs nothing per message.
- Prefer app or hardware factors where possible: Offer TOTP or WebAuthn as the default so SMS is used mainly for users who cannot use those options.
- Scope SMS with role or cohort rules: Apply the SMS factor to specific roles or cohorts, such as administrators or staff with elevated access, rather than every learner.
- Use IP range and grace rules carefully: Trusted-network exemptions and grace periods reduce challenges, but review them so they do not weaken protection for remote access.
- Review challenge frequency: Repeated challenges from failed or abandoned sign-ins generate messages, so check how often the factor fires per user.
- Document the rule logic: Record which combinations of role, cohort and network trigger SMS so auditors and administrators can trace the decision.
Before enabling the factor widely, confirm the rule set with your security team and check the factor documentation for the Moodle version you run.",
Gateway bills are the part of SMS cost that the Moodle site does not control directly, so the site needs its own visibility. Moodle's SMS subsystem sends messages through a gateway. Moodle 4.5 added an SMS subsystem with an AWS gateway, and Moodle 5.0 added SMS notifications including a Modica gateway plugin. Whichever gateway you choose, spend is set by the provider's billing model, which you should confirm directly. Counting messages in Moodle and comparing that count with the provider's invoice shows whether volume matches what you expected.
- Ask for current per-message pricing: Request the gateway's current rates for each destination country you expect to serve, in writing, because rates change and this page does not state them.
- Model volume by notification and factor: Estimate messages per month for each enabled type and each MFA challenge, then compare the total against your budget.
- Set spending alerts at the provider: Configure budget or usage alerts in the gateway account so unexpected growth is flagged early.
- Reconcile counts monthly: Compare Moodle's sent-message records with provider billing to catch duplicates, retry loops or misrouted traffic.
- Restrict the sending account: Give the gateway credentials only the permissions needed to send, and rotate them on a schedule your team sets.
Before launch, ask your gateway provider for a written pricing schedule, the billing unit they charge for, and how failed deliveries are billed.
Protecting phone numbers and gateway credentials
Phone numbers and gateway keys are the two assets that make SMS notifications and SMS MFA risky to run. The cards below cover what to store, who can see it, where credentials live, what gets logged and how long data is kept, so the controls can be reviewed alongside your own data protection policy.
Collect only the numbers you need
Decide which users need a stored mobile number. SMS MFA needs one for each enrolled user, but notifications to users who never receive texts do not. Limit the phone field to users who actually use SMS, and confirm whether your identity source already holds the number so you can read it from there instead of copying it into Moodle profiles. Fewer copies means fewer places to clean up later.
Restrict who can view and export numbers
Phone numbers appear in user profiles, user lists, reports and CSV exports, so a broad site administrator or report role can expose the whole list. Review which roles hold the capabilities that show or export user fields, and test a non-admin account to confirm what it can see. Treat exports as a controlled activity with a named owner.
Keep gateway credentials in a secrets store
AWS access keys and Modica credentials should not sit in config.php or in a file shared through version control. Load them from your secrets manager or from the host environment at runtime, restrict file permissions on the web server, and record who can rotate them. Confirm how your deployment tooling injects these values before the first send.
Grant the gateway identity least privilege
Create a dedicated AWS identity for Moodle whose policy allows only the SMS publish action it needs, and nothing that reads account data or manages other services. Scope it to the region and sender settings you use, and separate it from identities used for file storage or backups. Review the policy against the AWS documentation for the SMS API before you rely on it.
Log sends without message bodies
Keep a record that a notification or MFA code was sent: time, recipient reference, gateway response and the Moodle user ID. Do not write the message text, and in particular do not write one-time codes, to Moodle logs, debug output or gateway logs you export. Check that debugging is off on production, because verbose gateway output can echo request content.
Define retention and deletion for phone data
Your organization must decide how long phone numbers, send logs and gateway delivery records are kept, and who approves deletion when a user leaves or removes their number. Set the Moodle side through scheduled cleanup and user deletion procedures, and document the gateway side separately. Ask your privacy or legal team to sign off on the periods before go-live.
Why SMS messages or MFA codes fail
This table lists the failures that most often stop SMS notifications or SMS MFA codes from reaching users in Moodle with AWS. Each row gives the likely cause, the fix to try first, and what to confirm with the gateway provider. Work through the rows in order, since several symptoms look identical from the user's side.
| Failure | Likely cause | Fix |
|---|---|---|
| Codes or messages never arrive for some users | Stored phone numbers lack a country code or contain local formatting, so the gateway cannot route them | Normalize stored numbers to international format, correct existing profiles, and test with one number from each country you serve |
| Every send fails with an authorization error | The gateway credentials lack permission to send SMS, or the wrong AWS region or keys are set in the Moodle SMS gateway settings | Check the IAM permissions for SMS publishing and the region configured in Moodle, then send a test message from the gateway console |
| Messages fail only for certain countries | The sender ID or origination identity is not permitted in the destination country, or the destination requires registration | Confirm sender ID and registration rules for each destination country with the gateway provider before enabling the factor there |
| Sends time out or the gateway is unreachable | The Moodle host cannot reach the gateway endpoint because outbound network rules, a proxy or a firewall block it | Allow outbound HTTPS to the gateway endpoint for your region, and test connectivity from the same host and user that runs cron |
| Factor prompt never appears for some users | The SMS factor is not enabled for their role, or the factor is set to a state that does not apply to them | Review the MFA factor settings and role assignments in Moodle, then sign in as a test user in each affected role |
| Codes arrive late or expire before entry | Scheduled tasks that send queued messages run infrequently, or the code lifetime is shorter than the delivery delay | Check that cron runs on schedule and the message queue is processed, and review the code validity window against observed delivery times |
| Costs rise without matching usage | Repeated resend requests, test traffic or messages sent to invalid numbers are billed by the gateway | Limit resend frequency, remove test numbers from production, and ask the provider for per-country pricing and delivery reports |
Questions buyers ask about Moodle SMS and SMS MFA
Can our own team set up Moodle SMS notifications and SMS MFA without a partner?
Yes, if you have a Moodle administrator who can work in the site's configuration and a platform engineer who can manage outbound credentials and network rules. The SMS subsystem is part of Moodle core from Moodle 4.5 (AWS gateway) and Moodle 5.0 (Modica gateway plugin), so the main work is configuration, testing and governance rather than custom code. Teams without recent Moodle administration experience often find the hardest part is agreeing the policy: which messages go by SMS, which users must enrol an SMS factor, and how phone numbers are stored and deleted. A partner is most useful when those decisions need to be written down and reviewed by your security or compliance staff before rollout.
What drives the effort of an SMS notification and MFA rollout?
The effort depends less on the gateway setting and more on the number of decisions and the number of systems around it. The main drivers are the gateway you choose (AWS or Modica), how many message types you send, whether SMS MFA applies to all users or to a defined group, how phone numbers reach Moodle (manual entry, user profile, or an HR or identity feed), and how much testing your sender registration and carrier requirements need. Each additional message type or user group adds test cases. Ask any provider to break the work into configuration, testing, documentation and handover so you can see which parts you are paying for.
What do we need to provide before the work starts?
Expect to provide an AWS account or a Modica account with the credentials needed for the SMS gateway, a named owner for the gateway contract and spending limits, and a written phone number data policy that states what is collected, why, who can see it and how long it is kept. You also need a set of test users with real mobile numbers that your team controls, a staging Moodle site that matches production, and network access from the Moodle server to the gateway endpoint. Confirm with the gateway provider which sender identities, regions and message types your account is allowed to use before scoping the build.
Can SMS MFA be limited to some users, such as administrators or staff?
Yes. Moodle's multi-factor authentication framework includes an SMS factor alongside other core factors such as TOTP, WebAuthn, email and role-based rules, so the SMS factor can be scoped using the factors and rules that the framework supports. A common design is to require SMS or a stronger factor for administrators and staff roles, while students use a lighter option. Before you commit to that design, confirm in your Moodle version how the role, cohort and IP range factors combine, and test each rule with a sample account for every role. Write the intended rule set down before configuring it so the security review can compare the configuration against the policy.
How do we keep SMS costs under control?
SMS costs are charged by the gateway provider per message, so cost control starts with knowing which events generate messages. Limit notifications to the events that need them, avoid sending SMS for every routine message when email or in-app notices would do, and set alerts and spending limits in the AWS or Modica account. For MFA, each sign-in challenge is a message, so the volume depends on how often users sign in and how long sessions last. Ask your provider for a quote that separates one-time work (configuration, testing, documentation) from recurring costs (gateway charges by destination, monthly account fees if any, and support or monitoring retainers). Pricing for the gateway itself should come from the gateway provider's current published rates, which you should confirm directly.
How is phone number data handled, and who can see it?
Phone numbers are personal data, so define their handling before the build. Decide which user fields store the number, who can view and edit it in Moodle, whether it is included in backups, exports and logs, and how it is removed when an account is deleted or a user leaves. Check that message content sent to the gateway does not include more personal data than the message needs. Your privacy and security teams should review the data flow against your own obligations; DeployOpen prepares the configuration, access controls and evidence for that review, but it does not issue audit reports or certifications. Confirm with Moodle's privacy tooling and your gateway contract how deletion requests reach the gateway side.
Will the SMS setup survive Moodle upgrades?
It should, but it has to be tested on each upgrade. The SMS subsystem and MFA factors are core features, so they are maintained through Moodle's normal release cycle, but the gateway settings, any custom message types, and any local or community plugins around them can change. Moodle ships major releases in April and October and point releases every two months, and the supported database and PHP versions also change between releases. Moodle 5.3 requires PHP 8.3 or later and PostgreSQL 17, and sites must run Moodle 4.4 or later to upgrade to it, so plan the SMS checks into each upgrade window. Ask your provider to include a regression test for sending, receiving and MFA challenges on staging before every production upgrade.
What the work needs from your team
The SMS work starts with a short list of inputs from your side, and the most important one is the Moodle version and hosting details. The SMS subsystem arrived in Moodle 4.5 and SMS notifications followed in Moodle 5.0, so the target release decides which gateway and notification options exist at all. Send us the exact version you run or plan to run, the PHP and database versions, how the web server is configured and where cron runs. Confirm with your Moodle administrators whether the site is self-hosted, hosted by a Moodle Partner or on MoodleCloud, because that changes who can install gateway plugins and who holds the server-side credentials.
The second input is the gateway account. For the AWS gateway, your cloud team should decide which AWS account owns the messaging service, who holds the IAM identity Moodle uses to send messages, and how that identity's access is reviewed. For the Modica gateway, the commercial contract and the account owner sit with your organization. In both cases DeployOpen needs access to test sending from a non-production site, not standing administrator rights in your cloud or messaging console. Ask your team to confirm the sender identity and whether any sender registration is required in the countries you message.
The third and fourth inputs are the phone data policy and the notification list. Your privacy, legal and information security owners should state which phone numbers Moodle may store, who may view them, how long they are kept and how users remove them. They should also approve each notification that will send an SMS, because every message is a data disclosure to a third party. The pilot group should be a named set of users, such as one course or one staff team, who agree to receive test messages. Final approval of the sender, the data handling rules and the scope of messages stays with your organization. DeployOpen builds to those decisions and records them in the written scope.
How DeployOpen scopes and delivers Moodle SMS work
DeployOpen plans, configures and hands over Moodle SMS notifications and SMS MFA with AWS inside infrastructure you control. Each engagement starts from a written scope that names the gateway, the notification events, the MFA policy and the phone number data your organization accepts.
How we scope
- Confirm which gateway applies, AWS or Modica, based on your region, contracts and account set-up
- List the notification events, recipients and message templates that Moodle will send by SMS
- Define which roles or cohorts must enrol in SMS MFA and which factors remain available as fallbacks
- Agree the spending limits, sender identity and reporting needed to control SMS cost before build starts
How we build
- Configure the Moodle SMS subsystem and gateway credentials in a non-production copy first
- Set SMS MFA factor rules, enrolment conditions and lockout behavior, then test each user path end to end
- Test delivery failures, invalid numbers, retries and rate limits against the agreed notification scope
- Review how phone numbers are stored, displayed, exported and retained, and document the findings
How we hand over
- Deliver a written configuration record covering gateway settings, notification rules and MFA policy
- Provide runbooks for rotating gateway credentials, adding senders and responding to delivery complaints
- Document the phone number data flow so your security and privacy teams can review it
- Walk your administrators through monitoring, cost reports and the test cases used for acceptance
How we support
- Engagements are fixed-scope, with scope, deliverables and timelines agreed in writing before work starts
- Ongoing support, upgrades and continuous testing are available as a retainer after handover
- Retest changes to SMS settings and MFA policy when Moodle versions or gateway terms change
- Quotes follow from the written scope, so ask for each component, recurring charges and assumptions listed separately

