Since Microsoft does not provide an example on how to use fetchXml queries with the Xrm.WebApi calls in JavaScript, we at Thrives feel the moral need to provide you at least one example.
This will be a very basic demonstration, but it will give you an idea on how this works.

Scenario

When opening an existing account record, I want an alert that says hello to all the contacts linked to this account.
I know, I don’t need a fetchXml query to achieve this functionality 😉

Implementation

Explanation

So we need to use the retrieveMultipleRecords method from Xm.WebApi.
The first parameter is the entity name from which you want to retrieve records.
The second parameter is your encoded fetchXml query, preceded by the string ?fetchXml=

In the successCallback you will get the response parameter to work with.
This response object contains an entities attribute, which is an array with the results of your query.
You can loop through this array and process the results in the same way as you are used to when using the retrieveMultipleRecords method without a fetchXml query.

Final result