batches
Creates, updates, deletes, gets or lists a batches resource.
Overview​
| Name | batches |
| Type | Resource |
| Id | ovh.sms.batches |
Fields​
The following fields are returned by SELECT queries:
- get
- list
successful operation
| Name | Datatype | Description |
|---|---|---|
id | string (uuid) | Batch ID |
name | string | Batch name |
account_id | integer | SMS account ID (wire: accountID) |
slot_id | string | Slot ID (wire: slotID) |
created_at | string (date-time) | Creation datetime (wire: createdAt) |
errors | array | Details on error(s) on the batch, if any |
estimated_credits | number | The estimated cost of the batch in credits (wire: estimatedCredits) |
finished_at | string (date-time) | Datetime when the batch finished processing SMSs (wire: finishedAt) |
from | string | SMS sender |
message | string | SMS message |
processed_records | integer | Number of processed records in this batch (wire: processedRecords) |
receivers | array | SMS receivers list |
sent_at | string (date-time) | Datetime when the SMSs of the batch are sent (based on deferred time if exists) (wire: sentAt) |
started_at | string (date-time) | Datetime when the batch started processing SMSs (wire: startedAt) |
status | string | Batch status (CANCELED, CANCELING, COMPLETED, FAILED, INSERTED, INSERTING, PENDING, TO_CANCEL) |
total_records | integer | Total number of records in this batch (wire: totalRecords) |
updated_at | string (date-time) | Last update datetime (wire: updatedAt) |
Batch of SMS to send
| Name | Datatype | Description |
|---|---|---|
id | string (uuid) | Batch ID |
name | string | Batch name |
account_id | integer | SMS account ID (wire: accountID) |
slot_id | string | Slot ID (wire: slotID) |
created_at | string (date-time) | Creation datetime (wire: createdAt) |
errors | array | Details on error(s) on the batch, if any |
estimated_credits | number | The estimated cost of the batch in credits (wire: estimatedCredits) |
finished_at | string (date-time) | Datetime when the batch finished processing SMSs (wire: finishedAt) |
from | string | SMS sender |
message | string | SMS message |
processed_records | integer | Number of processed records in this batch (wire: processedRecords) |
receivers | array | SMS receivers list |
sent_at | string (date-time) | Datetime when the SMSs of the batch are sent (based on deferred time if exists) (wire: sentAt) |
started_at | string (date-time) | Datetime when the batch started processing SMSs (wire: startedAt) |
status | string | Batch status (CANCELED, CANCELING, COMPLETED, FAILED, INSERTED, INSERTING, PENDING, TO_CANCEL) |
total_records | integer | Total number of records in this batch (wire: totalRecords) |
updated_at | string (date-time) | Last update datetime (wire: updatedAt) |
Methods​
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | id, service_name | Returns the batch: message, sender, receivers, status, estimated credits and errors. | |
list | select | service_name | Returns the batches of the SMS account. | |
create | insert | service_name, message | Creates a batch that sends one message to a list of receivers or to a receiver list. Set a sender, or ask for one that allows replies. Sending can be deferred to a later date. | |
update | update | id, service_name, name | Updates the batch name. | |
delete | delete | id, service_name | Deletes the batch. | |
cancel | exec | id, serviceName | Cancels a batch scheduled for later. Only possible if no SMS of the batch has been sent yet. |
Parameters​
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
api_host | string | The OVHcloud API host. Selected by OVH_ENDPOINT (ovh-eu, ovh-ca or ovh-us; default ovh-eu). (default: api.eu.ovhcloud.com, x-stackQL-envVarSelector: {"envVar":"OVH_ENDPOINT","default":"ovh-eu","values":{"ovh-eu":"api.eu.ovhcloud.com","ovh-ca":"api.ca.ovhcloud.com","ovh-us":"api.us.ovhcloud.com"}}) |
id | string (uuid) | Id |
serviceName | string | The internal name of your SMS offer |
service_name | string | The internal name of your SMS offer (wire: serviceName) |
SELECT examples​
- get
- list
Returns the batch: message, sender, receivers, status, estimated credits and errors.
SELECT
id,
name,
account_id,
slot_id,
created_at,
errors,
estimated_credits,
finished_at,
from,
message,
processed_records,
receivers,
sent_at,
started_at,
status,
total_records,
updated_at
FROM ovh.sms.batches
WHERE id = '{{ id }}' -- required
AND service_name = '{{ service_name }}' -- required
;
Returns the batches of the SMS account.
SELECT
id,
name,
account_id,
slot_id,
created_at,
errors,
estimated_credits,
finished_at,
from,
message,
processed_records,
receivers,
sent_at,
started_at,
status,
total_records,
updated_at
FROM ovh.sms.batches
WHERE service_name = '{{ service_name }}' -- required
;
INSERT examples​
- create
- Manifest
Creates a batch that sends one message to a list of receivers or to a receiver list. Set a sender, or ask for one that allows replies. Sending can be deferred to a later date.
INSERT INTO ovh.sms.batches (
class,
deferred,
from,
message,
name,
no_stop,
sender_for_response,
slot_id,
tag,
to,
service_name
)
SELECT
'{{ class }}',
'{{ deferred }}',
'{{ from }}',
'{{ message }}' /* required */,
'{{ name }}',
{{ no_stop }},
{{ sender_for_response }},
'{{ slot_id }}',
'{{ tag }}',
'{{ to }}',
'{{ service_name }}'
RETURNING
id,
name,
account_id,
slot_id,
created_at,
errors,
estimated_credits,
finished_at,
from,
message,
processed_records,
receivers,
sent_at,
started_at,
status,
total_records,
updated_at
;
# Description fields are for documentation purposes
- name: batches
props:
- name: service_name
value: "{{ service_name }}"
description: Required parameter for the batches resource.
- name: class
value: "{{ class }}"
description: |
Deprecated: SMS class
valid_values: ['FLASH', 'PHONE', 'SIM']
- name: deferred
value: "{{ deferred }}"
description: |
SMS deferred sending date
- name: from
value: "{{ from }}"
description: |
SMS sender. Either "from" or "senderForResponse" must be passed
- name: message
value: "{{ message }}"
description: |
SMS message
- name: name
value: "{{ name }}"
description: |
Batch name
- name: no_stop
value: {{ no_stop }}
description: |
STOP clause not needed
- name: sender_for_response
value: {{ sender_for_response }}
description: |
Ask to compute a sender that allows response. Either "from" or "senderForResponse" must be passed
- name: slot_id
value: "{{ slot_id }}"
description: |
SMS receivers slot ID. Either "to" or "slotID" must be passed
- name: tag
value: "{{ tag }}"
description: |
SMS tag
- name: to
value:
- "{{ to }}"
description: |
SMS receivers list. Either "to" or "slotID" must be passed
UPDATE examples​
- update
Updates the batch name.
UPDATE ovh.sms.batches
SET
name = '{{ name }}'
WHERE
id = '{{ id }}' --required
AND service_name = '{{ service_name }}' --required
AND name = '{{ name }}' --required
RETURNING
id,
name,
account_id,
slot_id,
created_at,
errors,
estimated_credits,
finished_at,
from,
message,
processed_records,
receivers,
sent_at,
started_at,
status,
total_records,
updated_at;
DELETE examples​
- delete
Deletes the batch.
DELETE FROM ovh.sms.batches
WHERE id = '{{ id }}' --required
AND service_name = '{{ service_name }}' --required
;
Lifecycle Methods​
EXEC variables use wire (API) names.
- cancel
Cancels a batch scheduled for later. Only possible if no SMS of the batch has been sent yet.
EXEC ovh.sms.batches.cancel
@id='{{ id }}' --required,
@serviceName='{{ serviceName }}' --required
;