### React Native SDK Quickstart Source: https://telnyx.com/llms/calling.txt A complete setup guide to get started with the Telnyx React Native SDK, from installation to making your first call. ```APIDOC ## React Native SDK Quickstart ### Description Begin your journey with the Telnyx React Native SDK quickly and easily. This guide provides a step-by-step walkthrough from initial installation to successfully placing your first call, ensuring a smooth setup process. ### Endpoint https://developers.telnyx.com/development/webrtc/react-native-sdk/quickstart.md ``` -------------------------------- ### Interactive 10DLC Setup with Telnyx CLI Source: https://telnyx.com/llms/development/telnyx-cli-full.txt Initiate the guided setup wizard for 10DLC registration using the Telnyx CLI. ```bash telnyx 10dlc wizard # Guided setup wizard ``` -------------------------------- ### Start Call Recording Source: https://telnyx.com/llms/calling/voice-api-full.txt This example shows how to start recording a call. You can specify the format, channels, whether to play a beep, and the client state. ```javascript const record_call = new telnyx.Call({ call_control_id: l_call_control_id}); record_call.record_start({ format: "mp3", channels: "single", play_beep: true, client_state: Buffer.from(JSON.stringify(l_client_state)).toString( "base64" ),}); ``` -------------------------------- ### Start the IVR Demo Server Source: https://telnyx.com/llms/calling-full.txt Use this command to start the IVR demo server if you are using a Gemfile. If using globally installed gems, use the second command. ```bash bundle exec ruby ivr_demo_server.rb ``` ```bash ruby ivr_demo_server.rb ``` -------------------------------- ### Example GET Request for TeXML Instructions Source: https://telnyx.com/llms/calling/texml-full.txt This example shows how Telnyx formats parameters as URL query parameters for a GET request to fetch TeXML instructions. It includes essential call details. ```bash GET /texml-instructions? AccountSid=6a9a7976-012e-45d2-9258-6f5dc68d861e& CallSid=fcc47bc6-e428-11ed-ad79-02420aef00b4& CallSidLegacy=fcc47bc6-e428-11ed-ad79-02420aef00b4& From=%2B13122010091& To=%2B13122010090& ConnectionId=1568109700606592442& CallStatus=in-progress ``` -------------------------------- ### React SDK - Quickstart Source: https://telnyx.com/llms/calling/webrtc.txt Get started with the Telnyx React SDK for building WebRTC voice applications in React. ```APIDOC ## React quickstart ### Description Get started with the Telnyx React SDK for building WebRTC voice applications in React. ### Endpoint N/A (Quickstart Guide) ### Parameters N/A ### Request Example N/A ### Response N/A ``` -------------------------------- ### Get Telnyx Example Command Help Source: https://telnyx.com/llms/development-full.txt Examples of how to get help for specific Telnyx commands like phone-numbers, messages, and calls. ```bash telnyx phone-numbers --help ``` ```bash telnyx messages send --help ``` ```bash telnyx calls:actions --help ``` -------------------------------- ### Download and Run PPP Installer Script Source: https://telnyx.com/llms/wireless/data-full.txt Download the standalone PPP installer script, make it executable, and run it to configure the cellular connection. This script guides through APN and port selection. ```bash wget https://raw.githubusercontent.com/sixfab/Sixfab_PPP_Installer/master/ppp_install_standalone.sh sudo chmod +x ppp_install_standalone.sh sudo ./ppp_install_standalone.sh ``` -------------------------------- ### Running the IVR Demo Server Source: https://telnyx.com/llms/calling/voice-api-full.txt Use this command to start the IVR demo server if you have installed the necessary gems globally. Ensure your application is accessible from the internet using a tunneling service. ```bash ruby ivr_demo_server.rb ``` -------------------------------- ### Example Workflow: Appointment Booking Source: https://telnyx.com/llms/ai/assistants-full.txt Outlines a structured workflow for guiding a customer through the process of booking an appointment, collecting necessary information sequentially. ```text Collect request → Collect availability → Confirm details → Final confirmation ``` -------------------------------- ### Example Instruction Format for Issue Categorization Source: https://telnyx.com/llms/ai/assistants-full.txt Demonstrates a clear, example-based instruction for categorizing customer issues. Use this format to guide the AI in classifying problems into predefined categories. ```text Categorize the issue as one of: - Billing (e.g., incorrect charges, payment questions). - Technical (e.g., service not working, setup help). - Account (e.g., upgrades, cancellations). ``` -------------------------------- ### Download Sixfab Quickstart Script Source: https://telnyx.com/llms/wireless/data-full.txt Obtain the Sixfab quickstart script from the official GitHub repository. This script is necessary for configuring the 3G/4G HAT. ```bash wget https://raw.githubusercontent.com/sixfab/Sixfab_RPi_3G-4G-LTE_Base_Shield/master/tutorials/QMI_tutorial/qmi_install.sh ``` -------------------------------- ### Python Unit Test for GET Request Source: https://telnyx.com/llms/edge/compute-full.txt Write an asynchronous Python unit test using pytest and pytest-asyncio to test the handler for GET requests. This example checks the response start status. ```python # tests/test_handler.py import pytest import asyncio from function import Function @pytest.mark.asyncio async def test_handle_get(): func = Function() responses = [] async def receive(): return {"type": "http.request", "body": b""} async def send(message): responses.append(message) scope = {"type": "http", "method": "GET", "path": "/", "headers": []} await func.handle(scope, receive, send) # Check response.start assert responses[0]["type"] == "http.response.start" assert responses[0]["status"] == 200 ``` -------------------------------- ### Initialize Python Project and Install Packages Source: https://telnyx.com/llms/calling/voice-api-full.txt Set up a new directory for your call tracking application, create a virtual environment, and install the required Python packages using pip. ```bash mkdir call-tracking cd call-tracking python3 -m venv /path/to/new/virtual/environment ``` ```bash pip install flask pip install flask-modus pip install python-dotenv pip install telnyx pip install peewee pip install pymysql pip install werkzeug==0.16.1 ``` -------------------------------- ### Clone Telnyx Python Demo Repository Source: https://telnyx.com/llms/other-apis/fax-full.txt Clone the official Telnyx Python demo repository to get started with the example application. This provides a base for your integration. ```bash $ git clone https://github.com/team-telnyx/demo-python-telnyx.git ``` -------------------------------- ### Go Function Cold Start Initialization Source: https://telnyx.com/llms/edge/compute-full.txt Illustrates global initialization in Go, establishing a database connection once per container, and handling requests efficiently by reusing this connection. ```go package function import ( "database/sql" "encoding/json" "log" "net/http" "os" ) // Global initialization (runs once per container) var db *sql.DB func init() { // Expensive operations here — only run once var err error db, err = sql.Open("postgres", os.Getenv("DATABASE_URL")) if err != nil { log.Fatal(err) } } // Function handler (runs per request) func Handle(w http.ResponseWriter, r *http.Request) { // Fast path — reuse initialized resources rows, err := db.Query("SELECT * FROM users") if err != nil { http.Error(w, err.Error(), 500) return } defer rows.Close() var users []map[string]interface{} cols, _ := rows.Columns() for rows.Next() { vals := make([]interface{}, len(cols)) ptrs := make([]interface{}, len(cols)) for i := range vals { ptrs[i] = &vals[i] } rows.Scan(ptrs...) row := make(map[string]interface{}) for i, col := range cols { row[col] = vals[i] } users = append(users, row) } json.NewEncoder(w).Encode(users) } ``` -------------------------------- ### Set up Virtual Environment Source: https://telnyx.com/llms/ai/inference-full.txt Create and activate a Python virtual environment for project dependencies. ```bash python -m venv venv source venv/bin/activate ``` -------------------------------- ### Retrieve Messaging Number Configuration (Node.js) Source: https://telnyx.com/llms/messaging/sms-mms-full.txt This Node.js example uses the 'axios' library to get the messaging configuration for a phone number. Make sure 'axios' is installed and the 'headers' object contains your API key. ```javascript const { data: config } = await axios.get( `https://api.telnyx.com/v2/messaging_phone_numbers/${encodeURIComponent(phoneNumber)}`, { headers } ); console.log('Number:', config.data.phone_number); console.log('Profile:', config.data.messaging_profile_id); console.log('Features:', config.data.features); console.log('Health:', config.data.features); ``` -------------------------------- ### Deploy Go Application with Telnyx CLI Source: https://telnyx.com/llms/edge/compute-full.txt This snippet demonstrates setting up Go, running tests, installing the Telnyx CLI, and deploying an application via GitHub Actions. ```yaml jobs: deploy: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Set up Go uses: actions/setup-go@v5 with: go-version: '1.22' - name: Run tests run: go test ./... - name: Install Telnyx CLI run: | # Download from https://github.com/team-telnyx/edge-compute/releases wget -qO- https://github.com/team-telnyx/edge-compute/releases/latest/download/telnyx-edge-linux-amd64.tar.gz | tar xz sudo mv telnyx-edge /usr/local/bin/ echo "$HOME/.telnyx/bin" >> $GITHUB_PATH - name: Deploy env: TELNYX_API_KEY: ${{ secrets.TELNYX_API_KEY }} run: telnyx-edge ship ``` -------------------------------- ### ListParts Request Example Source: https://telnyx.com/llms/edge/storage-full.txt Example of an HTTP GET request to list parts of a multipart upload. Requires the `uploadId` parameter. ```bsh GET /publicbucket/mymultiloader?uploadId=2~vl8z2yj8-4JWQiQJZ1XiS-gUY9sIkcH HTTP/1.1 Host: [region].telnyxcloudstorage.com X-Amz-Date: 20230927T160734Z Authorization: AWS4-HMAC-SHA256 Credential=YOUR_TELNYX_API_KEY/20230927/test/execute-api/aws4_request, SignedHeaders=host;x-amz-date, Signature=c2224c5a6a794e0e41f6aa962ab72f0fc2ccb9156b946d22fdb106dd1f95586b ``` -------------------------------- ### Install Prerequisite Software for SIM7600 HAT Source: https://telnyx.com/llms/wireless/data-full.txt Install libqmi-utils for Qualcomm modem interaction and udhcpc for modem DHCP leasing to manage IP addressing. ```bash sudo apt install libqmi-utils && udhcpc ``` -------------------------------- ### Install Sixfab Cellular IoT Library Source: https://telnyx.com/llms/wireless/data-full.txt Clone the Sixfab RPi Cellular IoT Library repository and install it using the setup script. This is a required step for dependency installation. ```bash git clone https://github.com/sixfab/Sixfab_RPi_CellularIoT_Library.git cd Sixfab_RPi_CellularIoT_Library sudo python3 setup.py install ``` -------------------------------- ### Basic Call Setup Source: https://telnyx.com/llms/calling/webrtc-full.txt Initiates a new call with essential properties. Ensure `destinationNumber` and `audio` are always provided. ```javascript const call = client.newCall({ destinationNumber: '+12345678900', // Required audio: true, // Required callerName: 'John Doe', // Optional caller ID trickleIce: true, // Faster call setup }); ``` -------------------------------- ### Welcome and Promotional Message Example Source: https://telnyx.com/llms/messaging/sms-mms-full.txt Example of a welcome message sent upon user opt-in, followed by a promotional message. Disclose message frequency and rates at opt-in. Use STOP to opt out. ```text Welcome msg: Acme Corp: Thanks for joining! Get exclusive deals and updates. Reply HELP for help, STOP to cancel. Msg&data rates may apply. ~4 msgs/month. Promo msg: Acme Flash Sale! 30% off all items today only. Shop now: https://acme.com/sale Reply STOP to opt out. ``` -------------------------------- ### ListObjectVersions Request Example Source: https://telnyx.com/llms/edge/storage-full.txt Example HTTP GET request to list object versions. Ensure to replace '[region]' with your actual region and 'YOUR_TELNYX_API_KEY' with your credentials. ```bash GET /versionedbucket?versions=null HTTP/1.1 Host: [region].telnyxcloudstorage.com Accept: application/octet-stream X-Amz-Date: 20230927T170348Z Authorization: AWS4-HMAC-SHA256 Credential=YOUR_TELNYX_API_KEY/20230927/test/execute-api/aws4_request, SignedHeaders=accept;host;x-amz-date, Signature=15c5f0d8404b4e43153138818ca4cd0895c6a0bd4b94173bb6080a71f41bc49f ``` -------------------------------- ### Direct Skill URL Example Source: https://telnyx.com/llms/development-full.txt Example of a direct URL to a specific language and product skill file. Replace placeholders for your desired configuration. ```text https://raw.githubusercontent.com/team-telnyx/skills/main/telnyx-python/skills/telnyx-messaging-python/SKILL.md ``` -------------------------------- ### Get Bucket Tagging Request Source: https://telnyx.com/llms/edge/storage-full.txt This example shows how to construct a GET request to retrieve tags associated with an S3 bucket. Replace `[region]` and `YOUR_TELNYX_API_KEY` with your specific details. ```http GET /versionedbucket?tagging=null HTTP/1.1 Host: [region].telnyxcloudstorage.com Accept: text/xml x-amz-acl: private X-Amz-Date: 20230927T182418Z Authorization: AWS4-HMAC-SHA256 Credential=YOUR_TELNYX_API_KEY/20230927/test/execute-api/aws4_request, SignedHeaders=accept;host;x-amz-acl;x-amz-date, Signature=94c986f7bf15c5ce04a1cdd83c0ee058d78eabfb8d0bab35caac92b965490b96 ``` -------------------------------- ### Function Configuration File Example Source: https://telnyx.com/llms/edge-full.txt Define function name, runtime language, environment variables, and build settings in the `func.toml` file. ```toml [ edge_compute] func_name = "my-webhook" language = "python" [env_vars] LOG_LEVEL = "info" API_ENDPOINT = "https://api.example.com" [build] # Optional build settings entry_point = "main.py" ``` -------------------------------- ### Get Bucket ACL Response Example Source: https://telnyx.com/llms/edge/storage-full.txt An example XML response detailing the Access Control List (ACL) for a bucket, including owner information and grants for different grantees. ```xml 27784a49-1f14-4209-a58d-27fe905efe58 27784a49-1f14-4209-a58d-27fe905efe58 http://acs.amazonaws.com/groups/global/AllUsers READ 27784a49-1f14-4209-a58d-27fe905efe58 27784a49-1f14-4209-a58d-27fe905efe58 FULL_CONTROL ``` -------------------------------- ### Java Function Cold Start Initialization Source: https://telnyx.com/llms/edge/compute-full.txt Shows how to perform global initialization in Java using Quarkus Funqy, setting up a database connection pool that is reused for subsequent requests within the same container. ```java import io.quarkus.funqy.Funq; import jakarta.inject.Inject; import io.agroal.api.AgroalDataSource; import java.sql.ResultSet; import java.util.*; public class Function { @Inject AgroalDataSource dataSource; @Funq public List> getUsers() throws Exception { try (var conn = dataSource.getConnection(); var stmt = conn.createStatement(); var rs = stmt.executeQuery("SELECT * FROM users")) { List> users = new ArrayList<>(); var meta = rs.getMetaData(); int cols = meta.getColumnCount(); while (rs.next()) { Map row = new HashMap<>(); for (int i = 1; i <= cols; i++) { row.put(meta.getColumnName(i), rs.getObject(i)); } users.add(row); } return users; } } } ``` -------------------------------- ### JavaScript SDK KV Get Example Source: https://telnyx.com/llms/edge/storage-full.txt Example of retrieving a value from KV storage using the upcoming Telnyx JavaScript SDK. Requires the Telnyx API key to be set. ```javascript import Telnyx from 'telnyx'; const client = new Telnyx({ apiKey: process.env.TELNYX_API_KEY }); // Get a value const value = await client.storage.kvs.keys.get("kv-abc123", "user:123"); ``` -------------------------------- ### Install Sixfab Cellular IoT Library Source: https://telnyx.com/llms/wireless-full.txt Clone the Sixfab library repository, navigate to the directory, and install the necessary scripts using setup.py. ```bash cd Sixfab_RPi_CellularIoT_Library sudo python3 setup.py install ``` -------------------------------- ### Go Unit Test for GET Request Source: https://telnyx.com/llms/edge/compute-full.txt Write a Go unit test to verify the handler for GET requests. This example uses the net/http/httptest package to simulate requests and responses. ```go // handler_test.go package function import ( "net/http" "net/http/httptest" "strings" "testing" ) func TestHandleGET(t *testing.T) { req := httptest.NewRequest("GET", "/", nil) rec := httptest.NewRecorder() Handle(rec, req) if rec.Code != 200 { t.Errorf("Expected 200, got %d", rec.Code) } } ``` -------------------------------- ### Install Go on Linux (Debian/Ubuntu) Source: https://telnyx.com/llms/development-full.txt Install the Go programming language on Debian/Ubuntu-based Linux distributions using apt. ```bash sudo apt install golang-go ``` -------------------------------- ### Retrieve Resources with GET Source: https://telnyx.com/llms/development-full.txt Use GET requests to fetch information about resources without modifying them. Examples include retrieving messaging profiles, call details, or storage buckets. ```bash GET /v2/messaging_profiles ``` ```bash GET /v2/calls/{call_id} ``` ```bash GET /v2/storage/buckets ``` -------------------------------- ### Run setup script to create .env file Source: https://telnyx.com/llms/calling/voice-api-full.txt Executes the setup script to generate a .env file in the specified directory, which will be used to store environment variables. ```bash python setup.py ``` -------------------------------- ### Go Example: Telnyx LLM Storage Operations Source: https://telnyx.com/llms/edge/storage-full.txt This comprehensive Go program demonstrates how to interact with Telnyx's cloud storage. It requires setting the TELNYX_API_KEY environment variable. The code initializes an S3 client, creates a bucket, uploads objects, lists them, downloads an object, and generates a presigned URL. ```Go package main import ( "bytes" "context" crand "crypto/rand" "encoding/json" "fmt" "io" "log" "math/rand" "net/http" "os" "time" "github.com/aws/aws-sdk-go-v2/aws" "github.com/aws/aws-sdk-go-v2/config" "github.com/aws/aws-sdk-go-v2/service/s3" ) func main() { ctx := context.Background() randSeq := rand.Intn(1_000_000) telnyxAPIKey := os.Getenv("TELNYX_API_KEY") if telnyxAPIKey == "" { log.Fatal("TELNYX_API_KEY environment variable not set") } region := "us-central-1" endpoint := fmt.Sprintf("https://%s.telnyxcloudstorage.com", region) // 1. Initializing the AWS client with specific options cfg, err := config.LoadDefaultConfig(ctx, config.WithRegion(region), config.WithCredentialsProvider(aws.CredentialsProviderFunc( func(context.Context) (aws.Credentials, error) { return aws.Credentials{ AccessKeyID: telnyxAPIKey, // Use your Telnyx API key SecretAccessKey: telnyxAPIKey, // Optional, can be left blank }, nil })), config.WithS3UseARNRegion(true), config.WithS3DisableExpressAuth(true), config.WithS3DisableMultiRegionAccessPoints(true), ) if err != nil { log.Fatalf("s3 configuration error: %v", err) } cfg.BaseEndpoint = aws.String(endpoint) s3Client := s3.NewFromConfig(cfg) log.Printf("Created S3 client for region (%v) and endpoint (%v)", cfg.Region, *cfg.BaseEndpoint) // test-bucket-us-central-1.23-34.randomNumber ts := time.Now() bucketName := fmt.Sprintf("%v-%s.%v-%v.%v", "test-bucket", region, ts.Hour(), ts.Minute(), randSeq) log.Printf("Generated bucket name: %q", bucketName) // Create two objects in memory objs := make(map[string]*bytes.Reader) noFiles := 2 for i := 0; i < noFiles; i++ { ct := make([]byte, 1024*32) // fill with random data if _, err := crand.Read(ct); err != nil { log.Fatalf("failed to read random data: %v", err) } objName := fmt.Sprintf("%v.txt", i) objs[objName] = bytes.NewReader(ct) } // 2. Create a bucket _, err = s3Client.CreateBucket(ctx, &s3.CreateBucketInput{ Bucket: aws.String(bucketName), }) if err != nil { log.Fatalf("unable to create bucket: %v", err) } log.Printf("Created bucket: %v", bucketName) // 3. Upload the two objects into the newly created bucket for objName, body := range objs { if _, err = s3Client.PutObject(ctx, &s3.PutObjectInput{ Bucket: aws.String(bucketName), Key: aws.String(objName), Body: body, }); err != nil { log.Fatalf("unable to upload file (%v): %v", objName, err) } log.Printf("Uploaded file (%v) to bucket: %v", objName, bucketName) } // 4. List objects in the bucket listObj, err := s3Client.ListObjectsV2(ctx, &s3.ListObjectsV2Input{ Bucket: aws.String(bucketName), }) if err != nil { log.Fatalf("unable to list objects: %v", err) } for _, item := range listObj.Contents { log.Printf("Listed object: %v", *item.Key) } // 5. Download the object first out, err := s3Client.GetObject(ctx, &s3.GetObjectInput{ Bucket: aws.String(bucketName), Key: aws.String("1.txt"), }) if err != nil { log.Fatalf("unable to download object: %v", err) } defer out.Body.Close() dl, err := io.ReadAll(out.Body) if err != nil { log.Fatalf("unable to read object data: %v", err) } log.Printf("downloaded file size: %d", len(dl)) // 6. Create a presigned URL for the first file url := fmt.Sprintf("https://api.telnyx.com/v2/storage/buckets/%v/%v/presigned_url", bucketName, "1.txt") req, err := http.NewRequest(http.MethodPost, url, bytes.NewReader([]byte(`{"TTL": 30}`))) if err != nil { log.Fatalf("unable to create presigned request: %v", err) } req.Header.Set("Authorization", "Bearer "+telnyxAPIKey) resp, err := http.DefaultClient.Do(req) if err != nil { log.Fatalf("unable to send presigned request: %v", err) } defer resp.Body.Close() if resp.StatusCode != http.StatusOK { b, _ := io.ReadAll(resp.Body) log.Fatalf("unexpected status code: %v | response: %s", resp.StatusCode, b) } type presignedURL struct { Data struct { Token string `json:"token"` ExpiresAt time.Time `json:"expires_at"` PresignedURL string `json:"presigned_url"` } `json:"data"` } var purl presignedURL if err := json.NewDecoder(resp.Body).Decode(&purl); err != nil { log.Fatalf("unable to decode presigned URL: %v", err) } log.Printf("Generated presigned URL: %v", purl.Data.PresignedURL) // 7. Download the file again using the presigned URL res, err := http.Get(purl.Data.PresignedURL) if err != nil { log.Fatalf("unable to download presigned URL: %v", err) } defer res.Body.Close() log.Printf("Downloaded presigned URL status code: %v", res.StatusCode) } ``` -------------------------------- ### Get Bucket Location Response Source: https://telnyx.com/llms/edge/storage-full.txt Example XML response indicating the region of the bucket. ```xml us-east-1 ``` -------------------------------- ### Basic Prompt Example Source: https://telnyx.com/llms/calling/texml-full.txt A simple TeXML example to prompt the caller with options. ```xml Press 1 for sales, press 2 for support. ``` -------------------------------- ### Initiate a Voice Call to a SIP URI Source: https://telnyx.com/llms/calling/webrtc-full.txt This example shows how to initiate a call to a SIP address. This is useful for interoperating with other SIP-based systems. The `client` must be initialized. ```javascript const call = client.newCall({ destinationNumber: 'sip:agent@customer.sip.telnyx.com', audio: true, }); ``` -------------------------------- ### Numeric Field Value Range Example Source: https://telnyx.com/llms/ai/assistants-full.txt Demonstrates how to specify a value range for numeric fields to guide the AI model and ensure data consistency. This example defines an urgency score. ```text Description: Urgency score from 1-5, where 1 is low priority and 5 is critical/urgent ``` -------------------------------- ### Get Object Source: https://telnyx.com/llms/edge/storage.txt Guide on accessing objects in Telnyx Cloud Storage. Utilize API to retrieve objects. ```APIDOC ## GET /object ### Description Retrieves an object from Telnyx Cloud Storage. ### Method GET ### Endpoint /object ### Parameters #### Query Parameters - **key** (string) - Required - The key of the object to retrieve. ### Response #### Success Response (200) - **body** (binary) - The content of the object. ``` -------------------------------- ### Initialize Node.js Project Source: https://telnyx.com/llms/calling-full.txt Initialize a new Node.js project and install necessary packages for the call tracking application. ```bash mkdir call-tracking cd call-tracking npm init ``` ```bash npm i dotenv npm i express npm i telnyx ``` -------------------------------- ### Running the IVR Demo Server with Bundler Source: https://telnyx.com/llms/calling/voice-api-full.txt Use this command to start the IVR demo server if you are managing dependencies with a Gemfile. Ensure your application is accessible from the internet using a tunneling service. ```bash bundle exec ruby ivr_demo_server.rb ``` -------------------------------- ### Start Noise Suppression with Krisp Engine and Specific Model Source: https://telnyx.com/llms/calling-full.txt This example demonstrates starting noise suppression with the Krisp engine, specifying a particular model and suppression level. The 'krisp-nlsv-f4t-12k-v1.ef' model is suitable for narrowband telephony. ```bash curl --request POST \ --url https://api.telnyx.com/v2/calls/${call_control_id}/actions/suppression_start \ --header 'Accept: application/json' \ --header 'Authorization: Bearer ***' \ --header 'Content-Type: application/json' \ --data '{ "direction": "inbound", "noise_suppression_engine": "Krisp", "noise_suppression_engine_config": { "model": "krisp-nlsv-f4t-12k-v1.ef", "suppression_lev": 80 } }' ``` -------------------------------- ### Get record type metadata Source: https://telnyx.com/llms/other-apis/account-billing-full.txt Returns detailed metadata for a specific record type, including relationships and examples. ```APIDOC ## GET /v2/session_analysis/metadata/{record_type} ### Description Returns detailed metadata for a specific record type, including relationships and examples. ### Method GET ### Endpoint /v2/session_analysis/metadata/{record_type} ### Parameters #### Path Parameters - **record_type** (string) - Required - The name of the record type to get metadata for. ### Response #### Success Response (200) - **data** (object) - An object containing detailed metadata for the record type. - **name** (string) - The name of the record type. - **description** (string) - A description of the record type. - **query_parameters** (array) - An array of supported query parameters. - **name** (string) - The name of the query parameter. - **type** (string) - The data type of the parameter. - **required** (boolean) - Whether the parameter is required. - **fields** (array) - An array of fields within the record type. - **name** (string) - The name of the field. - **type** (string) - The data type of the field. - **description** (string) - A description of the field. - **relationships** (object) - An object describing relationships to other record types. - **examples** (object) - Example data for the record type. #### Response Example { "data": { "name": "call", "description": "Details about a single call leg.", "query_parameters": [ {"name": "call_id", "type": "string", "required": true} ], "fields": [ {"name": "call_id", "type": "string", "description": "Unique identifier for the call."}, {"name": "start_time", "type": "datetime", "description": "Timestamp when the call started."} ], "relationships": { "next_leg": {"type": "call", "description": "The next leg of the call, if any."} }, "examples": { "call_id": "a1b2c3d4-e5f6-7890-1234-567890abcdef", "start_time": "2023-10-26T10:00:00Z" } } } ``` -------------------------------- ### Run Telnyx Cloud Storage Example Source: https://telnyx.com/llms/edge/storage-full.txt Execute the Go program to interact with Telnyx Cloud Storage. Ensure your TELNYX_API_KEY is set as an environment variable. ```bash TELNYX_API_KEY=_YOUR_API_KEY go run main.go ``` -------------------------------- ### Get Bucket Tagging Response Source: https://telnyx.com/llms/edge/storage-full.txt This is an example XML response when retrieving tags for an S3 bucket. It lists the dimensions and their corresponding values. ```xml dimention_1 value_1 dimention_2 value_2 ``` -------------------------------- ### Install State Adapter Source: https://telnyx.com/llms/messaging-full.txt Install a state adapter for managing chat state. Use `@chat-adapter/state-memory` for development or `@chat-adapter/state-redis` for production. ```bash pnpm add @chat-adapter/state-memory ``` -------------------------------- ### AI Assistant Instructions Example Source: https://telnyx.com/llms/messaging-full.txt Define the behavior and guidelines for your AI assistant. This text will guide the AI's responses and tone. ```text You are a helpful customer support agent for [Your Company]. Guidelines: - Be friendly and professional - Keep responses concise (under 160 characters when possible) - If you don't know something, offer to connect them with a human - Always greet new customers warmly ``` -------------------------------- ### Go KV Read/Write Example Source: https://telnyx.com/llms/edge/compute-full.txt Illustrates KV storage operations in Go, including setting up HTTP requests and handling JSON responses. Ensure KV_MY_STORE_ID and TELNYX_API_KEY environment variables are configured. ```go var ( kvID = os.Getenv("KV_MY_STORE_ID") apiKey = os.Getenv("TELNYX_API_KEY") ) func kvGet(key string) (string, error) { url := fmt.Sprintf("https://api.telnyx.com/v2/storage/kvs/%s/keys/%s", kvID, key) req, _ := http.NewRequest("GET", url, nil) req.Header.Set("Authorization", "Bearer "+apiKey) resp, err := http.DefaultClient.Do(req) if err != nil { return "", err } defer resp.Body.Close() if resp.StatusCode == 404 { return "", nil } var result struct { Value string `json:"value"` } json.NewDecoder(resp.Body).Decode(&result) return result.Value, nil } func kvPut(key, value string, ttl int) error { url := fmt.Sprintf("https://api.telnyx.com/v2/storage/kvs/%s/keys/%s", kvID, key) body, _ := json.Marshal(map[string]interface{}{"value": value, "ttl": ttl}) req, _ := http.NewRequest("PUT", url, bytes.NewReader(body)) req.Header.Set("Authorization", "Bearer "+apiKey) req.Header.Set("Content-Type", "application/json") _, err := http.DefaultClient.Do(req) return err } func handler(w http.ResponseWriter, r *http.Request) { cached, _ := kvGet("user:123") if cached != "" { w.Header().Set("Content-Type", "application/json") fmt.Fprint(w, cached) return } userData := `{"id": 123, "name": "Alice"}` kvPut("user:123", userData, 3600) w.Header().Set("Content-Type", "application/json") fmt.Fprint(w, userData) } ``` -------------------------------- ### Get Object Tagging Source: https://telnyx.com/llms/edge/storage.txt Guide to accessing object tags in Telnyx Cloud Storage. Utilize API to retrieve object tags. ```APIDOC ## GET /object/tagging ### Description Retrieves the tags associated with an object in Telnyx Cloud Storage. ### Method GET ### Endpoint /object/tagging ### Parameters #### Query Parameters - **key** (string) - Required - The key of the object whose tags to retrieve. ### Response #### Success Response (200) - **body** (json) - A JSON object containing the tags for the object. ``` -------------------------------- ### Toll-Free Verification Webhook Source: https://telnyx.com/llms/messaging-full.txt Set up webhooks to get notified when the Toll-Free Verification review completes. This example demonstrates how to handle the `toll_free_verification.status_update` event. ```APIDOC ## Toll-Free Verification Webhook Handler ### Description This code snippet demonstrates how to set up a webhook endpoint to receive and process status updates for Toll-Free Verifications. It specifically handles the `toll_free_verification.status_update` event. ### Language Python (Flask) ### Endpoint `/webhooks/toll-free` (POST) ### Event Handling - **Event Type**: `toll_free_verification.status_update` - **Payload Fields**: - **status** (string): The new status of the verification (e.g., `verified`, `rejected`). - **id** (string): The ID of the verification request. - **rejectionReason** (string) - Optional: Provided if the status is `rejected`. ### Request Example (Python) ```python from flask import Flask, request, jsonify app = Flask(__name__) @app.route("/webhooks/toll-free", methods=["POST"]) def handle_toll_free_webhook(): event = request.json event_type = event.get("data", {}).get("event_type", "") if event_type == "toll_free_verification.status_update": payload = event["data"]["payload"] status = payload["status"] request_id = payload["id"] if status == "verified": print(f"✅ Verification {request_id} approved!") # Enable full messaging for this number elif status == "rejected": reason = payload.get("rejectionReason", "No reason provided") print(f"❌ Verification {request_id} rejected: {reason}") # Alert team, prepare resubmission return jsonify({"status": "ok"}), 200 ``` ### Response - **status** (string): `ok` - Indicates the webhook was received successfully. ``` -------------------------------- ### Clone and Navigate to Restaurant Agent Source: https://telnyx.com/llms/ai/livekit-full.txt Clone the example agents repository and change the directory to the restaurant agent. This sets up the necessary files for deployment. ```bash git clone https://github.com/team-telnyx/telnyx-livekit-agent-examples.git cd telnyx-livekit-agent-examples/restaurant ``` -------------------------------- ### Get Bucket Versioning Response Source: https://telnyx.com/llms/edge/storage-full.txt Example XML response indicating the versioning status of an S3 bucket. The response will show 'Enabled' or 'Disabled'. ```xml Enabled Disabled ``` -------------------------------- ### Get Bucket Tagging Source: https://telnyx.com/llms/edge.txt Understand bucket tagging in Telnyx Cloud Storage with example API calls. Retrieve all tags associated with a bucket. ```APIDOC ## GET /v1/storage/buckets/{bucket_name}/tagging ### Description Retrieves all tags associated with a specified bucket in Telnyx Cloud Storage. ### Method GET ### Endpoint /v1/storage/buckets/{bucket_name}/tagging ### Parameters #### Path Parameters - **bucket_name** (string) - Required - The name of the bucket to retrieve tags for. ### Response #### Success Response (200 OK) - **tagging** (object) - The tags associated with the bucket. #### Response Example { "tagging": { "tag_set": [ { "key": "environment", "value": "production" }, { "key": "project", "value": "api" } ] } } ```