Skip to content
View in the app

A better way to browse. Learn more.

The AVSIM Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

HTTP "GET " request from AAO to Say Intentions

Featured Replies

Hi there.,..Im trying to use this new feature of Sayintentions.ai with AAO , and am stuck ..I even enlisted help of chat GPT as this is a little out of my knowledge level to be honest 
this is what Im trying to do initially using a joystick button to test and then moving on to a variable when it works.. 
https://sayintentionsai.freshdesk.com/support/solutions/articles/154000233373-sayas-api-make-the-co-pilot-cabin-crew-atc-say-whatever-you-want
I can make it work from a web browser and cmd prompt, (voice triggers) but not AAO when I assign the test script to a button...no voice is heard ..any ideas? 
heres what GPT came up with 
'cmd /c "C:\\Windows\\System32\\curl.exe" --get --silent "https://apipri.sayintentions.ai/sapi/sayAs" --data "api_key=MYKEY&channel=INTERCOM1_IN&message=Cabin%20secure&rephrase=0"' · run

would appreciate any ideas...im sure its simple but its above my pay grade LOL 
thanks. !

  • Commercial Member
9 hours ago, wakevortex said:

would appreciate any ideas.

Check out the AAO manual, chapter where the lists with all the AAO commands are.

Particularly the commands "QUERYJSON" and "QUERYXML". Both will result in a GET request, the JSON/XML just describes the response format. I think that you can disregard that, since you don't care about the return value, right? Just try both to see which one works better

(QUERYXML:https://apipri.sayintentions.ai/sapi/sayAs?api_key=ghY6tFg11&channel=INTERCOM1&message=Weve rrived at the gate. Apologize to the passengers for being late.)

If this fails, write a Javascript-script in AAO. Sending XMLHttp GET requests from JS is easy enough, even an AI gets it right sometimes...

(WSH:javascript|AaoEntry)

function AaoEntry(){
let relxhttp = new XMLHttpRequest();
let relurl = encodeURI("https://apipri.sayintentions.ai/sapi/sayAs?api_key=ghY6tFg11&channel=INTERCOM1&message=Weve rrived at the gate. Apologize to the passengers for being late.");
relurl = relurl.replace(/\+/g, '%2B').replace(/&/g, '%26');
relxhttp.open("GET", relurl);
relxhttp.send();
}

 

Edit: be mindful that I can't test this, I don't have SI. This is all just theory.

Edited by Lorby_SI

LORBY-SI

  • Author

Thanks for the reply.... will take a look tomorrow...as mentioned I could get SI to generate voice from browser and cmd line, just not from AAO 
this was what worked from CMD. curl --get --silent "https://apipri.sayintentions.ai/sapi/sayAs" --data "api_key=MYKEY&channel=INTERCOM1_IN&message=Cabin%20secure&rephrase=0" 
again all a little out of my depth...  but will experiment with what you said ..

  • Commercial Member
24 minutes ago, wakevortex said:

just not from AAO 

Using the correct command, CURL will probably work too. The command would be "(EXEC:" in this case, see AAO manual. But doing it this way is really convoluted, compared to sending the call directly.

Edited by Lorby_SI

LORBY-SI

  • Commercial Member
25 minutes ago, wakevortex said:

again all a little out of my depth

Sorry, but I can only give general advice. As I said, I don't have Si nor do I intend to buy or use it. What I've written above are two technically correct ways of sending a GET request to an URL. I used the example from the website that you pointed at.

LORBY-SI

  • Author

Thanks for your great help... 
this worked beautifully  !

(QUERYXML:https://apipri.sayintentions.ai/sapi/sayAs?api_key=YOURKEYHERE&channel=INTERCOM1_IN&message=Cabin%20secure&rephrase=0)

 

appreciated as always
 

  • Author

Just following up on this.. now its working as expected, 

Is it possible to now trigger my working script from a sim variable in AAO...so for example
when Battery is turned on...it triggers a script (and therefore speaks)  ..
how would that be called from AAO rather than using a button..
any help appreciated 

 

  • Commercial Member
32 minutes ago, wakevortex said:

how would that be called from AAO rather than using a button..

Aircraft Automated Script

AAO manual, page 71 or thereabouts. Just keep in mind that this is not as easy to implement as it sounds. If you just do "when battery is on then trigger script", then the script will be triggered continuously for as long as the battery is on. This needs some serious thought, because you have to track the change in the battery state, not the state itself.

I usually do this with additional local helper LVars.
Example:

(A:ELECTRICAL MASTER BATTERY, Bool) s0 (L:MyBatteryState) != if{ 'Battery is ' l0 0 == if{ 'off' } els{ 'on' } scat (QUERYXML:https://apipri.sayintentions.ai/sapi/sayAs?api_key=YOURKEYHERE&channel=INTERCOM1_IN&message=%s1&rephrase=0) l0 (>L:MyBatteryState) }

Notes: You can add multiple of these snippets to the same autoscript. Keep the LVar names short. Keep the delay reasonable, it is probably enough to check the battery state every second (instead of 10 times per second).

There are some AAO testers who essentially rebuilt FS2Crew using the AAO "CONVERSATION" feature. I'm not sure if that will fit your bill though.

Edited by Lorby_SI

LORBY-SI

  • Commercial Member

Also: consider using a script file instead of the in-app scripts when you have more than one such use case. Files are much easier to edit, and you could use a macro for the QUERY (lot less typing involved).

Edited by Lorby_SI

LORBY-SI

  • Author

Thanks again 

yes seems indeed this is not as easy as I thought...will take a look at your suggestions.. 
not sure what you mean here "consider using a script file instead of the in-app scripts"?... how do I do that ?
there will be more than 1 use case ...I ideally wanted to basically use a change in variable state to trigger various announcements 
p71 of the manual is helpful... !  

 

EDIT...  your idea worked perfectly for this use case (battery on - trigger an announcement to start my VA logging program ) 

Going forward should I try to stick to that ?..the script file you suggested sounds interesting , but what I have seems to work really well ! 
appreciated  !

Edited by wakevortex

  • Commercial Member

The scriptfile would look like this, using a macro, saved to \Documents\LorbyAxisAndOhs Files\Scripts\yourfilenamehere.txt

<Macro Name="SIQUERY">(QUERYXML:https://apipri.sayintentions.ai/sapi/sayAs?api_key=YOURKEYHERE&channel=INTERCOM1_IN&message=%s1&rephrase=0)</Macro>
(A:ELECTRICAL MASTER BATTERY, Bool) s0 (L:MyBatteryState) != if{ 'Battery is ' l0 0 == if{ 'off' } els{ 'on' } scat @SIQUERY l0 (>L:MyBatteryState) }
...other checks and queries in each following line

And it would be called as (SCRIPTFILE:yourfilenamehere.txt|CACHE)

LORBY-SI

  • Author

Great... thanks again.... off to learn about script files then  LOL 🙂 

 

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.