DeepL MT automation with Trados 2019

I am trying to integrate DeepL machine translation within our own automation using the SDL SDK. I have tried placing the DeepL translation provider in a Studio template which uses this as a memory. I have also tried adding the API key for DeepL in the Trados options (Files > Options etc.) for the relevant language pairs. 

I have also tried to add this programmatically (example in VB.net but suggestions in C# welcome):

Dim ThisTargetLang As New Sdl.Core.Globalization.Language(MemoryToApply.LanguageDirection.TargetLanguage)

Dim AutomationProjConfig As TranslationProviderConfiguration = AutomationProject.GetTranslationProviderConfiguration(ThisTargetLang)

AutomationProjConfig.OverrideParent = True ' if you don't set this, it has no effect as the (empty) "All Languages" settings take precedence

Dim originalUri As New Uri("deepltranslationprovider:///?resenddrafts=True")

Dim myNewTP As New TranslationProviderUriBuilder(uri:=originalUri)

Dim DeepLMemoryCascadeEntry As New TranslationProviderCascadeEntry(New TranslationProviderReference(myNewTP.uri), performNormalSearch:=True, performConcordanceSearch:=True, performUpdate:=False, penalty:=0)

AutomationProjConfig.Entries.Add(DeepLMemoryCascadeEntry)

AutomationProject.Credentials.AddCredential(myNewTP.uri, credential:="APIKEY")

AutomationProject.UpdateTranslationProviderConfiguration(ThisTargetLang, AutomationProjConfig)

 

My pre-translate settings are as follows:

 

 

Also, in the Automation options under Editor, I have the option ticked to apply automated translation when no TM match is found

 

 

However, the translations are not applied but the segments are marked as automated translated:

 

 

 

Please note, if I do this within Trados 2019 itself from batch tasks > pre-translate then this will translate the file and place all the translations in the target segments. Same applies when actually opening the editor and manually applying the translation from the DeepL suggestion so it works as expected with Studio 2019 open.

 

Any ideas why this might not be working properly via automation as we do not receive any errors yet the translations from DeepL are not applied? Any suggestions/advice would be appreciated We are using Trados 2019 and the (current) latest version of DeepL plugin (4.8.8).