- name
- telnyx-sip-integrations-go
- description
- Manage call recordings, media storage, Dialogflow integration, and external connections for SIP trunking. This skill provides Go SDK examples.
- metadata
- {"author":"telnyx","product":"sip-integrations","language":"go","generated_by":"telnyx-ext-skills-generator"}
<!-- Auto-generated from Telnyx OpenAPI specs. Do not edit. -->
# Telnyx Sip Integrations - Go
## Installation
```bash
go get github.com/team-telnyx/telnyx-go
```
## Setup
```go
import (
"context"
"fmt"
"os"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
client := telnyx.NewClient(
option.WithAPIKey(os.Getenv("TELNYX_API_KEY")),
)
```
All examples below assume `client` is already initialized as shown above.
## List all call recordings
Returns a list of your call recordings.
`GET /recordings`
```go
page, err := client.Recordings.List(context.TODO(), telnyx.RecordingListParams{})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
```
## Retrieve a call recording
Retrieves the details of an existing call recording.
`GET /recordings/{recording_id}`
```go
recording, err := client.Recordings.Get(context.TODO(), "recording_id")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", recording.Data)
```
## Delete a call recording
Permanently deletes a call recording.
`DELETE /recordings/{recording_id}`
```go
recording, err := client.Recordings.Delete(context.TODO(), "recording_id")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", recording.Data)
```
## Delete a list of call recordings
Permanently deletes a list of call recordings.
`POST /recordings/actions/delete`
```go
err := client.Recordings.Actions.Delete(context.TODO(), telnyx.RecordingActionDeleteParams{
IDs: []string{"428c31b6-7af4-4bcb-b7f5-5013ef9657c1", "428c31b6-7af4-4bcb-b7f5-5013ef9657c2"},
})
if err != nil {
panic(err.Error())
}
```
## List all recording transcriptions
Returns a list of your recording transcriptions.
`GET /recording_transcriptions`
```go
recordingTranscriptions, err := client.RecordingTranscriptions.List(context.TODO())
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", recordingTranscriptions.Data)
```
## Retrieve a recording transcription
Retrieves the details of an existing recording transcription.
`GET /recording_transcriptions/{recording_transcription_id}`
```go
recordingTranscription, err := client.RecordingTranscriptions.Get(context.TODO(), "6a09cdc3-8948-47f0-aa62-74ac943d6c58")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", recordingTranscription.Data)
```
## Delete a recording transcription
Permanently deletes a recording transcription.
`DELETE /recording_transcriptions/{recording_transcription_id}`
```go
recordingTranscription, err := client.RecordingTranscriptions.Delete(context.TODO(), "6a09cdc3-8948-47f0-aa62-74ac943d6c58")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", recordingTranscription.Data)
```
## Retrieve a stored credential
Returns the information about custom storage credentials.
`GET /custom_storage_credentials/{connection_id}`
```go
customStorageCredential, err := client.CustomStorageCredentials.Get(context.TODO(), "connection_id")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", customStorageCredential.ConnectionID)
```
## Create a custom storage credential
Creates a custom storage credentials configuration.
`POST /custom_storage_credentials/{connection_id}`
```go
customStorageCredential, err := client.CustomStorageCredentials.New(
context.TODO(),
"connection_id",
telnyx.CustomStorageCredentialNewParams{
CustomStorageConfiguration: telnyx.CustomStorageConfigurationParam{
Backend: telnyx.CustomStorageConfigurationBackendGcs,
Configuration: telnyx.CustomStorageConfigurationConfigurationUnionParam{
OfGcs: &telnyx.GcsConfigurationDataParam{
Backend: telnyx.GcsConfigurationDataBackendGcs,
},
},
},
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", customStorageCredential.ConnectionID)
```
## Update a stored credential
Updates a stored custom credentials configuration.
`PUT /custom_storage_credentials/{connection_id}`
```go
customStorageCredential, err := client.CustomStorageCredentials.Update(
context.TODO(),
"connection_id",
telnyx.CustomStorageCredentialUpdateParams{
CustomStorageConfiguration: telnyx.CustomStorageConfigurationParam{
Backend: telnyx.CustomStorageConfigurationBackendGcs,
Configuration: telnyx.CustomStorageConfigurationConfigurationUnionParam{
OfGcs: &telnyx.GcsConfigurationDataParam{
Backend: telnyx.GcsConfigurationDataBackendGcs,
},
},
},
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", customStorageCredential.ConnectionID)
```
## Delete a stored credential
Deletes a stored custom credentials configuration.
`DELETE /custom_storage_credentials/{connection_id}`
```go
err := client.CustomStorageCredentials.Delete(context.TODO(), "connection_id")
if err != nil {
panic(err.Error())
}
```
## Retrieve stored Dialogflow Connection
Return details of the Dialogflow connection associated with the given CallControl connection.
`GET /dialogflow_connections/{connection_id}`
```go
dialogflowConnection, err := client.DialogflowConnections.Get(context.TODO(), "connection_id")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", dialogflowConnection.Data)
```
## Create a Dialogflow Connection
Save Dialogflow Credentiails to Telnyx, so it can be used with other Telnyx services.
`POST /dialogflow_connections/{connection_id}`
```go
dialogflowConnection, err := client.DialogflowConnections.New(
context.TODO(),
"connection_id",
telnyx.DialogflowConnectionNewParams{
ServiceAccount: map[string]any{
"type": "bar",
"project_id": "bar",
"private_key_id": "bar",
"private_key": "bar",
"client_email": "bar",
"client_id": "bar",
"auth_uri": "bar",
"token_uri": "bar",
"auth_provider_x509_cert_url": "bar",
"client_x509_cert_url": "bar",
},
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", dialogflowConnection.Data)
```
## Update stored Dialogflow Connection
Updates a stored Dialogflow Connection.
`PUT /dialogflow_connections/{connection_id}`
```go
dialogflowConnection, err := client.DialogflowConnections.Update(
context.TODO(),
"connection_id",
telnyx.DialogflowConnectionUpdateParams{
ServiceAccount: map[string]any{
"type": "bar",
"project_id": "bar",
"private_key_id": "bar",
"private_key": "bar",
"client_email": "bar",
"client_id": "bar",
"auth_uri": "bar",
"token_uri": "bar",
"auth_provider_x509_cert_url": "bar",
"client_x509_cert_url": "bar",
},
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", dialogflowConnection.Data)
```
## Delete stored Dialogflow Connection
Deletes a stored Dialogflow Connection.
`DELETE /dialogflow_connections/{connection_id}`
```go
err := client.DialogflowConnections.Delete(context.TODO(), "connection_id")
if err != nil {
panic(err.Error())
}
```
## List all External Connections
This endpoint returns a list of your External Connections inside the 'data' attribute of the response.
`GET /external_connections`
```go
page, err := client.ExternalConnections.List(context.TODO(), telnyx.ExternalConnectionListParams{})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
```
## Creates an External Connection
Creates a new External Connection based on the parameters sent in the request.
`POST /external_connections` — Required: `external_sip_connection`, `outbound`
```go
externalConnection, err := client.ExternalConnections.New(context.TODO(), telnyx.ExternalConnectionNewParams{
ExternalSipConnection: telnyx.ExternalConnectionNewParamsExternalSipConnectionZoom,
Outbound: telnyx.ExternalConnectionNewParamsOutbound{},
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", externalConnection.Data)
```
## Retrieve an External Connection
Return the details of an existing External Connection inside the 'data' attribute of the response.
`GET /external_connections/{id}`
```go
externalConnection, err := client.ExternalConnections.Get(context.TODO(), "id")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", externalConnection.Data)
```
## Update an External Connection
Updates settings of an existing External Connection based on the parameters of the request.
`PATCH /external_connections/{id}` — Required: `outbound`
```go
externalConnection, err := client.ExternalConnections.Update(
context.TODO(),
"id",
telnyx.ExternalConnectionUpdateParams{
Outbound: telnyx.ExternalConnectionUpdateParamsOutbound{
OutboundVoiceProfileID: "outbound_voice_profile_id",
},
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", externalConnection.Data)
```
## Deletes an External Connection
Permanently deletes an External Connection.
`DELETE /external_connections/{id}`
```go
externalConnection, err := client.ExternalConnections.Delete(context.TODO(), "id")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", externalConnection.Data)
```
## List all civic addresses and locations
Returns the civic addresses and locations from Microsoft Teams.
`GET /external_connections/{id}/civic_addresses`
```go
civicAddresses, err := client.ExternalConnections.CivicAddresses.List(
context.TODO(),
"id",
telnyx.ExternalConnectionCivicAddressListParams{},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", civicAddresses.Data)
```
## Retrieve a Civic Address
Return the details of an existing Civic Address with its Locations inside the 'data' attribute of the response.
`GET /external_connections/{id}/civic_addresses/{address_id}`
```go
civicAddress, err := client.ExternalConnections.CivicAddresses.Get(
context.TODO(),
"318fb664-d341-44d2-8405-e6bfb9ced6d9",
telnyx.ExternalConnectionCivicAddressGetParams{
ID: "id",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", civicAddress.Data)
```
## Update a location's static emergency address
`PATCH /external_connections/{id}/locations/{location_id}` — Required: `static_emergency_address_id`
```go
response, err := client.ExternalConnections.UpdateLocation(
context.TODO(),
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
telnyx.ExternalConnectionUpdateLocationParams{
ID: "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
StaticEmergencyAddressID: "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Data)
```
## List all phone numbers
Returns a list of all active phone numbers associated with the given external connection.
`GET /external_connections/{id}/phone_numbers`
```go
page, err := client.ExternalConnections.PhoneNumbers.List(
context.TODO(),
"id",
telnyx.ExternalConnectionPhoneNumberListParams{},
)
Ver no GitHub