jobisoft / quicktext

An extension for Thunderbird that lets you create templates that can be easily inserted into your own emails.
Mozilla Public License 2.0
184 stars 52 forks source link

Same URL work fine in Template but not in Script #400

Closed LionelBLANCHET closed 5 months ago

LionelBLANCHET commented 6 months ago

In a template, I use the syntax

[[URL=https://www.mywebsite.com/api/orders/9456?ws_key=NFKJDFKJFQD54DQ65F4Q6&output_format=JSON|get]]

and it works perfectly. When using the model I retrieve in text mode the JSON content returned by the url in the email composition window.

Now I write a script named "Prestashop" which calls the same URL.

var order = await this.mQuicktext.get_url(["https://www.mywebsite.com/api/orders/9456?ws_key=NFKJDFKJFQD54DQ65F4Q6&output_format=JSON|get"]); return order;

And in a template, I call this script via [[SCRIPT=Prestashop]] Problem: when I use this template (which itself calls the script), I get nothing in the email composition window

Where did I make a mistake?

Thunderbird version 115.9.0 / Quicktext version 5.14 / Windows 11 pro 23H2

LionelBLANCHET commented 5 months ago

Does anyone have an idea to retrieve the JSON result of a call to web services via a script? Thank you in advance for your assistance...

LionelBLANCHET commented 5 months ago

I finally found my error... In the Quicktext.get_url call you should not use a pipe but the following syntax:

var order = await this.mQuicktext.get_url(["https://www.mywebsite.com/api/orders/9456?ws_key=NFKJDFKJFQD54DQ65F4Q6&output_format=JSON","get"]);

If this helps anyone...