DavidSoriano What you publish to flespi/rest/... must correspond the REST API call to trigger digital output. In your case it is setting called "setdigout_2"
You may go to device->settings->input/output->"Action command setdigout" and click on curl:connection to see REST API request format.
flespi/state/gw/devices/{id}/telemetry/... topic is read-only, you can't publish to it.