TeamDesk Knowledge Base & Support

   Home      FAQ      Forum      Idea Exchange      Ask a Question      My Stuff      Help   
  
Extended Response() function
Dear all,

To deal with the responses of call Actions, we have a 2 arguments Response function :
Response(textpath, type)
which extracts a value of the requested type at he location indicated by textpath from the answer received by the call URL.

I wish we had an extended 3 arguments Response() function:
Response(textpath, type, textsource)
which would extract a value of the requested type at the location indicated by textpath from textsource.

With some AI APIs (mistral.ai; openai.com) and probably others, you receive a JSON answer where the fields which actually interest are in a JSON structure stored in a text field ("content" in the below example).
ie:
"{
[...],
content": "{\n \"IndexMail\": \"12908\",\n \"Source\": \"ApengyMail\",\n \"Objet\": \"Clarification\",\n \"RefConsultation\": \"5587-ASE-00-24\",\n \"DateLimite\": \"2024-11-07T12:00:00\",\n \"Produit\": \"PDR (MECANIQUES , INSTRUMENTATIONS )\"\n}",
[...]
}

To process this content, you need to parse it.
One option - which I use - is to send this data to TeamDesk via a webhook (you need to create the webhook, create the table, create the webhook rule, create the table rule). Each time you modify your request you need to adapt the whole stuff

Another option would be to have an extended Response() function which would parse the "content" text received.

Should you know another one I would be grateful if you could share it !

Kind regards,

Pierre
ID
2084
Category
Integration/API
Author

Pierre
Date Created
10/26/2024 8:16:43 AM
Date Updated
10/28/2024 9:28:57 AM
Status
Under Consideration
Score
10
Promoted By
Pierre
Comments
Kirill Bondar  Staff  10/28/2024 4:32:47 AM
Yes, this seems to be a new wave in API design when they embed the result from other APIs in their response.

Implementation, however, is not just to add an extra parameter to Response(), more substantial change would be required.

Meanwhile you can use the following hack:

* Store Response("$.content") into Text - Multiline column
* Prepare new webhook to process JSON specified in "content" field.
* Call URL your webhook specifying Content-Type: application/json in headers, Text as Body format and passing the value of your multiline text as the body. Any extra information needed for webhook can be passed via URL parameters for simplicity and used via URLParam(URL(), "paramName") function in webhook.

Pierre 10/28/2024 9:28:57 AM
Hello Kirill

Thanks one more time for your great support !

Kind regards,

Pierre
Feedback
 
Back to Search Results