Skip to content

Commit 8381b50

Browse files
committed
the new create transcript function
1 parent a737548 commit 8381b50

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

voice/transcription.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,16 @@ func (trans *Transcription) Contents(client *messagebird.Client) (string, error)
9292
b, err := ioutil.ReadAll(resp.Body)
9393
return string(b), err
9494
}
95+
96+
// CreateTranscription creates a transcription request for an existing recording
97+
func CreateTranscription(client *messagebird.Client, callID string, legID string, recordingID string, language string) (trans *Transcription, err error) {
98+
var body struct{}
99+
path := fmt.Sprintf("/calls/%s/legs/%s/recordings/%s/transcriptions", callID, legID, recordingID)
100+
var resp struct {
101+
Data []Transcription `json:"data"`
102+
}
103+
if err := client.Request(&resp, http.MethodPost, apiRoot+path, body); err != nil {
104+
return nil, err
105+
}
106+
return &resp.Data[0], nil
107+
}

0 commit comments

Comments
 (0)