Skip to main content

sms_templates

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

Overview​

Namesms_templates
TypeResource
Idokta.templates.sms_templates

Fields​

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstring
namestringHuman-readable name of the Template
createdstring (date-time)
lastUpdatedstring (date-time)
templatestringText of the Template, including any macros
translationsstring- Template translations are optionally provided when you want to localize the SMS messages. Translations are provided as an object that contains key:value pairs: the language and the translated Template text. The key portion is a two-letter country code that conforms to ISO 639-1. The value is the translated SMS Template. - Just like with regular SMS Templates, the length of the SMS message can't exceed 160 characters. (opaque JSON object)
typestringType of the Template (SMS_VERIFY_CODE)

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_sms_templateselecttemplateId, subdomainRetrieves a specific template by id
list_sms_templatesselectsubdomaintemplateTypeLists all custom SMS templates. A subset of templates can be returned that match a template type.
create_sms_templateinsertsubdomainCreates a new custom SMS template
update_sms_templateupdatetemplateId, subdomainUpdates only some of the SMS Template properties:
* All properties within the custom SMS Template that have values are updated.
* Any translation that doesn't exist is added.
* Any translation with a null or empty value is removed.
* Any translation with non-empty/null value is updated.
replace_sms_templatereplacetemplateId, subdomainReplaces the SMS Template
> Notes: You can't update the default SMS Template.
delete_sms_templatedeletetemplateId, subdomainDeletes an SMS template

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
subdomainstring(default: my-org)
templateIdstringid of the Template
templateTypestring

SELECT examples​

Retrieves a specific template by id

SELECT
id,
name,
created,
lastUpdated,
template,
translations,
type
FROM okta.templates.sms_templates
WHERE templateId = '{{ templateId }}' -- required
AND subdomain = '{{ subdomain }}' -- required
;

INSERT examples​

Creates a new custom SMS template

INSERT INTO okta.templates.sms_templates (
name,
template,
translations,
type,
subdomain
)
SELECT
'{{ name }}',
'{{ template }}',
'{{ translations }}',
'{{ type }}',
'{{ subdomain }}'
RETURNING
id,
name,
created,
lastUpdated,
template,
translations,
type
;

UPDATE examples​

Updates only some of the SMS Template properties:
* All properties within the custom SMS Template that have values are updated.
* Any translation that doesn't exist is added.
* Any translation with a null or empty value is removed.
* Any translation with non-empty/null value is updated.

UPDATE okta.templates.sms_templates
SET
name = '{{ name }}',
template = '{{ template }}',
translations = '{{ translations }}',
type = '{{ type }}'
WHERE
templateId = '{{ templateId }}' --required
AND subdomain = '{{ subdomain }}' --required
RETURNING
id,
name,
created,
lastUpdated,
template,
translations,
type;

REPLACE examples​

Replaces the SMS Template
> Notes: You can't update the default SMS Template.

REPLACE okta.templates.sms_templates
SET
name = '{{ name }}',
template = '{{ template }}',
translations = '{{ translations }}',
type = '{{ type }}'
WHERE
templateId = '{{ templateId }}' --required
AND subdomain = '{{ subdomain }}' --required
RETURNING
id,
name,
created,
lastUpdated,
template,
translations,
type;

DELETE examples​

Deletes an SMS template

DELETE FROM okta.templates.sms_templates
WHERE templateId = '{{ templateId }}' --required
AND subdomain = '{{ subdomain }}' --required
;