Table of Contents

Struct CreateTemplateFragmentRequest

Namespace
Vonage.VerifyV2.CreateTemplateFragment
Assembly
Vonage.dll

Represents a request to create a template fragment containing the message text for a specific channel and locale combination.

[Builder(new string[] { })]
public readonly struct CreateTemplateFragmentRequest : IVonageRequest
Implements
Inherited Members

Properties

Channel

Sets the verification channel this fragment applies to. Only SMS and Voice channels are supported for templates.

[JsonPropertyOrder(0)]
[JsonConverter(typeof(EnumDescriptionJsonConverter<VerificationChannel>))]
[Mandatory(3)]
public VerificationChannel Channel { get; }

Property Value

VerificationChannel

Examples

.WithChannel(VerificationChannel.Sms)

Locale

Sets the IETF BCP 47 locale code for this fragment (e.g., "en-us", "de-de").

[JsonPropertyOrder(1)]
[Mandatory(2)]
public Locale Locale { get; }

Property Value

Locale

Examples

.WithLocale(Locale.EnUs)

TemplateId

Sets the unique identifier (UUID) of the parent template this fragment belongs to.

[JsonIgnore]
[Mandatory(0)]
public Guid TemplateId { get; }

Property Value

Guid

Examples

.WithTemplateId(Guid.Parse("8f35a1a7-eb2f-4552-8fdf-fffdaee41bc9"))

Text

Sets the message text content with optional placeholders: ${code}, ${brand}, ${time-limit}, and ${time-limit-unit}.

[JsonPropertyOrder(2)]
[Mandatory(1)]
public string Text { get; }

Property Value

string

Examples

.WithText("Your ${brand} verification code is ${code}. Valid for ${time-limit} ${time-limit-unit}.")

Methods

Build()

public static IBuilderForTemplateId Build()

Returns

IBuilderForTemplateId

BuildRequestMessage()

Converts the request to a HttpRequest.

public HttpRequestMessage BuildRequestMessage()

Returns

HttpRequestMessage

The Http request.