cancel
Showing results for 
Search instead for 
Did you mean: 

Nintex Xtensions: Outputting to an Audio File with WellSaidLabs Text-to-Speech

Nintex Employee
Nintex Employee
0 0 188

As our customers and partners continue to explore (xplore?) the wonderful world of the Nintex Xtensions framework, there are often questions about how to work/ interact with different components of a particular API. I'll be providing some additional examples of Xtensions over the next few blog posts that highlight how to accomplish different goals when building an Xtension, while hopefully also opening up some fun new options for actions within the tools! 

 

In today's blog post, I am going to walk through how to configure an action that outputs to an audio file. I'll be using the WellSaidLabs text-to-speech rendering service for this example, as it does a good job highlighting a common use case from our customers (converting text to audio) while maintaining an API that is clearcut for the example.  I've provided a video walkthrough as well that can be seen below:

 

 

First to start, we will need to examine the API. Looking at the documentation, the output is set as audio/mpeg. 

burked_1-1598376198381.png

 

For this example I am just going to cover the response for the configuration.  The full Xtension is available for download at the Nintex Gallery.

 

There are two important considerations for this example. First we need to make sure that we have the content type configured for what this specific action will produce. In swagger / open API you have the ability to specify what type of input (content type) the request(s) consumes and what type of output the response(s) will produce. This can be configured at either the request level or at the top level for the API. **Note**Multiple different content types can be configured for either the consumes or produces as may be available within an API**. 

 

Based on the API, we have configured the consumes (input) as application/json because it requires a json object for the API request to process.  For the output we have configured produces as audio-mpeg so the resulting output will be expecting an audio format.

 

 

 

 

        "consumes": [
          "application/json"
        ],
        "produces": [
          "audio/mpeg"
        ]

 

 

 

 

The next consideration will be the responses section for the request we have configured.  For this example we're just getting a file. There is no JSON / metadata associated. So for this example, we simply have to configure the output schema as a file:

 

 

 

 

        "responses": {
          "200": {
            "description": "Success",
            "schema": {
              "type": "file"
            }
          }
        }

 

 

 

 

Once configured this request will now output the response from the request as an audio file as described by the API. 

 

If you have any questions feel free to comment below!