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.
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.
56
+
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.
57
+
58
+
### Environment Variables
59
+
60
+
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`|
109
+
| Option | Description | Default Value | Example |
|`--id`| A unique message ID. If not provided, one will be automatically generated. | empty |`zXDYfTmTVf3iMd16zzdBj`|
112
+
|`--device-id`| Optional device ID for explicit selection. If not provided, a random device will be selected. | empty |`oi2i20J8xVP1ct5neqGZt`|
113
+
|`--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**|`+19162255887`|
114
+
|`--sim-number`| The one-based SIM card slot number. If not specified, the device's SIM rotation feature will be used. | empty |`2`|
115
+
|`--delivery-report`| Enables delivery report for the message. |`true`|`true`|
116
+
|`--priority`| Sets the priority of the message. Messages with priority >= 100 bypass all limits and delays. |`0`|`100`|
117
+
|`--ttl`| Time-to-live (TTL) for the message. If not provided, the message will not expire.<br>**Conflicts with `--valid-until`.**| empty |`1h30m`|
118
+
|`--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`|
119
+
|`--data`| Send data message instead of text (content in base64). |`false`|`true`|
120
+
|`--data-port`| Destination port for data message (1 to 65535). |`53739`|`12345`|
121
+
|`--skip-phone-validation`| Skip phone number validation. |`false`|`true`|
122
+
|`--device-active-within`| Time window in hours for device activity filtering. `0` means no filtering. |`0`|`12`|
123
+
124
+
!!! note "Disabling booleans"
125
+
To disable, use `--delivery-report=false`.
126
+
127
+
!!! tip
128
+
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
165
|`--event`, `-e`| The event name for which the webhook will be triggered. |**required**|`sms:received`|
128
166
167
+
!!! important
168
+
Ensure your webhook endpoint is accessible from the device and properly secured.
169
+
129
170
---
130
171
131
-
#### List Webhooks π
172
+
#### List Webhooks
132
173
133
174
The `list` command displays all registered webhooks.
134
175
@@ -137,9 +178,12 @@ The `list` command displays all registered webhooks.
137
178
smsgate webhooks list
138
179
```
139
180
181
+
!!! tip
182
+
Use this command to audit your webhook configurations regularly.
183
+
140
184
---
141
185
142
-
#### Delete a Webhook ποΈ
186
+
#### Delete Webhook
143
187
144
188
The `delete` command removes a webhook by its ID.
145
189
@@ -148,22 +192,41 @@ The `delete` command removes a webhook by its ID.
148
192
smsgate webhooks delete 'Webhook ID'
149
193
```
150
194
151
-
## Usage examples π‘
195
+
!!! warning
196
+
Deleting a webhook is irreversible. Ensure you no longer need the webhook before deleting it.
197
+
198
+
## Usage Examples π‘
199
+
200
+
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.
152
201
153
-
For security reasons, it is recommended to pass credentials using environment variables or a `.env` file.
202
+
### Basic Operations
154
203
155
204
```bash
156
205
# Send a message
157
-
smsgate send --phone'+19162255887''Hello, Dr. Turk!'
206
+
smsgate send --phones'+19162255887''Hello, Dr. Turk!'
If you prefer not to install the CLI tool locally, you can use Docker to run it:
186
253
187
254
```bash
188
255
docker run -it --rm --env-file .env ghcr.io/android-sms-gateway/cli \
189
-
send --phone'+19162255887''Hello, Dr. Turk!'
256
+
send --phones'+19162255887''Hello, Dr. Turk!'
190
257
```
191
258
192
-
## Exit codes π
259
+
!!! tip
260
+
Using Docker is ideal for CI/CD pipelines or environments where you want to avoid local installations.
193
261
194
-
The CLI uses exit codes to indicate the outcome of operations:
262
+
## Exit Codes π
263
+
264
+
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
265
196
266
| Code | Description |
197
267
| ---- | --------------------- |
@@ -200,6 +270,12 @@ The CLI uses exit codes to indicate the outcome of operations:
200
270
| 2 | π Network error |
201
271
| 3 | π Output format error |
202
272
203
-
---
273
+
!!! failure
274
+
Exit codes other than 0 indicate errors. Always check the error message output for troubleshooting information.
275
+
276
+
## See Also π
277
+
278
+
For more information about integrating the SMS Gateway, explore the following resources:
0 commit comments