Create a notification channel
Create a notification channel.
POST
/
notification_channels
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const notificationChannel = await client.notificationChannels.create();
console.log(notificationChannel.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
)
notification_channel = client.notification_channels.create()
print(notification_channel.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"),
)
notificationChannel, err := client.NotificationChannels.New(context.TODO(), telnyx.NotificationChannelNewParams{})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", notificationChannel.Data)
}package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.notificationchannels.NotificationChannelCreateParams;
import com.telnyx.sdk.models.notificationchannels.NotificationChannelCreateResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
NotificationChannelCreateResponse notificationChannel = client.notificationChannels().create();
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
notification_channel = telnyx.notification_channels.create
puts(notification_channel)<?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 {
$notificationChannel = $client->notificationChannels->create(
channelDestination: '+13125550000',
channelTypeID: 'sms',
notificationProfileID: '12455643-3cf1-4683-ad23-1cd32f7d5e0a',
);
var_dump($notificationChannel);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx notification-channels create \
--api-key 'My API Key'curl --request POST \
--url https://api.telnyx.com/v2/notification_channels \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"notification_profile_id": "12455643-3cf1-4683-ad23-1cd32f7d5e0a",
"channel_destination": "+13125550000"
}
'{
"data": {
"id": "12455643-3cf1-4683-ad23-1cd32f7d5e0a",
"notification_profile_id": "12455643-3cf1-4683-ad23-1cd32f7d5e0a",
"channel_destination": "+13125550000",
"created_at": "2019-10-15T10:07:15.527Z",
"updated_at": "2019-10-15T10:07:15.527Z"
}
}{
"errors": [
{
"code": "<string>",
"title": "<string>",
"detail": "<string>",
"source": {
"pointer": "<string>",
"parameter": "<string>"
},
"meta": {}
}
]
}{
"errors": [
{
"code": "<string>",
"title": "<string>",
"detail": "<string>",
"source": {
"pointer": "<string>",
"parameter": "<string>"
},
"meta": {}
}
]
}{
"errors": [
{
"code": "<string>",
"title": "<string>",
"detail": "<string>",
"source": {
"pointer": "<string>",
"parameter": "<string>"
},
"meta": {}
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Add a Notification Channel
A Notification Channel
A UUID reference to the associated Notification Profile.
Example:
"12455643-3cf1-4683-ad23-1cd32f7d5e0a"
A Channel Type ID
Available options:
sms, voice, email, webhook The destination associated with the channel type.
Example:
"+13125550000"
Response
A Notification Channel response
A Notification Channel
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 notificationChannel = await client.notificationChannels.create();
console.log(notificationChannel.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
)
notification_channel = client.notification_channels.create()
print(notification_channel.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"),
)
notificationChannel, err := client.NotificationChannels.New(context.TODO(), telnyx.NotificationChannelNewParams{})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", notificationChannel.Data)
}package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.notificationchannels.NotificationChannelCreateParams;
import com.telnyx.sdk.models.notificationchannels.NotificationChannelCreateResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
NotificationChannelCreateResponse notificationChannel = client.notificationChannels().create();
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
notification_channel = telnyx.notification_channels.create
puts(notification_channel)<?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 {
$notificationChannel = $client->notificationChannels->create(
channelDestination: '+13125550000',
channelTypeID: 'sms',
notificationProfileID: '12455643-3cf1-4683-ad23-1cd32f7d5e0a',
);
var_dump($notificationChannel);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx notification-channels create \
--api-key 'My API Key'curl --request POST \
--url https://api.telnyx.com/v2/notification_channels \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"notification_profile_id": "12455643-3cf1-4683-ad23-1cd32f7d5e0a",
"channel_destination": "+13125550000"
}
'{
"data": {
"id": "12455643-3cf1-4683-ad23-1cd32f7d5e0a",
"notification_profile_id": "12455643-3cf1-4683-ad23-1cd32f7d5e0a",
"channel_destination": "+13125550000",
"created_at": "2019-10-15T10:07:15.527Z",
"updated_at": "2019-10-15T10:07:15.527Z"
}
}{
"errors": [
{
"code": "<string>",
"title": "<string>",
"detail": "<string>",
"source": {
"pointer": "<string>",
"parameter": "<string>"
},
"meta": {}
}
]
}{
"errors": [
{
"code": "<string>",
"title": "<string>",
"detail": "<string>",
"source": {
"pointer": "<string>",
"parameter": "<string>"
},
"meta": {}
}
]
}{
"errors": [
{
"code": "<string>",
"title": "<string>",
"detail": "<string>",
"source": {
"pointer": "<string>",
"parameter": "<string>"
},
"meta": {}
}
]
}