SmsEvents

public final class SmsEvents

MotechEvent Helper class, builds events from provided parameters.

Methods

inboundEvent

public static MotechEvent inboundEvent(String config, String sender, String recipient, String message, String providerMessageId, DateTime timestamp)

Creates an event which should be published after receiving an inbound SMS.

Parameters:
  • config – the configuration which received the SMS
  • sender – the sender number
  • recipient – the recipient number
  • message – the content of the SMS messages
  • providerMessageId – the provider ID of the message
  • timestamp – the message timestamp
Returns:

a MotechEvent that will indicate an inbound SMS

outboundEvent

public static MotechEvent outboundEvent(String subject, String config, List<String> recipients, String message, String motechId, String providerMessageId, Integer failureCount, String providerStatus, DateTime timestamp, Map<String, String> customParams)

Creates an MOTECH event which will describe an outbound SMS (already sent or to be sent).

Parameters:
  • subject – the subject of the evnet
  • config – the configuration which
  • recipients – the recipient numbers for the SMS
  • message – the SMS message
  • motechId – the MOTECH ID of the message
  • providerMessageId – the provider ID of the message
  • failureCount – the failure counter for this message, will be used for retries
  • providerStatus – the SMS status coming from the provider
  • timestamp – the timestamp of the message
  • customParams – custom parameters for the provider
Returns:

a MotechEvent describing the outbound SMS