Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.22.0"
".": "0.23.0"
}
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
configured_endpoints: 1096
configured_endpoints: 1097
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## [0.23.0](https://github.com/team-telnyx/telnyx-cli/compare/v0.22.0...v0.23.0) (2026-07-09)


### Bug Fixes

* **release:** make the --local scan clone see the repointed release branch ([#66](https://github.com/team-telnyx/telnyx-cli/issues/66)) ([cfffba5](https://github.com/team-telnyx/telnyx-cli/commit/cfffba549ef1d131d77a9b5b7d78317985c4cd0d))

## [0.22.0](https://github.com/team-telnyx/telnyx-cli/compare/v0.21.0...v0.22.0) (2026-07-09)


Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
github.com/itchyny/json2yaml v0.1.4
github.com/muesli/reflow v0.3.0
github.com/stretchr/testify v1.10.0
github.com/team-telnyx/telnyx-go/v4 v4.87.0
github.com/team-telnyx/telnyx-go/v4 v4.88.0
github.com/tidwall/gjson v1.18.0
github.com/tidwall/pretty v1.2.1
github.com/urfave/cli-docs/v3 v3.0.0-alpha6
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/team-telnyx/telnyx-go/v4 v4.87.0 h1:HvvnCXMQhu/KWf4oz3lxaH74a3/QD98Rg58oVs0G2/k=
github.com/team-telnyx/telnyx-go/v4 v4.87.0/go.mod h1:a8Z4CX3XKpxpziKboMKXe3Ds4hZ1ImAnZ1mQm5QxHyw=
github.com/team-telnyx/telnyx-go/v4 v4.88.0 h1:UHrnEwHEB22BlvFb2TiriTFd0rRaMZSmQpe7Ex31ijw=
github.com/team-telnyx/telnyx-go/v4 v4.88.0/go.mod h1:a8Z4CX3XKpxpziKboMKXe3Ds4hZ1ImAnZ1mQm5QxHyw=
github.com/tidwall/gjson v1.14.2/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
github.com/tidwall/gjson v1.18.0 h1:FIDeeyB800efLX89e5a8Y0BNH+LOngJyGrIWxG2FKQY=
github.com/tidwall/gjson v1.18.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
Expand Down
98 changes: 98 additions & 0 deletions pkg/cmd/aiconversationconversationinsight.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

package cmd

import (
"context"
"fmt"

"github.com/team-telnyx/telnyx-cli/internal/apiquery"
"github.com/team-telnyx/telnyx-cli/internal/requestflag"
"github.com/team-telnyx/telnyx-go/v4"
"github.com/team-telnyx/telnyx-go/v4/option"
"github.com/tidwall/gjson"
"github.com/urfave/cli/v3"
)

var aiConversationsConversationInsightsRetrieveAggregates = requestflag.WithInnerFlags(cli.Command{
Name: "retrieve-aggregates",
Usage: "Aggregate conversation insights by specified fields",
Suggest: true,
Flags: []cli.Flag{
&requestflag.Flag[string]{
Name: "created-at",
Usage: "Filter by creation datetime to scope the aggregation window. Supports range operators (e.g., `created_at=gte.2025-01-01T00:00:00Z` for the start of the range, `created_at=lt.2025-01-02T00:00:00Z` for the end). To build per-day time series (as the portal does for the 'Insights Over Time' chart), issue one request per day bounded by `created_at=gte.<day_start>` and `created_at=lt.<next_day_start>`.",
QueryPath: "created_at",
},
&requestflag.Flag[[]string]{
Name: "group-by",
Usage: "Fields to group by (can be comma-separated or multiple parameters). Prefix a field with 'metadata.' (e.g. 'metadata.assistant_id') to group by the conversation's metadata instead of the insight result.\n\nCommon fields used for over-time charts:\n- `score` — Group by the insight's score value (e.g. for Agent Instruction Following, User Satisfaction).\n- `metadata.assistant_id` — Group by the assistant that handled the conversation.\n- `metadata.assistant_version_id` — Group by the assistant version, useful for comparing performance across versions in the portal's 'Insights Over Time' chart.\n- `metadata.telnyx_conversation_channel` — Group by conversation channel (phone_call, web_chat, etc.).",
QueryPath: "group_by",
},
&requestflag.Flag[string]{
Name: "insight-id",
Usage: "Optional insight ID to filter conversation insights. Only insights matching this ID will be included in the aggregation.",
QueryPath: "insight_id",
},
&requestflag.Flag[map[string]any]{
Name: "metadata",
QueryPath: "metadata",
},
&requestflag.Flag[[]string]{
Name: "show",
Usage: "Fields to include in the result (can be comma-separated or multiple parameters). Supports the same 'metadata.<key>' prefix as group_by. Each returned row will contain the grouped field values plus a `record_count` indicating how many conversation insights match that combination.",
QueryPath: "show",
},
},
Action: handleAIConversationsConversationInsightsRetrieveAggregates,
HideHelpCommand: true,
}, map[string][]requestflag.HasOuterFlag{
"metadata": {
&requestflag.InnerFlag[string]{
Name: "metadata.assistant-id",
Usage: "Filter by assistant ID (e.g., `metadata.assistant_id=eq.<assistant_id>`). When provided, only conversation insights for the specified assistant are aggregated. Used by the portal to scope the 'Insights Over Time' chart to a single assistant.",
InnerField: "assistant_id",
},
},
})

func handleAIConversationsConversationInsightsRetrieveAggregates(ctx context.Context, cmd *cli.Command) error {
client := telnyx.NewClient(getDefaultRequestOptions(cmd)...)
unusedArgs := cmd.Args().Slice()

if len(unusedArgs) > 0 {
return fmt.Errorf("Unexpected extra arguments: %v", unusedArgs)
}

options, err := flagOptions(
cmd,
apiquery.NestedQueryFormatBrackets,
apiquery.ArrayQueryFormatComma,
EmptyBody,
false,
)
if err != nil {
return err
}

params := telnyx.AIConversationConversationInsightGetAggregatesParams{}

var res []byte
options = append(options, option.WithResponseBodyInto(&res))
_, err = client.AI.Conversations.ConversationInsights.GetAggregates(ctx, params, options...)
if err != nil {
return err
}

obj := gjson.ParseBytes(res)
format := cmd.Root().String("format")
explicitFormat := cmd.Root().IsSet("format")
transform := cmd.Root().String("transform")
return ShowJSON(obj, ShowJSONOpts{
ExplicitFormat: explicitFormat,
Format: format,
RawOutput: cmd.Root().Bool("raw-output"),
Title: "ai:conversations:conversation-insights retrieve-aggregates",
Transform: transform,
})
}
43 changes: 43 additions & 0 deletions pkg/cmd/aiconversationconversationinsight_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

package cmd

import (
"testing"

"github.com/team-telnyx/telnyx-cli/internal/mocktest"
"github.com/team-telnyx/telnyx-cli/internal/requestflag"
)

func TestAIConversationsConversationInsightsRetrieveAggregates(t *testing.T) {
t.Skip("Mock server tests are disabled")
t.Run("regular flags", func(t *testing.T) {
mocktest.TestRunMockTestWithFlags(
t,
"--api-key", "string",
"ai:conversations:conversation-insights", "retrieve-aggregates",
"--created-at", "created_at",
"--group-by", "string",
"--insight-id", "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"--metadata", "{assistant_id: assistant_id}",
"--show", "string",
)
})

t.Run("inner flags", func(t *testing.T) {
// Check that inner flags have been set up correctly
requestflag.CheckInnerFlags(aiConversationsConversationInsightsRetrieveAggregates)

// Alternative argument passing style using inner flags
mocktest.TestRunMockTestWithFlags(
t,
"--api-key", "string",
"ai:conversations:conversation-insights", "retrieve-aggregates",
"--created-at", "created_at",
"--group-by", "string",
"--insight-id", "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"--metadata.assistant-id", "assistant_id",
"--show", "string",
)
})
}
6 changes: 3 additions & 3 deletions pkg/cmd/auditevent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func TestAuditEventsList(t *testing.T) {
"--api-key", "string",
"audit-events", "list",
"--max-items", "10",
"--filter", "{created_after: '2021-01-04T00:00:00Z', created_before: '2021-01-04T00:00:00Z'}",
"--filter", "{created_after: '2021-01-05T00:00:00Z', created_before: '2021-01-05T00:00:00Z'}",
"--page-number", "0",
"--page-size", "0",
"--sort", "desc",
Expand All @@ -34,8 +34,8 @@ func TestAuditEventsList(t *testing.T) {
"--api-key", "string",
"audit-events", "list",
"--max-items", "10",
"--filter.created-after", "2021-01-04T00:00:00Z",
"--filter.created-before", "2021-01-04T00:00:00Z",
"--filter.created-after", "2021-01-05T00:00:00Z",
"--filter.created-before", "2021-01-05T00:00:00Z",
"--page-number", "0",
"--page-size", "0",
"--sort", "desc",
Expand Down
8 changes: 8 additions & 0 deletions pkg/cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,14 @@ func init() {
&aiConversationsMessagesList,
},
},
{
Name: "ai:conversations:conversation-insights",
Category: "API RESOURCE",
Suggest: true,
Commands: []*cli.Command{
&aiConversationsConversationInsightsRetrieveAggregates,
},
},
{
Name: "ai:embeddings",
Category: "API RESOURCE",
Expand Down
4 changes: 2 additions & 2 deletions pkg/cmd/verifyprofile.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ var verifyProfilesCreate = requestflag.WithInnerFlags(cli.Command{
},
&requestflag.InnerFlag[*string]{
Name: "whatsapp.template-id",
Usage: "Customer pre-approved authentication template name registered on Meta",
Usage: "Customer pre-approved authentication template ID registered on Meta",
InnerField: "template_id",
},
&requestflag.InnerFlag[*string]{
Expand Down Expand Up @@ -311,7 +311,7 @@ var verifyProfilesUpdate = requestflag.WithInnerFlags(cli.Command{
},
&requestflag.InnerFlag[*string]{
Name: "whatsapp.template-id",
Usage: "Customer pre-approved authentication template name registered on Meta",
Usage: "Customer pre-approved authentication template ID registered on Meta",
InnerField: "template_id",
},
&requestflag.InnerFlag[*string]{
Expand Down
12 changes: 6 additions & 6 deletions pkg/cmd/verifyprofile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func TestVerifyProfilesCreate(t *testing.T) {
"--sms", "{alpha_sender: sqF, app_name: Example Secure App, code_length: 6, default_verification_timeout_secs: 300, messaging_template_id: 0abb5b4f-459f-445a-bfcd-488998b7572d, whitelisted_destinations: [US, CA]}",
"--webhook-failover-url", "http://example.com/webhook/failover",
"--webhook-url", "http://example.com/webhook",
"--whatsapp", "{default_verification_timeout_secs: 300, sender_phone_number: '+13035551234', template_id: authentication_template_name, waba_id: '1234567890', whitelisted_destinations: [US, CA]}",
"--whatsapp", "{default_verification_timeout_secs: 300, sender_phone_number: '+13035551234', template_id: authentication_template_id, waba_id: '1234567890', whitelisted_destinations: [US, CA]}",
)
})

Expand Down Expand Up @@ -60,7 +60,7 @@ func TestVerifyProfilesCreate(t *testing.T) {
"--webhook-url", "http://example.com/webhook",
"--whatsapp.default-verification-timeout-secs", "300",
"--whatsapp.sender-phone-number", "+13035551234",
"--whatsapp.template-id", "authentication_template_name",
"--whatsapp.template-id", "authentication_template_id",
"--whatsapp.waba-id", "1234567890",
"--whatsapp.whitelisted-destinations", "[US, CA]",
)
Expand Down Expand Up @@ -101,7 +101,7 @@ func TestVerifyProfilesCreate(t *testing.T) {
"whatsapp:\n" +
" default_verification_timeout_secs: 300\n" +
" sender_phone_number: '+13035551234'\n" +
" template_id: authentication_template_name\n" +
" template_id: authentication_template_id\n" +
" waba_id: '1234567890'\n" +
" whitelisted_destinations:\n" +
" - US\n" +
Expand Down Expand Up @@ -142,7 +142,7 @@ func TestVerifyProfilesUpdate(t *testing.T) {
"--sms", "{alpha_sender: sqF, app_name: Example Secure App, code_length: 6, default_verification_timeout_secs: 300, messaging_template_id: 0abb5b4f-459f-445a-bfcd-488998b7572d, whitelisted_destinations: [US, CA]}",
"--webhook-failover-url", "http://example.com/webhook/failover",
"--webhook-url", "http://example.com/webhook",
"--whatsapp", "{default_verification_timeout_secs: 300, sender_phone_number: '+13035551234', template_id: authentication_template_name, waba_id: '1234567890', whitelisted_destinations: [US, CA]}",
"--whatsapp", "{default_verification_timeout_secs: 300, sender_phone_number: '+13035551234', template_id: authentication_template_id, waba_id: '1234567890', whitelisted_destinations: [US, CA]}",
)
})

Expand Down Expand Up @@ -175,7 +175,7 @@ func TestVerifyProfilesUpdate(t *testing.T) {
"--webhook-url", "http://example.com/webhook",
"--whatsapp.default-verification-timeout-secs", "300",
"--whatsapp.sender-phone-number", "+13035551234",
"--whatsapp.template-id", "authentication_template_name",
"--whatsapp.template-id", "authentication_template_id",
"--whatsapp.waba-id", "1234567890",
"--whatsapp.whitelisted-destinations", "[US, CA]",
)
Expand Down Expand Up @@ -210,7 +210,7 @@ func TestVerifyProfilesUpdate(t *testing.T) {
"whatsapp:\n" +
" default_verification_timeout_secs: 300\n" +
" sender_phone_number: '+13035551234'\n" +
" template_id: authentication_template_name\n" +
" template_id: authentication_template_id\n" +
" waba_id: '1234567890'\n" +
" whitelisted_destinations:\n" +
" - US\n" +
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

package cmd

const Version = "0.22.0" // x-release-please-version
const Version = "0.23.0" // x-release-please-version
Loading