@@ -3,7 +3,7 @@ import { Data, DataToSend, DeviceListItem } from "@tago-io/sdk/lib/types";
33
44import { parseTagoObject } from "../../lib/data.logic" ;
55import { fetchDeviceList } from "../../lib/fetch-device-list" ;
6- import { getDashboardByTagID } from "../../lib/find-resource" ;
6+ import { getAnalysisByTagID } from "../../lib/find-resource" ;
77import { RouterConstructorData } from "../../types" ;
88import { checkInAlertSet } from "./check-in-alerts" ;
99import { geofenceAlertCreate } from "./geofence-alert" ;
@@ -154,6 +154,7 @@ async function createAlert({ environment, scope }: RouterConstructorData) {
154154 if ( ! environment || ! scope ) {
155155 throw new Error ( "Missing parameters" ) ;
156156 }
157+ const resources = new Resources ( { token : environment . ACCOUNT_TOKEN } ) ;
157158 const organization_id = scope [ 0 ] . device ;
158159 await Resources . devices . sendDeviceData ( organization_id , { variable : "action_validation" , value : "#VAL.CREATING_ALERT#" , metadata : { type : "warning" } } ) ;
159160
@@ -221,7 +222,7 @@ async function createAlert({ environment, scope }: RouterConstructorData) {
221222 device_list = await getGroupDevices ( group_id , groupKey ) ;
222223 }
223224
224- const script_id = await getDashboardByTagID ( "alertTrigger" ) ;
225+ const script_id = await getAnalysisByTagID ( resources , "alertTrigger" ) ;
225226
226227 if ( ! action_sendto ?. value ) {
227228 throw "Missing action_sendto" ;
0 commit comments