Send a message and save it as a new interaction.
The message is checked against Compliance Guard and may be rejected if it violates any rules.
If the message is accepted, it is queued for send. You can check the status of the queued interaction by calling GET on /interactions/{interactionId} endpoint with the interaction ID returned by this endpoint.
Certain context variables can be "hydrated" by this endpoint for use in the template being rendered for sending.
For instance, if you provide a loanId in the request body it is "hydrated" to a loan object and passed to the context. This means you can then reference things like {{loan.displayId}} when customizing the template.
companyIdhydrates tocompanyloanIdhydrates toloanloanIdshydrates toloanscaseIdhydrates tocase
Note that this endpoint does not automatically fill in context variables.
If the template you're sending requires context variables, you must provide them. This can sometimes be confusing because Peach will automatically calculate and include context variables when the system sends a message automatically. See System Sent Messages for more information.
Note this is different from POSTing to a /interactions endpoint because those endpoints create the interaction object, but do NOT send an actual message. (You can think of that endpoint as creating a historical log of an interaction which happened elsewhere.)
Mark a particular case as associated with this message.
Hydates to the case context variable for use in the template being rendered for send.
The channels the Send Message endpoint can deliver to. This is a subset of the full InteractionChannel enum: fax, chat, gui, and document are not valid send channels and requests using them are rejected with a 400.
The Contact ID of the borrower to which this message should be sent.
If not provided then the system will try to select an appropriate contact based on the type of message being sent. (e.g., if this is an email select the primary email address; if this is a text message select the borrower's mobile phone.)
The data used to render the template. Provided in JSON format, it must be a mapping of context variables to values.
The context variables of borrower, loan, case and statement do not need to be provided since the system will automatically add these objects to context assuming you provide personId, loanId, caseId and statementId to the endpoint.
For example if your provided the context...
{
"dateSigned": "Aug 27, 2021"
"lenderName": "Peachy Lender"
"paymentMethod": "bankAccount"
"paymentMethodLastFour": "1110"
"supportEmail": "support@peach.com"
"supportPhone": "888-888-8888"
}...then a template like Hello from {{lenderName}}! would render like Hello from Peachy Lender!
The external ID of the interaction that will be created as a result of this request. Subsequent attempts to send with the same external ID will be blocked.
If true, then sent this interaction as "transactional".
Transactional interactions are those which are sent via an automated system in response to an event or some action taken. e.g., an email sent to confirm a payment was made is transactional; likewise an email sent to confirm a password change is transacrtional. Examples of non-transactional messages would be: those sent by an agent in response to a customer request, for collections, or for marketing.
It's important to mark these messages correctly, because different laws may apply to messages depending on if they're considered "transactional".
Additionally, a transactional interaction may be sent with different "From:" and "Reply-To:" fields depending on configuration. The purpose here being that it may be desirable to send messages from an email address that is clearly marked as "unmonitored", so that recipients do not try to respond directly to those email addresses.
The ID of a Loan. This marks a particular loan as associated with this interaction.
Hydrates to the loan context variable for use in the template
The IDs of several loans. This marks several loans as associated with this interaction.
Hydrates to the loans context variable for use in the template
[ "LN-AAAA-BBBB", "LB-CCCC-DDDD" ]
The recipient to which this message should be sent. This should be used in special cases where you cannot create a Contact and use contactId.
WARNING: It is not recommended to use this field. Instead use contactId to specify the contact.
You can only use this field if:
- The interaction channel is
email - A
borrowerIdis specified - A
previousInteractionIdis specified, to an email interaction belonging to that borrower - That previous interaction was sent "from:" the same email address as the one you want to send to. Currently only email addresses are supported for this field.
The template version ID (like TV-AAAA-BBBB) or template descriptor ID (like TD-AAAA-BBBB) to use.
If a template descriptor is given, then the current template descriptor's activeVersionId is used.
This should be used in special cases where you do not want to use the implicit template selected by the subject and channel fields.
The Borrower ID of the borrower to which this message should be sent.
Hydates to the person context variable for use in the template being rendered for send.
This attribute determines when the message should be sent. If set to null, and the message's timing conflicts with Compliance Guard's time-of-day restrictions, Communicator will automatically reschedule it to an allowable time. If this auto-rescheduling occurs, the sendAt field in the Interaction response will show the new scheduled time, and the Interaction status will be marked as scheduled.
To bypass auto-rescheduling, input the current time for sendAt when calling the endpoint.
Additional Information:
- Regardless of when the message is scheduled to send, its content will be generated immediately upon calling this endpoint.
- You can manually set a future send time of up to 7 days in the future.
The maximum number of seconds to add to the send time for this communication. The actual time added will be between 0 and this value. This is useful for spreading out the delivery of a large batch of messages over a period of time in order to avoid delaying other time-sensitive communcations.
If true an error will be returned if the template contains a variable that is not defined in the context. For historical reasons this is false by default, but it is recommended to set this to true.
The subject of the interaction. The subject identifies the category of the content in the message.
Most subjects have an associated implicit theme. e.g., loanOverdueFirstNotice has a theme of opsCollDebt. For these subjects it is not necessary to specify a theme.
Some subjects like freeForm and custom<N> do not have an implicit theme. When using these subjects you must specify a theme.
DEPRECATED: locStatementGenerated and locStatementRegenerated are deprecated. They will be automatically converted into statementGenerated and statementRegenerated respectively. You should switch to use those subjects directly.
DEPRECATED: failedSettlementPeach is deprecated. This was always a subject used by the Peach application internally, and will no longer be used. Attempts to set this subject will be rejected with a 400 error.
The reason why an interaction occurred.
For example:
- An outbound debt collection call should be marked as
opsCollDebt. - An annual privacy policy update email should be marked as
opsServicing. - A customer service response to borrower's inquiry should be marked as
opsServicing.
DEPRECATED: inbBug, inbHumanLove, and opsServicingNegativeCreditReportNotice are deprecated: you cannot create or update interactions to have these values.
- oauth2
- bearerAuth
- apiKeyHeader
curl -i -X POST \
https://sandboxapi.peach.finance/api/communicator/send \
-H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
-H 'Content-Type: application/json' \
-d '{
"attachments": [
"string"
],
"caseId": "CS-AAAA-BBBB",
"channel": "voice",
"contactId": "BO-AAAA-BBBB",
"context": {},
"interactionExternalId": "string",
"isTransactional": true,
"loanId": "LN-AAAA-BBBB",
"loanIds": [
"LN-AAAA-BBBB",
"LB-CCCC-DDDD"
],
"overrideRecipient": "string",
"overrideTemplateId": "TV-AAAA-BBBB",
"personId": "BO-AAAA-BBBB",
"previousInteractionId": "string",
"sendAt": "2019-08-24T14:15:22Z",
"sendJitter": 0,
"statementId": "SM-AAAA-BBBB",
"strictUndefined": false,
"subject": "annualPrivacyPolicyNotice",
"supercaseBulkOperationId": "string",
"theme": "agentNotification",
"useTemplate": true
}'