You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/apis/plugintypes/sms/index.md
+19-20Lines changed: 19 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,31 +1,26 @@
1
1
---
2
-
title: SMS gateway plugin
2
+
title: SMS gateway
3
3
tags:
4
4
- SMS
5
5
- Gateway
6
-
- SMS gateway
7
6
- Notification
8
7
---
9
8
10
9
<Sinceversion="4.5"issueNumber="MDL-83406" />
11
10
12
-
SMS gateway plugins allows you to create SMS gateway provider, which can be used to send SMS notification to users from your Moodle instance.
13
-
For example, you use MFA (Multi-Factor Authentication) to user authentication in Moodle and you use AWS as your SMS gateway provider. You can
14
-
now build more SMS Gateway providers to allow sending SMS to your users.
11
+
SMS gateway plugins allow you to create SMS gateway providers.
12
+
Providers are an interface between [SMS API](/apis/subsystems/sms/index.md) and the external SMS provider (e.g. Amazon Web Services).
13
+
This allows for the sending of SMS notifications to users from your Moodle instance.
14
+
15
+
For example, you set up MFA (Multi-Factor Authentication) in Moodle and choose 'AWS' as your SMS gateway provider.
16
+
This enables users to receive SMS notifications as part of the authentication process.
15
17
16
18
## File structure
17
19
18
-
SMS gateway plugins are located in the /sms/gateway directory. A plugin should not include any custom files outside its own
20
+
SMS gateway plugins are located in the `/sms/gateway` directory. A plugin should not include any custom files outside its own
19
21
plugin folder.
20
22
21
-
Each plugin is in a separate subdirectory and consists of a number of _mandatory files_ and any other files the developer is going to use.
22
-
23
-
:::important
24
-
25
-
Some important files are described below. See the [common plugin files](../../commonfiles/index.mdx) documentation for details of other
26
-
files which may be useful in your plugin.
27
-
28
-
:::
23
+
Each plugin is in a separate subdirectory and consists of a number of mandatory files and any other files the developer is going to use. See the [common plugin files](/apis/commonfiles/index.mdx) documentation for other files which may be useful in your plugin.
29
24
30
25
<details>
31
26
<summary>The directory layout for the `smsgateway` plugin.</summary>
@@ -48,11 +43,15 @@ sms/gateway/example
48
43
49
44
## Key files
50
45
51
-
There are a number of key files within the plugin, described below.
46
+
There are a number of key files within the SMS gateway plugin which will need to be configured for correct functionality.
47
+
48
+
- gateway.php
49
+
- hook_listener.php
52
50
53
51
### gateway.php
54
52
55
-
Each plugin must implement this class and should have the exact class name. The core_sms api will pick the extended methods from this class.
53
+
Each plugin must create a class called `gateway` which extends the `\core_sms\gateway` class.
54
+
The SMS API will use the extended methods from this class.
56
55
57
56
```php title="Implementing the base SMS gateway"
58
57
@@ -92,12 +91,12 @@ class gateway extends \core_sms\gateway {
92
91
93
92
### hook_listener.php
94
93
95
-
There a couple of hooks dispatched from the core_sms API which can be listened by the plugin. It is necessary for plugins developers to assess
96
-
these hooks and implement accordingly.
94
+
[Hooks](/apis/core/hooks/index.md) can be dispatched from the SMS API which the plugin can then listened to.
95
+
It is necessary for plugins developers to assess these hooks and implement accordingly.
97
96
98
97
#### after_sms_gateway_form_hook
99
98
100
-
This hook will allow plugins to add their relevant form field from the plugin to allow users to add required configs for the SMS gateway.
99
+
This hook will allow plugins to add required form fields to assist users in configuring their SMS gateway.
101
100
102
101
```php title="Listener method for after_sms_gateway_form_hook"
103
102
@@ -121,6 +120,6 @@ public static function set_form_definition_for_aws_sms_gateway(after_sms_gateway
121
120
122
121
:::info
123
122
124
-
For a real plugin example, please look at the [AWS SMS Gateway plugin](https://github.com/moodle/moodle/tree/main/sms/gateway/aws).
123
+
For a real plugin example, see the [AWS SMS Gateway plugin](https://github.com/moodle/moodle/tree/main/sms/gateway/aws).
A single SMS sent by the API may consist of up to 480 UTF-8 characters. It is up to the message _gateway_ plugin to determine how this message is sent to the recipient.
43
+
A single SMS sent by the API may consist of up to 480 UTF-8 characters. It is up to the message _gateway plugin_ to determine how this message is sent to the recipient.
30
44
31
45
Any message longer than the maximum length will be immediately rejected.
32
46
@@ -124,32 +138,32 @@ graph TD
124
138
end
125
139
```
126
140
127
-
## Getting the list of SMS gateways
141
+
## Getting SMS gateways
128
142
129
-
Once the gateway is configured from UI, any component implementing the core_sms API can get the list of gateways. The list can also be filtered.
143
+
[SMS gateways](/apis/plugintypes/sms/index.md) are plugins that provide a way to interface with external SMS providers.
144
+
Once a gateway is configured, any component implementing the SMS API can get a list of gateways.
130
145
131
146
```php title="Getting the list of enabled gateways"
0 commit comments