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
The CLI tool can be installed using various methods depending on your operating system and preferences. Choose the installation method that best suits your environment.
For a complete list of supported platforms, please refer to the [GitHub Releases page](https://github.com/android-sms-gateway/cli/releases/latest).
55
+
38
56
## Configuration βοΈ
39
57
40
-
The CLI can be configured using environment variables or command-line flags. You can also use a `.env` file in the working directory to set these variables.
58
+
The CLI tool can be configured using command-line flags, environment variables, or a `.env` file in the working directory. This section provides detailed information about configuration options and output formats.
59
+
60
+
### Environment Variables
61
+
62
+
You can set configuration variables using a `.env` file:
|`--id`| A unique message ID. If not provided, one will be automatically generated. | empty |`zXDYfTmTVf3iMd16zzdBj`|
91
-
|`--phone`, `--phones`, `-p`| Specifies the recipient's phone number(s). This option can be used multiple times or accepts comma-separated values. Numbers must be in E.164 format. |**required**|`+19162255887`|
92
-
|`--sim`, `--simNumber`| The one-based SIM card slot number. If not specified, the device's SIM rotation feature will be used. | empty |`2`|
93
-
|`--deliveryReport`| Enables delivery report for the message. |`true`|`true`|
94
-
|`--priority`| Sets the priority of the message. Messages with priority >= 100 bypass all limits and delays. |`0`|`100`|
95
-
|`--ttl`| Time-to-live (TTL) for the message. If not provided, the message will not expire.<br>**Conflicts with `--validUntil`.**| empty |`1h30m`|
96
-
|`--validUntil`| The expiration date and time for the message. If not provided, the message will not expire.<br>**Conflicts with `--ttl`.**| empty |`2024-12-31T23:59:59Z`|
111
+
| Option | Description | Default Value | Example |
|`--id`| A unique message ID. If not provided, one will be automatically generated. | empty |`zXDYfTmTVf3iMd16zzdBj`|
114
+
|`--device-id`| Optional device ID for explicit selection. If not provided, a random device will be selected. | empty |`oi2i20J8xVP1ct5neqGZt`|
115
+
|`--phones`| Specifies the recipient's phone number(s). This option can be used multiple times or accepts comma-separated values. Numbers must be in E.164 format. |**required**|`+12025550123`|
116
+
|`--sim-number`| The one-based SIM card slot number. If not specified, the device's SIM rotation feature will be used. | empty |`2`|
117
+
|`--delivery-report`| Enables delivery report for the message. |`true`|`true`|
118
+
|`--priority`| Sets the priority of the message. Messages with priority >= 100 bypass all limits and delays. |`0`|`100`|
119
+
|`--ttl`| Time-to-live (TTL) for the message. If not provided, the message will not expire.<br>**Conflicts with `--valid-until`.**| empty |`1h30m`|
120
+
|`--valid-until`| The expiration date and time for the message. If not provided, the message will not expire.<br>**Conflicts with `--ttl`.**| empty |`2024-12-31T23:59:59Z`|
121
+
|`--data`| Send data message instead of text (content in base64). |`false`|`true`|
122
+
|`--data-port`| Destination port for data message (1 to 65535). |`53739`|`12345`|
123
+
|`--skip-phone-validation`| Skip phone number validation. |`false`|`true`|
124
+
|`--device-active-within`| Time window in hours for device activity filtering. `0` means no filtering. |`0`|`12`|
125
+
126
+
!!! note "Disabling booleans"
127
+
To disable, use `--delivery-report=false`.
128
+
129
+
!!! tip
130
+
For sending data messages, ensure the content is properly base64 encoded.
|`--id`| A unique webhook ID. If not provided, one will be automatically generated. | empty |`zXDYfTmTVf3iMd16zzdBj`|
127
167
|`--event`, `-e`| The event name for which the webhook will be triggered. |**required**|`sms:received`|
128
168
169
+
!!! important
170
+
Ensure your webhook endpoint is accessible from the device and properly secured.
171
+
129
172
---
130
173
131
-
#### List Webhooks π
174
+
#### List Webhooks
132
175
133
176
The `list` command displays all registered webhooks.
134
177
@@ -137,9 +180,12 @@ The `list` command displays all registered webhooks.
137
180
smsgate webhooks list
138
181
```
139
182
183
+
!!! tip
184
+
Use this command to audit your webhook configurations regularly.
185
+
140
186
---
141
187
142
-
#### Delete a Webhook ποΈ
188
+
#### Delete Webhook
143
189
144
190
The `delete` command removes a webhook by its ID.
145
191
@@ -148,22 +194,41 @@ The `delete` command removes a webhook by its ID.
148
194
smsgate webhooks delete 'Webhook ID'
149
195
```
150
196
151
-
## Usage examples π‘
197
+
!!! warning
198
+
Deleting a webhook is irreversible. Ensure you no longer need the webhook before deleting it.
152
199
153
-
For security reasons, it is recommended to pass credentials using environment variables or a `.env` file.
200
+
## Usage Examples π‘
201
+
202
+
This section provides practical examples of using the CLI tool for various tasks. For security reasons, it is recommended to pass credentials using environment variables or a `.env` file.
203
+
204
+
### Basic Operations
154
205
155
206
```bash
156
207
# Send a message
157
-
smsgate send --phone'+19162255887''Hello, Dr. Turk!'
208
+
smsgate send --phones'+12025550100''Hello, Dr. Turk!'
If you prefer not to install the CLI tool locally, you can use Docker to run it:
186
255
187
256
```bash
188
257
docker run -it --rm --env-file .env ghcr.io/android-sms-gateway/cli \
189
-
send --phone'+19162255887''Hello, Dr. Turk!'
258
+
send --phones'+12025550100''Hello, Dr. Turk!'
190
259
```
191
260
192
-
## Exit codes π
261
+
!!! tip
262
+
Using Docker is ideal for CI/CD pipelines or environments where you want to avoid local installations.
263
+
264
+
## Exit Codes π
193
265
194
-
The CLI uses exit codes to indicate the outcome of operations:
266
+
The CLI tool uses exit codes to indicate the outcome of operations. Properly handling these codes in scripts can improve error handling and automation.
195
267
196
268
| Code | Description |
197
269
| ---- | --------------------- |
@@ -200,6 +272,12 @@ The CLI uses exit codes to indicate the outcome of operations:
200
272
| 2 | π Network error |
201
273
| 3 | π Output format error |
202
274
203
-
---
275
+
!!! failure
276
+
Exit codes other than 0 indicate errors. Always check the error message output for troubleshooting information.
277
+
278
+
## See Also π
279
+
280
+
For more information about integrating the SMS Gateway, explore the following resources:
0 commit comments