ChatGPT Scripting


If you've already configured an AI chatbot in todo4teams, you might also want to use it to automate ticket routing decisions.

This is particularly interesting for tasks that require an understanding of language and sentiment: For example, determining whether a request is a complaint or praise.

ChatGPT and other chatbots deliver good results here. To use the chatbots' responses in our scripts, we need to force them to provide short, clear answers.

This works, for example, if we ask ChatGPT the following question:

Evaluate whether the following message is a complaint. Answer 'Yes' or 'No':

My phone line is still broken. I've been waiting for the technician for two days now! ...

ChatGPT answers here with a simple "Yes".

In the following example code, we use ChatGPT to set the priority of a message arriving in a mailbox, depending on whether it is a complaint:

var ai = com.proxemo.todo4.server.ai.AIHelper.getInstance();
var ans = ai.ask("Evaluate whether the following message is a complaint. Answer with 'Yes' or 'No':\n\n"+task.title+"\n"+task.description);
println("Complaint: "+ans);
if(ans!=null && ans.contains('Yes')){
task.prio=3;
} else {
task.prio=0;
}

Code explanations:

  • var ai = com.proxemo.todo4.server.ai.AIHelper.getInstance();
    ...gets the configured AI implementation into a local variable.
  • var ans = ai.ask("Evaluate...");
    ...sends a prompt to the chat agent and stores its response in the variable ans, just as if you had sent the prompt to ChatGPT in the web browser.
  • if(ans!=null && ans.contains('Yes')){ ...
    The AI ​​response is checked here: If the chat agent responded with 'Yes', meaning the message contains a complaint, the priority of the ticket is increased.

As a result, you'll see a ticket with the text "Why haven't I received a response yet? The device is still broken. I'll contact my lawyer tomorrow!"

with high priority in the ticket list image-20250704101730-1.png, while a message with the text "Thank you for the quick support! That worked great!" receives a low priority: image-20250704101931-2.png.

Please note:

If you send customer-originated message content to AI systems, as in this example, you must ensure that you comply with all data protection obligations and comply with the GDPR, e.g., by operating your own ChatGPT instance or choosing GDPR-compliant AI operation in the IONOS AI Model Hub!