Scripted Dashboard Datasource

I am using InfluxDB as a datasource for my grafana dashboards, but now I am trying to create some scripted dashboards for use on my front-end, without any luck so far. Getting the following error

‘Script Error Please make sure it exists and returns a valid dashboard’

I guess the long and short of it is, how do I create a scripted dashboard with an InfluxDB datasource?

I do it using