Create a comment
POST
/
comments
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const comment = await client.comments.create();
console.log(comment.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
)
comment = client.comments.create()
print(comment.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"),
)
comment, err := client.Comments.New(context.TODO(), telnyx.CommentNewParams{
Comment: telnyx.CommentParam{},
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", comment.Data)
}package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.comments.Comment;
import com.telnyx.sdk.models.comments.CommentCreateResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
Comment params = Comment.builder().build();
CommentCreateResponse comment = client.comments().create(params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
comment = telnyx.comments.create
puts(comment)<?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 {
$comment = $client->comments->create(
body: 'Hi there, ....',
commentRecordID: '8ffb3622-7c6b-4ccc-b65f-7a3dc0099576',
commentRecordType: 'sub_number_order',
);
var_dump($comment);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx comments create \
--api-key 'My API Key'curl --request POST \
--url https://api.telnyx.com/v2/comments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"body": "Hi there, ....",
"comment_record_type": "sub_number_order",
"comment_record_id": "8ffb3622-7c6b-4ccc-b65f-7a3dc0099576"
}
'{
"data": {
"id": "12ade33a-21c0-473b-b055-b3c836e1c292",
"body": "Hi there, ....",
"commenter": "user@company.com",
"commenter_type": "user",
"comment_record_type": "sub_number_order",
"comment_record_id": "8ffb3622-7c6b-4ccc-b65f-7a3dc0099576",
"read_at": "2018-01-01T00:00:00.000000Z",
"created_at": "2018-01-01T00:00:00.000000Z",
"updated_at": "2018-01-01T00:00:00.000000Z"
}
}{
"errors": [
{
"code": "10007",
"title": "Unexpected error",
"detail": "An unexpected error occured.",
"source": {
"pointer": "/base",
"parameter": "<string>"
},
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10015"
}
}
]
}{
"errors": [
{
"code": "10009",
"title": "Authentication failed",
"detail": "Could not understand the provided credentials.",
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10009"
}
}
]
}{
"errors": [
{
"code": "10007",
"title": "Unexpected error",
"detail": "An unexpected error occured.",
"source": {
"pointer": "/base",
"parameter": "<string>"
},
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10015"
}
}
]
}{
"errors": [
{
"code": "10007",
"title": "Unexpected error",
"detail": "An unexpected error occured.",
"source": {
"pointer": "/base",
"parameter": "<string>"
},
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10015"
}
}
]
}{
"errors": [
{
"code": "10007",
"title": "Unexpected error",
"detail": "An unexpected error occured.",
"source": {
"pointer": "/base",
"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
Response
A Comment Response
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 comment = await client.comments.create();
console.log(comment.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
)
comment = client.comments.create()
print(comment.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"),
)
comment, err := client.Comments.New(context.TODO(), telnyx.CommentNewParams{
Comment: telnyx.CommentParam{},
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", comment.Data)
}package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.comments.Comment;
import com.telnyx.sdk.models.comments.CommentCreateResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
Comment params = Comment.builder().build();
CommentCreateResponse comment = client.comments().create(params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
comment = telnyx.comments.create
puts(comment)<?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 {
$comment = $client->comments->create(
body: 'Hi there, ....',
commentRecordID: '8ffb3622-7c6b-4ccc-b65f-7a3dc0099576',
commentRecordType: 'sub_number_order',
);
var_dump($comment);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx comments create \
--api-key 'My API Key'curl --request POST \
--url https://api.telnyx.com/v2/comments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"body": "Hi there, ....",
"comment_record_type": "sub_number_order",
"comment_record_id": "8ffb3622-7c6b-4ccc-b65f-7a3dc0099576"
}
'{
"data": {
"id": "12ade33a-21c0-473b-b055-b3c836e1c292",
"body": "Hi there, ....",
"commenter": "user@company.com",
"commenter_type": "user",
"comment_record_type": "sub_number_order",
"comment_record_id": "8ffb3622-7c6b-4ccc-b65f-7a3dc0099576",
"read_at": "2018-01-01T00:00:00.000000Z",
"created_at": "2018-01-01T00:00:00.000000Z",
"updated_at": "2018-01-01T00:00:00.000000Z"
}
}{
"errors": [
{
"code": "10007",
"title": "Unexpected error",
"detail": "An unexpected error occured.",
"source": {
"pointer": "/base",
"parameter": "<string>"
},
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10015"
}
}
]
}{
"errors": [
{
"code": "10009",
"title": "Authentication failed",
"detail": "Could not understand the provided credentials.",
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10009"
}
}
]
}{
"errors": [
{
"code": "10007",
"title": "Unexpected error",
"detail": "An unexpected error occured.",
"source": {
"pointer": "/base",
"parameter": "<string>"
},
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10015"
}
}
]
}{
"errors": [
{
"code": "10007",
"title": "Unexpected error",
"detail": "An unexpected error occured.",
"source": {
"pointer": "/base",
"parameter": "<string>"
},
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10015"
}
}
]
}{
"errors": [
{
"code": "10007",
"title": "Unexpected error",
"detail": "An unexpected error occured.",
"source": {
"pointer": "/base",
"parameter": "<string>"
},
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10015"
}
}
]
}