REST Message Service¶
The rest message service provides endpoints which allows a user to send messages to a printed card number or account id
Endpoints¶
Send Marketing Message By Printed Card Number¶
-
POST
messaging/sendMarketingMessageByPrintedCardNumber.json
¶ Sends a message to a given Printed Card Number
The following authentication methods are allowed for this endpoint:
JSON Parameters: - merchantId (Integer) – (required) Paytronix-assigned merchant ID to perform the operation in
- campaignMessageTemplateCode (Integer) – (required) Campaign Message Template Code that uniquely identifies the Campaign Message Template
- printedCardNumber (String) – (required) Printed Card Number to send message to
- replacementParams (Map[String->String]) – (required) Key-Value relation for the external_field replacement the key is specified by the user when the Email Template was created
- deliveryMethod (String) – (required) String specifying message type current this is only enabled for EMAIL
-
"result":
"success"
JSON Parameters: - result (String) – (required)
success
- result (String) – (required)
-
"result":
"failure"
JSON Parameters: - result (String) – (required)
failure
- errorCode (String) – (required) The error code of the failure.
- errorMessage (String) – (required) The (human readable) error message of the failure.
- result (String) – (required)
Send Marketing Message By Account Id¶
-
POST
messaging/sendMarketingMessageByAccountId.json
¶ Sends a message to a given Account Id
The following authentication methods are allowed for this endpoint:
JSON Parameters: - merchantId (Integer) – (required) Paytronix-assigned merchant ID to perform the operation in.
- campaignMessageTemplateCode (Integer) – (required) Campaign Message Template Code that uniquely identifies the Campaign Message Template
- accountId (Integer) – (required) Paytronix-assigned unique identifier for the Account
- replacementParams (Map[String->String]) – (required) Key-Value relation for the external_field replacement the key is specified by the user when the Email Template was created
- deliveryMethod (String) – (required) String specifying message type current this is only enabled for EMAIL
-
"result":
"success"
JSON Parameters: - result (String) – (required)
success
- result (String) – (required)
-
"result":
"failure"
JSON Parameters: - result (String) – (required)
failure
- errorCode (String) – (required) The error code of the failure.
- errorMessage (String) – (required) The (human readable) error message of the failure.
- result (String) – (required)
Send Transactional Message By Printed Card Number¶
-
POST
messaging/sendTransactionalMessageByPrintedCardNumber.json
¶ Sends a message to a given Printed Card Number ignoring the opted-in status
The following authentication methods are allowed for this endpoint:
JSON Parameters: - merchantId (Integer) – (required) Paytronix-assigned merchant ID to perform the operation in.
- campaignMessageTemplateCode (Integer) – (required) Campaign Message Template Code that uniquely identifies the Campaign Message Template
- printedCardNumber (String) – (required) Printed Card Number to send message to
- replacementParams (Map[String->String]) – (required) Key-Value relation for the external_field replacement the key is specified by the user when the Email Template was created
- deliveryMethod (String) – (required) String specifying message type current this is only enabled for EMAIL
-
"result":
"success"
JSON Parameters: - result (String) – (required)
success
- result (String) – (required)
-
"result":
"failure"
JSON Parameters: - result (String) – (required)
failure
- errorCode (String) – (required) The error code of the failure.
- errorMessage (String) – (required) The (human readable) error message of the failure.
- result (String) – (required)
Send Transactional Message By Account Id¶
-
POST
messaging/sendTransactionalMessageByAccountId.json
¶ Sends a message to a given Account Id ignoring the opted-in status
The following authentication methods are allowed for this endpoint:
JSON Parameters: - merchantId (Integer) – (required) Paytronix-assigned merchant ID to perform the operation in.
- campaignMessageTemplateCode (Integer) – (required) Campaign Message Template Code that uniquely identifies the Campaign Message Template
- accountId (Integer) – (required) Account ID to send message to
- replacementParams (Map[String->String]) – (required) Key-Value relation for the external_field replacement the key is specified by the user when the Email Template was created
- deliveryMethod (String) – (required) String specifying message type current this is only enabled for EMAIL
-
"result":
"success"
JSON Parameters: - result (String) – (required)
success
- result (String) – (required)
-
"result":
"failure"
JSON Parameters: - result (String) – (required)
failure
- errorCode (String) – (required) The error code of the failure.
- errorMessage (String) – (required) The (human readable) error message of the failure.
- result (String) – (required)
Send Transactional Message By Email Address¶
-
POST
messaging/sendTransactionalMessageByEmailAddress.json
¶ Sends a message to a given email address ignoring the opted-in status. The provided email address does not need to have an associated Paytronix user.
The following authentication methods are allowed for this endpoint:
JSON Parameters: - merchantId (Integer) – (required) Paytronix-assigned merchant ID to perform the operation in.
- campaignMessageTemplateCode (Integer) – (required) Campaign Message Template Code that uniquely identifies the Campaign Message Template
- emailAddress (String) – (required) Email address to send message to
- replacementParams (Map[String->Object]) – (required) Key-Value relation for the external_field replacement the key is specified by the user when the Email Template was created. See
TemplateSubstitutionParameter
below for the format of the object. - deliveryMethod (String) – (required) String specifying message type current this is only enabled for EMAIL
-
"result":
"success"
JSON Parameters: - result (String) – (required)
success
- result (String) – (required)
-
"result":
"failure"
JSON Parameters: - result (String) – (required)
failure
- errorCode (String) – (required) The error code of the failure.
- errorMessage (String) – (required) The (human readable) error message of the failure.
- fieldErrors (Set[FieldAndError]) – (optional) A set of all the validation errors on replacementParams by field. See
FieldAndError
below for the format of the object.
- result (String) – (required)
Constant Values¶
deliveryMethod
Values¶
EMAIL
- Send an email message
Request Objects¶
-
TemplateSubstitutionParameter
¶ This object can be one of String, Integer, Decimal, or Seq[Map[String -> TemplateSubstitutionParameter]]
Example
[{
"name": "Visits",
"code": 0
"balance": 5.0
},{
"name": "Reward Dollars",
"code": 1
"balance": 2.5
}]
Response Objects¶
-
FieldAndError
¶ This object has a field and an error attribute.
Possible values for the error attribute: .. code:
missing_field
expected_sequence
unexpected_sequence
Example
[{
"field": "item_name",
"error": "missing_field"
},{
"field": "price",
"error": "missing_field"
}]
Error Codes¶
The following are the possible codes and messages that can be returned by the Message Service.
There are other system-level errors which may be returned which are not documented here.
The caller of the endpoint can use the returned message to display to the end user or, if different wording is desired, can provide their own mapping of code to message.
Code | Message |
---|---|
restmessaging.invalid_template_code |
Campaign Message Template code is invalid |
restmessaging.invalid_user |
User does not exist |
rest messaging.invalid_email_address |
Email Address provided is invalid |
rest messaging.field_errors |
Some required replacementParameters are missing. Please correct them and then retry. |
restmessaging.user_opted_out |
User is opted out |
restmessaging.user_email_failed |
User’s email is marked failed |
restmessaging.delivery_method |
Delivery method is invalid |
restmessaging.system_error |
Failed to validate replacement parameters against email template |
restmessaging.system_error |
System error |