Create message template
Create a new Verify profile message template.
POST
/
verify_profiles
/
templates
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const messageTemplate = await client.verifyProfiles.createTemplate({
text: 'Your {{app_name}} verification code is: {{code}}.',
});
console.log(messageTemplate.data);import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
message_template = client.verify_profiles.create_template(
text="Your {{app_name}} verification code is: {{code}}.",
)
print(message_template.data)package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
messageTemplate, err := client.VerifyProfiles.NewTemplate(context.TODO(), telnyx.VerifyProfileNewTemplateParams{
Text: "Your {{app_name}} verification code is: {{code}}.",
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", messageTemplate.Data)
}package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.verifyprofiles.MessageTemplate;
import com.telnyx.sdk.models.verifyprofiles.VerifyProfileCreateTemplateParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
VerifyProfileCreateTemplateParams params = VerifyProfileCreateTemplateParams.builder()
.text("Your {{app_name}} verification code is: {{code}}.")
.build();
MessageTemplate messageTemplate = client.verifyProfiles().createTemplate(params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
message_template = telnyx.verify_profiles.create_template(text: "Your {{app_name}} verification code is: {{code}}.")
puts(message_template)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$messageTemplate = $client->verifyProfiles->createTemplate(
text: 'Your {{app_name}} verification code is: {{code}}.'
);
var_dump($messageTemplate);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx verify-profiles create-template \
--api-key 'My API Key' \
--text 'Your {{app_name}} verification code is: {{code}}.'curl --request POST \
--url https://api.telnyx.com/v2/verify_profiles/templates \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"text": "Your {{app_name}} verification code is: {{code}}."
}
'{
"data": {
"id": "0abb5b4f-459f-445a-bfcd-488998b7572d",
"text": "Your {{app_name}} verification code is: {{code}}."
}
}{
"errors": [
{
"code": "10015",
"title": "Invalid sorting value",
"detail": "The value provided for sorting is not valid. Check the value used and try again.",
"source": {
"pointer": "/sort",
"parameter": "<string>"
},
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10015"
}
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
The request body when creating a message template.
The text content of the message template.
Example:
"Your {{app_name}} verification code is: {{code}}."
Response
Expected message template response to a valid request.
Show child attributes
Show child attributes
Was this page helpful?
⌘I
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const messageTemplate = await client.verifyProfiles.createTemplate({
text: 'Your {{app_name}} verification code is: {{code}}.',
});
console.log(messageTemplate.data);import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
message_template = client.verify_profiles.create_template(
text="Your {{app_name}} verification code is: {{code}}.",
)
print(message_template.data)package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
messageTemplate, err := client.VerifyProfiles.NewTemplate(context.TODO(), telnyx.VerifyProfileNewTemplateParams{
Text: "Your {{app_name}} verification code is: {{code}}.",
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", messageTemplate.Data)
}package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.verifyprofiles.MessageTemplate;
import com.telnyx.sdk.models.verifyprofiles.VerifyProfileCreateTemplateParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
VerifyProfileCreateTemplateParams params = VerifyProfileCreateTemplateParams.builder()
.text("Your {{app_name}} verification code is: {{code}}.")
.build();
MessageTemplate messageTemplate = client.verifyProfiles().createTemplate(params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
message_template = telnyx.verify_profiles.create_template(text: "Your {{app_name}} verification code is: {{code}}.")
puts(message_template)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$messageTemplate = $client->verifyProfiles->createTemplate(
text: 'Your {{app_name}} verification code is: {{code}}.'
);
var_dump($messageTemplate);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx verify-profiles create-template \
--api-key 'My API Key' \
--text 'Your {{app_name}} verification code is: {{code}}.'curl --request POST \
--url https://api.telnyx.com/v2/verify_profiles/templates \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"text": "Your {{app_name}} verification code is: {{code}}."
}
'{
"data": {
"id": "0abb5b4f-459f-445a-bfcd-488998b7572d",
"text": "Your {{app_name}} verification code is: {{code}}."
}
}{
"errors": [
{
"code": "10015",
"title": "Invalid sorting value",
"detail": "The value provided for sorting is not valid. Check the value used and try again.",
"source": {
"pointer": "/sort",
"parameter": "<string>"
},
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10015"
}
}
]
}