Class GroovyPhoneService

java.lang.Object
de.uplanet.lucy.server.phoneservice.scripting.groovy.GroovyPhoneService

@Scriptable public final class GroovyPhoneService extends Object
This class provides access to the Intrexx phone service for sending SMS and voice messages.
Since:
Intrexx 12.1.0.
  • Method Details

    • createInstance

      public static GroovyPhoneService createInstance()
      Create an instance of this API class.
      Returns:
      A new instance of this class.
    • normalizePhoneNumber

      public String normalizePhoneNumber(Map<String,Object> p_params) throws de.uplanet.lucy.util.phonenumber.PhoneNumberParseException
      Normalize a phone number to the E.164 format.

      The default country must be specified if the input is not designated as an international telephone number by using the international prefix symbol ⟨+⟩.

      Parameters:

      • number: The phone number to be normalized.
      • defaultCountry (optional): The default two-letter upper-case country code (may be null).

      Parameters:
      p_params - Named parameters (see above).
      Throws:
      de.uplanet.lucy.util.phonenumber.PhoneNumberParseException - If the input could not be parsed as a complete international phone number.
    • getRegionCode

      public String getRegionCode(String p_strPhoneNumber)
      Derive the two-letter region code from the given phone number.
      Parameters:
      p_strPhoneNumber - The phone number.
      Returns:
      The two-letter region code derived from the phone number, or null, if the given number does not provide this information.
    • addSms

      public void addSms(Map<String,Object> p_params)
      Add an SMS to the list of messages to be sent. This operation takes part in the current transaction.

      The added SMS messages could be sent by calling send() or sendAsync().

      Parameters:

      • to: The recipient or a Collection of recipients (in a possibly provider specific format).
      • text: The text to send.
      • apiKeyRef (optional): The name of a credential store entry that contains an API key that may override an API key configured for the phone service.
      • apiKey (optional): An API key that may override an API key configured for the phone service. For security reasons apiKeyRef should be preferred over apiKey.
      • providerParameters Additional optional named parameters (Map) passed to the phone service provider.

      Parameters:
      p_params - Named parameters (see above).
    • synchronouslySendSms

      public String synchronouslySendSms(Map<String,Object> p_params) throws de.uplanet.lucy.server.phoneservice.PhoneServiceException, IOException
      Send an SMS synchronously. This operation does not take part in the current transaction.

      Parameters:

      • to: The recipient or a Collection of recipients (in a possibly provider specific format).
      • text: The text to send.
      • apiKeyRef (optional): The name of a credential store entry that contains an API key that may override an API key configured for the phone service.
      • apiKey (optional): An API key that may override an API key configured for the phone service. For security reasons apiKeyRef should be preferred over apiKey.
      • providerParameters Additional optional named parameters (Map) passed to the phone service provider.

      Note: The structure of the returned message is specific for the provider and and may change in the future. It should only be used for debugging purposes.

      Parameters:
      p_params - Named parameters (see above).
      Returns:
      A provider specific response, or null.
      Throws:
      de.uplanet.lucy.server.phoneservice.PhoneServiceException
      IOException
    • addVoiceCall

      public void addVoiceCall(Map<String,Object> p_params)
      Add a voice call to the list of messages to be sent. This operation takes part in the current transaction.

      The added voice calls could be sent by calling send() or sendAsync().

      Parameters:

      • to: The recipient or a Collection of recipients (in a possibly provider specific format).
      • text: The text to send.
      • apiKeyRef (optional): The name of a credential store entry that contains an API key that may override an API key configured for the phone service.
      • apiKey (optional): An API key that may override an API key configured for the phone service. For security reasons apiKeyRef should be preferred over apiKey.
      • providerParameters Additional optional named parameters (Map) passed to the phone service provider.

      Parameters:
      p_params - Named parameters (see above).
    • synchronouslyMakeVoiceCall

      public String synchronouslyMakeVoiceCall(Map<String,Object> p_params) throws de.uplanet.lucy.server.phoneservice.PhoneServiceException, IOException
      Make a synchronous voice call. This operation takes not part in the current transaction.

      Parameters:

      • to: The recipient or a Collection of recipients (in a possibly provider specific format).
      • text: The text to send.
      • apiKeyRef (optional): The name of a credential store entry that contains an API key that may override an API key configured for the phone service.
      • apiKey (optional): An API key that may override an API key configured for the phone service. For security reasons apiKeyRef should be preferred over apiKey.
      • providerParameters Additional optional named parameters (Map) passed to the phone service provider.

      Note: The structure of the returned message is specific for the provider and and may change in the future. It should only be used for debugging purposes.

      Parameters:
      p_params - Named parameters (see above).
      Returns:
      A provider specific response, or null.
      Throws:
      de.uplanet.lucy.server.phoneservice.PhoneServiceException
      IOException
    • send

      public void send() throws Exception
      Synchronously send added SMS and voice messages.

      This operation takes part in the current transaction. The messages are being sent when the transaction is being committed.

      Note that this operation blocks until the messages have been submitted to the provider. To avoid this you might want to consider using the sendAsync() method.

      Throws:
      Exception - If an error occurs.
    • sendAsync

      public void sendAsync()
      Asynchronously send added SMS and voice messages.

      This operation takes part in the current transaction. The messages are being sent in a concurrent thread when the transaction is being committed.