Open Forum

 View Only
  • 1.  Cloud Storage Service API

    Posted 12-07-2023 20:14
    Edited by Ben Fischer 12-07-2023 20:15

    Just thought I'd share my little adventure using the API to "attempt" to get transcribed post call survey voice comments. I was successful in that I got the comments, but the result is not usable by any means. This may help other users or spark some interest in the API. 

    I had an Ops Manager ask me if we could get Transcribed voice comments so that they could be shared with the team to celebrate wins. CE allows comments to be played but not shown. At the time QM did not have the voice comments transcribed either. The literature at https://developer.8x8.com/analytics/docs/cloud-storage-service-objects#post-call-survey-voice-comment-recording-transcription says it's possible so Let's Do It!

    Step 1 - Generate API Key in Admin Console for product "Call recordings & Storage"

    Step 2 - Generate oAuth Token

    curl --location 'https://api.8x8.com/oauth/v2/token' \
    --header 'Content-type: application/x-www-form-urlencoded' \
    --header 'Authorization: Basic {using the API key and secret }' \
    --data-urlencode 'grant_type=client_credentials'

    This returns the access_token for ongoing requests

    Step 3 Find the Objects to download!

    To prove a point and not mess around with criteria I downloaded EVERY VOICE TRANSCRIPTION on record. Nice. 

    curl --location --request GET 'https://api.8x8.com/storage/ap/v3/objects?filter=type%3D%3Dtranscription%3BsourceObjectType%3D%3Dvoicecommentrecording&sortField=createdTime&sortDirection=ASC&pageKey=0&limit=4000' \ --header 'Accept: application/json' \ --header 'Authorization: Bearer {access_token_from_above}' \ --header 'Content-Type: application/json' \ --data '{ "lastPage": true, "pageKey": 200, "pageSize": 900, "content": [] }'

    This gave me about 3500 records! Wooo but this data is unusable. I was hoping I would see the transcription here, but we need to get that in another request using the ID below.

    {
                "id""f2b44d0e-7a7b-44d0-9165-xxx",
                "type""transcription",
                "mimeType""application/json",
                "objectName""xxx.json",
                "checksumType""MD5",
                "checksum""xxx",
                "customerId""xxx",
                "userId""xxx",
                "storedBytes"2870,
                "createdTime""2023-12-08T04:02:17",
                "updatedTime""2023-12-08T04:02:19",
                "objectState""AVAILABLE",
                "bucketId""xxx",
                "tags": [
                    {
                        "key""pcsId",
                        "value""xxx"
                    },
                    {
                        "key""callId",
                        "value""xxx"
                    },
                    {
                        "key""result",
                        "value""ok"
                    },
                    {
                        "key""agentId",
                        "value""xxx"
                    },
                    {
                        "key""duration",
                        "value""13"
                    },
                    {
                        "key""language",
                        "value""en-AU"
                    },
                    {
                        "key""provider",
                        "value""whisper"
                    },
                    {
                        "key""sourceId",
                        "value""xxx"
                    },
                    {
                        "key""tenantId",
                        "value""xxx"
                    },
                    {
                        "key""sourceObjectType",
                        "value""voicecommentrecording"
                    },
                    {
                        "key""pcsQuestionNumber",
                        "value""3"
                    }
                ],
                "shared"false
            }

    So Step 4 Download the metadata!

    curl --location 'https://api.8x8.com/storage/ap/v3/objects/ID_FROM_ABOVE/content?presignUrl=false' \
    --header 'accept: application/json' \
    --header 'authorization: Bearer access_token_from_above' \

    and we get the transcription!

        "results": [
            {
                "words": [
                    {
                        "end"7.019999980926514,
                        "start"0.5,
                        "word"""
                    },
                    {
                        "end"7.019999980926514,
                        "start"0.5,
                        "word""Yeah,"
                    },
                    {
                        "end"7.019999980926514,
                        "start"0.5,
                        "word""the"
                    },
                    {
                        "end"7.019999980926514,
                        "start"0.5,
                        "word""agent"
                    },
                    {
                        "end"7.019999980926514,
                        "start"0.5,
                        "word""are"
                    },
                    {
                        "end"7.019999980926514,
                        "start"0.5,
                        "word""he"
                    },
                    {
                        "end"7.019999980926514,
                        "start"0.5,
                        "word""really"
                    },
                    {
                        "end"7.019999980926514,
                        "start"0.5,
                        "word""helped"
                    },
                    {
                        "end"7.019999980926514,
                        "start"0.5,
                        "word""me"
                    },
                    {
                        "end"7.019999980926514,
                        "start"0.5,
                        "word""out"
                    },
                    {
                        "end"7.019999980926514,
                        "start"0.5,
                        "word""with"
                    },
                    {
                        "end"7.019999980926514,
                        "start"0.5,
                        "word""whatever"
                    },
                    {
                        "end"7.019999980926514,
                        "start"0.5,
                        "word""needed"
                    },
                    {
                        "end"7.019999980926514,
                        "start"0.5,
                        "word""to"
                    },
                    {
                        "end"7.019999980926514,
                        "start"0.5,
                        "word""be"
                    },
                    {
                        "end"7.019999980926514,
                        "start"0.5,
                        "word""sorted"
                    },
                    {
                        "end"7.019999980926514,
                        "start"0.5,
                        "word""out."
                    },
                    {
                        "end"7.019999980926514,
                        "start"0.5,
                        "word""Thank"
                    },
                    {
                        "end"7.019999980926514,
                        "start"0.5,
                        "word""you."
                    }
                ],
                "channel"0,
                "start"0.5,
                "end"7.019999980926514,
                "confidence"0.642621636390686,
                "transcript"" Yeah, the agent are he really helped me out with whatever needed to be sorted out. Thank you.",
                "tags"null
            }
        ],
        "channels"1,
        "provider""whisper",
        "language""en-AU",
        "tags"null,
        "duration"8
    }
    So while that was a fun learning experience, it doesn't really provide anything useful. What we really needed was a dump of all transcriptions and a reference to the interaction so the Agent/Supervisor can follow it up if required. The data is available in QM, but you need to "Export Interaction" one at a time and get them in json format - if these could be added to an excel dump... amazing....  or even if they could be displayed in a column in the Interaction search screen?
    The search continues.



    ------------------------------
    Ben Fischer
    ------------------------------