Skip to main content

templates_controls

Creates, updates, deletes, gets or lists a templates_controls resource.

Overview​

Nametemplates_controls
TypeResource
Idovh.sms.templates_controls

Fields​

The following fields are returned by SELECT queries:

successful operation

NameDatatypeDescription
namestringName of the template
activitystringSpecify the kind of template (alerting, authentification, transactional)
commentstringMessage sent by the moderator
datetimestring (date-time)Template creation datetime
descriptionstringTemplate description
messagestringMessage pattern to be moderated. Use "#VALUE#" format for dynamic text area.
statusstringTemplate status (disable, enable, refused, waitingValidation)

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectname, service_nameGet a message template. Returns the message template: pattern, activity, status and moderator comment.
listselectservice_namex_pagination_modeList message templates. Returns the message templates. Sending SMS to the United States requires a template validated by a moderator.
createinsertservice_name, activity, message, nameCreate a message template. Creates a message template and submits it to moderation. Sending SMS to the United States requires a validated template.
updateupdatename, service_nameUpdate a message template. Updates the message template: description, message pattern with #VALUE# dynamic areas, and kind (alerting, authentification or transactional).
deletedeletename, service_nameDelete a message template. Deletes the message template from the SMS account, whatever its moderation status.
relaunch_validationexecname, serviceName, description, messageRelaunch template validation. Submits the message template to moderation again after a refusal, with an updated message pattern and description.

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.

NameDatatypeDescription
api_hoststringThe 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"}})
namestringName of the template
serviceNamestringThe internal name of your SMS offer
service_namestringThe internal name of your SMS offer (wire: serviceName)
x_pagination_modestringSent as CachedObjectList-Pages by default so the list returns the full objects rather than their identifiers. (wire: X-Pagination-Mode)

SELECT examples​

Get a message template. Returns the message template: pattern, activity, status and moderator comment.

SELECT
name,
activity,
comment,
datetime,
description,
message,
status
FROM ovh.sms.templates_controls
WHERE name = '{{ name }}' -- required
AND service_name = '{{ service_name }}' -- required
;

INSERT examples​

Create a message template. Creates a message template and submits it to moderation. Sending SMS to the United States requires a validated template.

INSERT INTO ovh.sms.templates_controls (
activity,
description,
message,
name,
reason,
service_name
)
SELECT
'{{ activity }}' /* required */,
'{{ description }}',
'{{ message }}' /* required */,
'{{ name }}' /* required */,
'{{ reason }}',
'{{ service_name }}'
;

UPDATE examples​

Update a message template. Updates the message template: description, message pattern with #VALUE# dynamic areas, and kind (alerting, authentification or transactional).

UPDATE ovh.sms.templates_controls
SET
activity = '{{ activity }}',
description = '{{ description }}',
message = '{{ message }}',
name = '{{ name }}',
status = '{{ status }}'
WHERE
name = '{{ name }}' --required
AND service_name = '{{ service_name }}' --required;

DELETE examples​

Delete a message template. Deletes the message template from the SMS account, whatever its moderation status.

DELETE FROM ovh.sms.templates_controls
WHERE name = '{{ name }}' --required
AND service_name = '{{ service_name }}' --required
;

Lifecycle Methods​

EXEC variables use wire (API) names.

Relaunch template validation. Submits the message template to moderation again after a refusal, with an updated message pattern and description.

EXEC ovh.sms.templates_controls.relaunch_validation
@name='{{ name }}' --required,
@serviceName='{{ serviceName }}' --required
@@json=
'{
"description": "{{ description }}",
"message": "{{ message }}"
}'
;