• Platform
    • Manager
    • Maestro
    • Exchange
    • Workspaces
    • Analytics
    • Springboard
    • API
Transact Services Guide (TSG)

Transact Services Guide (TSG)

  • Getting Started
  • Groovy Guide
  • Service Development
  • Groovy Services API
  • REST API

›Groovy Services API

Getting Started

  • Introduction

Groovy Guide

  • Groovy Guide
  • Groovy Declarations
  • Control Statements

Service Development

  • Service Development
  • Transaction Processing Sequence
  • Service Logging
  • Remote Service Calls
  • Fluent Security Configuration
  • Third-party Libraries

Groovy Services API

  • Groovy Services API
  • Fluent Function
  • Delivery Function
  • Form Version Selector
  • Form Security Filter
  • Form Prefill
  • Tracking Number
  • Form Dynamic Data
  • Submission Preprocessor
  • Receipt Number
  • Form Saved Processor
  • Submission Data Validator
  • Submission Completed Processor
  • Render Receipt Service
  • Delivery Process
  • Task Expiry Process
  • Email Service
  • Job Action
  • Scheduled Service
  • Groovy Service
  • SSO Revalidation
  • SSO Get Authentication Token
  • SSO Authentication OK Response
  • SSO Authentication Provider
  • Transaction History Publisher
  • Virus Scan

REST API

  • REST API
  • REST Application Package API
  • REST Delivery API
  • REST Form Groups API
  • REST Groovy Service Invoke v2
  • REST Service Definitions API
  • REST Tasks API
  • REST TestCenter API
  • REST TPac API
  • REST Transactions API
  • REST Transaction History API

Workspaces API

  • Workspaces API
  • Filters
  • Sort
  • Workspaces Category API
  • Workspaces Current User API
  • Workspaces Extract Name API
  • Workspaces Form API
  • Workspaces Group API
  • Workspaces Job API
  • Workspaces Org API
  • Workspaces Property Name API
  • Workspaces Space API
  • Workspaces Txn API
  • Workspaces User API

Email Service

The Email Service is called whenever a notification needs to be sent to a Journey Manager user. Journey Manager provides email-based implementations and allows you to implement your own services as well (which do not necessarily have to use email, for example you could provide an SMS notification service).

The Email Service can be configured on multiple levels and is resolved in the following order:

  1. Form Version
  2. Organization
  3. Global Service

The global default Email Service is used throughout, but can be overridden on the organization and form version level for sending submission related messages to applicants.

Service Invoke Parameters

Parameter Description Nullable
svcDef the service definition value object, see SvcDef no
txn the transaction record value object, see Txn yes
subject the email subject no
message the email body message yes
fromAddress the sender address yes
replyToAddress the address that shall be used when the recipient replies to the message yes
toAddress the recipient address(es) no
ccAddress the address(es) to send copies of the email to yes
bccAddress the address(es) to send blind carbon copies of the email to yes
attachmentMap map of attached files (containing filename/file data entries) yes

Error Handling

If an error occurs an error will be recorded in the Journey Manager database error log.

Service Template

This section shows service template Groovy script.

import com.avoka.core.groovy.GroovyLogger as logger
import com.avoka.tm.svc.*
import com.avoka.tm.vo.*
import javax.servlet.http.*

class FluentEmailService {

    /**
     * Perform send email
     */
    void invoke(SvcDef svcDef,
                Txn txn,
                String subject,
                String message,
                String fromAddress,
                String replyToAddress,
                String toAddress,
                String ccAddress,
                String bccAddress,
                Map<string byte>attachmentMap) {

        // TODO: perform business logic

        new Emailer()
            .setSubject(subject)
            .setMessage(message)
            .setFromAddress(fromAddress)
            .setReplyToAddress(replyToAddress)
            .setToAddress(toAddress)
            .setCcAddress(ccAddress)
            .setBccAddress(bccAddress)
            .setAttachmentMap(attachmentMap)
            .setTxn(txn)
            .sendEmail()
    }
} 

Unit Test Template

This section shows unit test template Groovy script.

import com.avoka.core.groovy.GroovyLogger as logger
import com.avoka.tm.svc.*
import com.avoka.tm.test.*
import com.avoka.tm.vo.*
import org.junit.Test

class UnitTest extends AbstractJUnitTest {

    /*
     * Perform service unit test
     *
     * throws exception if unit test fails
     */
    @Test
    void testEmailService() throws Exception {

        Txn txn = new MockVoBuilder().createTxnOpened()
        
        Map params = [
            "svcDef": svcDef,
            "txn": txn,
            "subject": "Email Subject",
            "message": "Email Message",
            "fromAddress": null,
            "replyToAddress": null,
            "toAddress": "test@avoka.com",
            "ccAddress": null,
            "bccAddress": null,
            "attachmentMap": null,
        ]

        new ServiceInvoker(svcDef).invoke(params)
    }
}
← Task Expiry ProcessJob Action →

Terms & Conditions

Privacy Policy

Cookie Policy

Copyright © 2003-2022 Temenos Headquarters SA