Open Forum

 View Only
  • 1.  PowerBI / PowerQuery with 8x8 APIs

    Posted 12-14-2023 14:53

    Howdy,

    I have tried to add the PostCallSurvey API request into PowerBI and Query without success. I get the following error message. The same credentials work fine in Postman.

    "we couldn't authenticate with the credentials provided"
    "A web API key can only be specified when a web API key name is provided"

    I also get the same above errors replicating this API call in PowerBI/Query but not in Postman. https://support.8x8.com/contact-center/8x8-contact-center/developers/8x8-contact-center-statistics-reporting-api#List_all_agents

    Has anyone successfully obtained data via PBI/PQ? If so was there a trick to authenticate?

    Cheers



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


  • 2.  RE: PowerBI / PowerQuery with 8x8 APIs

    Posted 12-15-2023 01:12

    I only have a rough POC in PBI but happy to show my progress so far;

    lbbdtoken:
    let
        url = "https://api.8x8.com/oauth/v2/token",
        clientId = "client id",
        secret = "secret",
        base64Encoded = Binary.ToText(Text.ToBinary(clientId & ":" & secret), BinaryEncoding.Base64),
        headers = [
            #"Content-Type" = "application/x-www-form-urlencoded",
            #"Authorization" = "Basic " & base64Encoded
        ],
        body = "grant_type=client_credentials",
        options = [
            Headers = headers,
            Content = Text.ToBinary(body),
            ManualStatusHandling = {400, 401, 403, 404, 500}
        ],
        response = Web.Contents(url, options),
        jsonResponse = Json.Document(response),
        #"Converted to Table" = Record.ToTable(jsonResponse),
        Value1 = #"Converted to Table"{0}[Value]
    in
        Value1

    -----------------------------------------------------------------------------------------------------------------------------------

    Example realtime report:

    let
    testToken = lbbdtoken,
        dataUrl = "https://api.8x8.com/eu/analytics/cc/v5/realtime-metrics/queues",
        dataOptions = [
            Headers = [
                Authorization = "Bearer "& testToken
            ]
        ],
        source = Web.Contents(dataUrl, dataOptions),
        #"Imported JSON" = Json.Document(source,65001),
        #"Converted to Table" = Table.FromList(#"Imported JSON", Splitter.SplitByNothing(), null, null, ExtraValues.Error),
        #"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table", "Column1", {"id", "name", "metrics"}, {"Column1.id", "Column1.name", "Column1.metrics"}),
        #"Expanded Column1.metrics" = Table.ExpandListColumn(#"Expanded Column1", "Column1.metrics"),
        #"Expanded Column1.metrics1" = Table.ExpandRecordColumn(#"Expanded Column1.metrics", "Column1.metrics", {"key", "value"}, {"Column1.metrics.key", "Column1.metrics.value"})
    in
        #"Expanded Column1.metrics1"

    ---------------------------------------------------------------------------------------------------------------------------------------

    This works successfully; but really what I want is a few million rows from Historical interaction details and I only do this as a hobby so the pagination restrictions kill me.

    For post call data - are you aware you need to request the additional token from 8x8 helpdesk? Not quite sure how that fits in as we ended up paying a supplier to do the reporting on our PCS and they built the API's into their system.



    ------------------------------
    David
    ------------------------------



  • 3.  RE: PowerBI / PowerQuery with 8x8 APIs

    Posted 12-17-2023 13:02

    That's a brilliant start, thanks David!!

    Yes, I have the PCS Api Key. I am signing up for a 2 week Precog trial today, they have connectors for 8x8 <> PowerBI out of the box... apparently. I'll let you know how it goes!



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



  • 4.  RE: PowerBI / PowerQuery with 8x8 APIs

    Posted 04-24-2024 12:56

    Hi @Ben Fischer - did you have any luck with this? I am in the same boat currently. 



    ------------------------------
    Justin Mangano
    ------------------------------



  • 5.  RE: PowerBI / PowerQuery with 8x8 APIs

    Posted 04-24-2024 16:01

    I have had much progress and luck. There is two reports I need to get working then I will share my entire workspace with the group, And hope it can be improved. Expect it next week!



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



  • 6.  RE: PowerBI / PowerQuery with 8x8 APIs

    Posted 04-24-2024 17:57

    Sample... 

    Surfaced post call survey transscriptions

    Before I share, I am fixing;

    • variables for incremental refresh
    • auto fall back for report granularity (if you request week and that won't work, it errors, so trying to incorporate a let &granularity&, then none, day, week, month)
    • ticked logged for broken https://api.8x8.com/qm/ API. Not returning all records.
    • trying to get detailed interactions report loaded
    • data types so that they can be reported on correctly

    Before using, you will need to

    • Update all reports and APIs for your region (just an edit per query)
    • Update your API and KEY for the GetBearer functions

    Big thanks to Scott for assistance along the way!



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



  • 7.  RE: PowerBI / PowerQuery with 8x8 APIs

    Posted 04-24-2024 19:41
    Edited by Ben Fischer 04-24-2024 19:49

    FWIW, my queries are very inefficient. PowerBI self taught and pet project!

    If someone would like to assist in optimizing before releasing template online please DM me for a collab. I am sure 8x8 would not appreciate their APIs getting hammered by inefficient queries :)



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



  • 8.  RE: PowerBI / PowerQuery with 8x8 APIs

    Posted 04-25-2024 00:10

    Looks great Ben, did you connect to the API's through Precog?



    ------------------------------
    Matthew Grant
    ------------------------------



  • 9.  RE: PowerBI / PowerQuery with 8x8 APIs

    Posted 04-25-2024 01:30

    These are all direct to 8x8. I did look at precog, but our data team is about 12 months away from a massive upgrade so I did this in my own time.



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



  • 10.  RE: PowerBI / PowerQuery with 8x8 APIs

    Posted 04-25-2024 03:48

    Great, I look forward to seeing the template! I wish I could help you with the optimisation but as a self taught power query user I'm still trying to optimise my own queries :-)



    ------------------------------
    Matthew Grant
    ------------------------------