Send and receive communications like email and text messages with borrowers and their contacts. When sending and receiving communications an interaction is usually created.
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.
companyId
hydrates to company
loanId
hydrates to loan
loanIds
hydrates to loans
caseId
hydrates to case
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.
/interactions
endpointNote this is different from POST
ing 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.)
OK
The request was well-formed but was unable to be processed due to failed business logic validations. This includes scenarios where:
sendAt
attribute indicating the next allowable time.{- "subject": "annualPrivacyPolicyNotice",
- "channel": "voice",
- "theme": "agentNotification",
- "personId": "BO-AAAA-BBBB",
- "contactId": "BO-AAAA-BBBB",
- "loanId": "LN-AAAA-BBBB",
- "loanIds": [
- "LN-AAAA-BBBB",
- "LB-CCCC-DDDD"
], - "caseId": "CS-AAAA-BBBB",
- "statementId": "SM-AAAA-BBBB",
- "context": { },
- "attachments": [
- "string"
], - "supercaseBulkOperationId": "string",
- "previousInteractionId": "string",
- "isTransactional": true,
- "useTemplate": true,
- "interactionExternalId": "string",
- "sendAt": "2019-08-24T14:15:22Z",
- "sendJitter": 0,
- "strictUndefined": false,
- "overrideRecipient": "string",
- "overrideTemplateId": "TV-AAAA-BBBB"
}
{- "message": "string"
}
Receive a message.
This is different from a normal /interactions
creation because
it creates the interaction and also performs associated "inbound message"
actions:
handleInboundInteraction
or handleUnboundInboundInteraction
).channel required | string The channel by which an interaction occurs. |
content | object or null The content and attributes of the message sent. Normally in JSON format. |
id | string |
createdAt | string <date-time> |
updatedAt | string or null <date-time> |
deletedAt | string or null <date-time> |
contactId | string |
personId | string or null The ID of the borrower to which this interaction is associated |
startedAt | string <date-time> Start time of the interaction. If not provided we'll assume it's a timestamp of the API call. If time of day is not required provide only date. For CRM-managed |
scheduledAtFrom | string <date-time> Time to start the scheduled interaction. |
scheduledAtTo | string <date-time> Time to end the scheduled interaction. |
subject | string (InteractionSubject) 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., Some subjects like Note that |
theme required | string or null (InteractionTheme) The reason why an interaction occurred. For example:
The values |
borrowerSelectedTheme | string or null (InteractionTheme) The reason why an interaction occurred. For example:
The values |
status required | string (InteractionStatus) The status of an interaction.
Interaction In-Progress interactionsSome interactions—like an email—take place at a single point in time, others might be ongoing for many minutes—like a phone call. Ongoing interactions like voice and chat may have their status set to Scheduled interactionsSome interactions might be scheduled for the future. These interactions
have a status of NullNote that |
statusDetails | string or null (InteractionStatusDetails) Provides more details about the status of an interaction. Note that For the "human" outcome of an interaction see StatusCertain status details must have a particular SucceededThe following status details are considered
AttemptedThe following status details are considered
FailedThe following status details are considered Generally an interaction is
Channels
DirectionCertain status details are only valid with certain
NullNote that |
metaData | object or null (MetaData) Store any type of key/value pairs in the form of a JSON dictionary. |
direction | string (InteractionDirection) Enum: "outbound" "inbound" |
loanId | string (AssociatedLoanId) The ID of a Loan. This marks a particular loan as associated with this interaction. |
loanIds | Array of strings (AssociatedLoanIds) The IDs of several loans. This marks several loans as associated with this interaction. |
sensitive | boolean or null Default: false Set this flag if this interaction has sensitive information. The flag is used for proper authorization of access to the information. |
isExternal | boolean Boolean indicating the source of an Interaction. If |
externalId | string or null [ 1 .. 255 ] characters The lender's identifier for the interaction. After the object is successfully created, a lender can use ID or externalId identifiers to fetch the object. To fetch the object using externalId you need to add Note: Don't add ext- to the identifier value. For example: if the external identifier is |
previousInteractionId | string or null If a previous interaction identifier is provided, the current and previous interactions will be linked. This can either be Peach's or a lender's external identifier. |
twilioErrorCode | string or null <= 10 characters Raw error code from Twilio SMS service. The full list of codes can be found at https://www.twilio.com/docs/api/errors . |
isTransactional | boolean or null
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". Note: Can be |
contactExternalId | string or null The lender's identifier of the contact information. This should not include any |
agentOutcome | string or null (InteractionAgentOutcome) Provides details on the outcome of the interaction according to an agent. Note this captures the "human" outcome of an interaction: e.g., Did you talk the person you intended to? Did the other chat recipient become unresponsive? For the "technical" status of an interaction, see
|
endedAt | string or null <date-time> End time of the interaction. This attribute is optional and is used for logging only. For CRM-managed |
failureDescriptionShort | string or null Short text describing the failure reason. Normally displayed in UI. |
failureDescriptionLong | string or null Detailed text describing the failure reason and any appropriate actions the user may take to fix the issue. |
complianceGuardRuleId | string or null The Compliance Guard rule identifier that blocked the interaction.
Only applicable if the |
object (BasePersonNoIdentity) Represents various users such as a borrower, co-borrower, co-signer, etc. A lender can choose to provide PII or not. If no PII is provided, Peach cannot monitor for bankruptcy, deceased and SCRA. | |
object (contactInformation) The contact details. A contact can be email, phone, address,
etc. The | |
object or null The last task that was terminated (completed or canceled) for this interaction. |
Success
{- "channel": "fax",
- "content": { },
- "id": "string",
- "createdAt": "2019-08-24T14:15:22Z",
- "updatedAt": "2019-08-24T14:15:22Z",
- "deletedAt": "2019-08-24T14:15:22Z",
- "contactId": "string",
- "personId": "string",
- "startedAt": "2019-08-24T14:15:22Z",
- "scheduledAtFrom": "2019-08-24T14:15:22Z",
- "scheduledAtTo": "2019-08-24T14:15:22Z",
- "subject": "annualPrivacyPolicyNotice",
- "theme": "agentNotification",
- "borrowerSelectedTheme": "agentNotification",
- "status": "attempted",
- "statusDetails": "voiceSpokeWithFirstParty",
- "metaData": { },
- "direction": "outbound",
- "loanId": "LN-AAAA-BBBB",
- "loanIds": [
- "LN-AAAA-BBBB",
- "LB-CCCC-DDDD"
], - "sensitive": false,
- "isExternal": true,
- "externalId": "string",
- "previousInteractionId": "string",
- "twilioErrorCode": "string",
- "isTransactional": true,
- "contactExternalId": "string",
- "agentOutcome": "voiceSpokeWithFirstParty",
- "endedAt": "2019-08-24T14:15:22Z",
- "failureDescriptionShort": "string",
- "failureDescriptionLong": "string",
- "complianceGuardRuleId": "string",
- "borrower": {
- "id": "string",
- "createdAt": "2019-08-24T14:15:22Z",
- "updatedAt": "2019-08-24T14:15:22Z",
- "deletedAt": "2019-08-24T14:15:22Z",
- "borrowerType": "person",
- "externalId": "string",
- "status": "active",
- "collectionsIntensity": "light",
- "metaData": { },
- "commPreferences": {
- "statementDeliveryChannels": [
- "email"
], - "sendRemindersWhenCurrent": true
}, - "monitorStartDate": "2019-08-24",
- "companyId": "string"
}, - "contact": {
- "id": "string",
- "createdAt": "2019-08-24T14:15:22Z",
- "updatedAt": "2019-08-24T14:15:22Z",
- "deletedAt": "2019-08-24T14:15:22Z",
- "phoneDisconnectionDetails": {
- "lastKnownConnectionDate": "2019-08-24",
- "lastDisconnectCheckDate": "2019-08-24",
- "disconnectionStatus": "disconnected"
}, - "externalId": "string",
- "contactType": "phone",
- "label": "personal",
- "affiliation": "self",
- "name": "string",
- "value": "string",
- "address": {
- "addressLine1": "string",
- "addressLine2": "string",
- "city": "string",
- "countyOrRegion": "string",
- "state": "string",
- "postalCode": "string",
- "country": "string",
- "POBox": "string"
}, - "valid": true,
- "verified": false,
- "receiveTextMessages": false,
- "authorizedThirdParty": false,
- "powerOfAttorney": false,
- "status": "primary"
}, - "lastTaskMeta": {
- "sid": "string",
- "taskType": "answerInboundVoiceCall",
- "assignmentStatus": "completed",
- "taskInitAt": "2019-08-24T14:15:22Z",
- "assignedEmployee": {
- "firstName": "string",
- "lastName": "string",
- "id": "string",
- "userId": "string"
}
}
}
{- "status": 0,
- "message": "string",
- "data": {
- "channel": "string",
- "content": null,
- "id": "string",
- "createdAt": "2019-08-24T14:15:22Z",
- "updatedAt": "2019-08-24T14:15:22Z",
- "deletedAt": "2019-08-24T14:15:22Z",
- "contactId": "string",
- "personId": "string",
- "startedAt": "2019-08-24T14:15:22Z",
- "scheduledAtFrom": "2019-08-24T14:15:22Z",
- "scheduledAtTo": "2019-08-24T14:15:22Z",
- "subject": "annualPrivacyPolicyNotice",
- "theme": "agentNotification",
- "borrowerSelectedTheme": "agentNotification",
- "status": "attempted",
- "statusDetails": "voiceSpokeWithFirstParty",
- "metaData": { },
- "companyId": "string",
- "sensitiveBorrowerOnly": false,
- "direction": "outbound",
- "loanId": "LN-AAAA-BBBB",
- "loanIds": [
- "LN-AAAA-BBBB",
- "LB-CCCC-DDDD"
], - "sensitive": false,
- "isExternal": true,
- "externalId": "string",
- "previousInteractionId": "string",
- "twilioErrorCode": "string",
- "isTransactional": true,
- "createdBy": {
- "id": "string",
- "name": "string",
- "userType": "agent",
- "descriptor": "Agent bob@acme.com",
- "employee": {
- "id": "string"
}
}, - "object": "interaction",
- "statusUpdatedAt": "2019-08-24T14:15:22Z",
- "agentOutcome": "voiceSpokeWithFirstParty",
- "agentOutcomeUpdatedAt": "2019-08-24T14:15:22Z",
- "statusDetailsUpdatedAt": "2019-08-24T14:15:22Z",
- "endedAt": "2019-08-24T14:15:22Z",
- "templateVersionId": "string",
- "sendAt": "2019-08-24T14:15:22Z",
- "supercaseBulkOperationId": "string",
- "failureDescriptionShort": "string",
- "failureDescriptionLong": "string",
- "complianceGuardRuleId": "string",
- "borrower": {
- "id": "string",
- "createdAt": "2019-08-24T14:15:22Z",
- "updatedAt": "2019-08-24T14:15:22Z",
- "deletedAt": "2019-08-24T14:15:22Z",
- "borrowerType": "person",
- "externalId": "string",
- "status": "active",
- "statusUpdatedAt": "2019-08-24T14:15:22Z",
- "collectionsIntensity": "light",
- "displayId": "string",
- "metaData": { },
- "commPreferences": {
- "statementDeliveryChannels": [
- "email"
], - "sendRemindersWhenCurrent": true
}, - "monitorStartDate": "2019-08-24",
- "companyId": "string",
- "user": {
- "id": "string",
- "createdAt": "2019-08-24T14:15:22Z",
- "updatedAt": "2019-08-24T14:15:22Z",
- "deletedAt": "2019-08-24T14:15:22Z",
- "companyId": "string",
- "externalId": "string",
- "status": "active",
- "type": "borrower",
- "roleIds": [
- "string"
], - "object": "user",
- "userId": 0,
- "userName": "string",
- "auths": [
- {
- "authType": "basic",
- "authValueType": "email",
- "value": "string"
}
]
}
}, - "contact": {
- "id": "string",
- "createdAt": "2019-08-24T14:15:22Z",
- "updatedAt": "2019-08-24T14:15:22Z",
- "deletedAt": "2019-08-24T14:15:22Z",
- "object": "contact",
- "companyId": "string",
- "personId": "string",
- "receiveTextMessagesLastConsentAt": "2019-08-24T14:15:22Z",
- "phoneDisconnectionDetails": {
- "lastKnownConnectionDate": "2019-08-24",
- "lastDisconnectCheckDate": null,
- "disconnectionStatus": null
}, - "externalId": "string",
- "contactType": "phone",
- "label": "personal",
- "affiliation": "self",
- "name": "string",
- "value": "string",
- "address": {
- "object": "address",
- "addressLine1": "string",
- "addressLine2": "string",
- "city": "string",
- "countyOrRegion": "string",
- "state": "string",
- "postalCode": "string",
- "country": "string",
- "POBox": "string",
- "timezone": "string"
}, - "valid": true,
- "verified": false,
- "receiveTextMessages": false,
- "authorizedThirdParty": false,
- "powerOfAttorney": false,
- "status": "primary"
}, - "lastTaskMeta": {
- "sid": "string",
- "taskType": "answerInboundVoiceCall",
- "assignmentStatus": "completed",
- "taskInitAt": "2019-08-24T14:15:22Z",
- "assignedEmployee": {
- "firstName": "string",
- "lastName": "string",
- "id": "string",
- "userId": "string"
}
}
}
}
Copy the fields from an existing interaction into a new interaction and queue that new interaction for sending.
WARNING: This message is not checked against Compliance Guard.
Accepted
Not Found
{- "interactionId": "string"
}
{- "status": 0,
- "message": "string",
- "data": {
- "interactionId": "string"
}
}
Render a file (text
, html
or pdf
) from template and download it.
It selects an appropriate Template Descriptor (matching subject
, channel
), and
renders the active Template Version with the given context
. Only
the content matching the fmt
query parameter is returned in the file.
The rendered template file is then downloaded as an attachment. (i.e., a
response is sent with the header Content-Disposition: attachment
.)
Note: that a Document Descriptor is NOT created.
Template selectors and the data
OK
{- "subject": "annualPrivacyPolicyNotice",
- "channel": "email",
- "personId": "string",
- "loanId": "string",
- "caseId": "string",
- "context": { },
- "overrideTemplateId": "TV-AAAA-BBBB"
}
Render a file (text
, html
or pdf
) from template and write it to a document descriptor.
It selects an appropriate Template Descriptor (matching subject
, channel
), and
renders the active Template Version with the given context
. Only
the content matching the fmt
query parameter is returned in the file.
The rendered template file is then associated with the given documentId
. (i.e., this
new content can be downloaded via that Document Descriptor.)
WARNING: if there is existing document content for that document it will be overwritten.
Template selectors, context and the document ID.
OK
{- "subject": "annualPrivacyPolicyNotice",
- "channel": "email",
- "personId": "string",
- "loanId": "string",
- "caseId": "string",
- "context": { },
- "overrideTemplateId": "TV-AAAA-BBBB",
- "statementId": "string",
- "documentId": "string"
}
Render the template and return as a JSON response.
It selects an appropriate Template Descriptor (matching subject
, channel
), and
renders the active Template Version with the given context
.
The three contents are returned in a single JSON response, they are contentHtml
,
contentText
and subjectLine
.
NOTE: This is different from the /render
endpoints because it does not
return a file but rather the simple text-respresentation of the rendered
templates that would be used in rendering a file. It is generally easier
to test and debug the rendered templates as JSON strings rather than, for
instance a PDF file.
Template selectors and the data.
OK
{- "subject": "annualPrivacyPolicyNotice",
- "channel": "voice",
- "personId": "string",
- "loanId": "string",
- "caseId": "string",
- "context": { },
- "overrideTemplateId": "TV-AAAA-BBBB"
}
{- "subjectLine": "string",
- "contentHtml": "string",
- "contentText": "string"
}
Sends an email with the freeFormBranded
template.
This selects the Template Descriptor with subject=freeFormBranded
and
its currently active Template Version. The `freeFormBranded`` template allows
for the insertion of completely custom content within a standard branded email
template.
WARNING: This endpoint is not checked against Compliance Guard.
personalizations required | Array of any Specifies the email destination. See the body of POST /mail/send at https://sendgrid.com/docs/api-reference/. |
theme | string or null (InteractionTheme) The reason why an interaction occurred. For example:
The values |
language | string (language) = 2 characters Default: "en" The ISO 639-1 two character code of the email language. |
subjectLine | string The subject line of the email. |
contentHtml | string The content of the email in the HTML format. |
contentPlain | string The content of the email in the plain text format. |
previousInteractionId | string The ID of an existing interaction to link the new interaction to. |
isTransactional | boolean (SendIsTransactionalDefaultFalse) Default: false If 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. |
Accepted
{- "personalizations": [
- null
], - "theme": "agentNotification",
- "language": "en",
- "subjectLine": "string",
- "contentHtml": "string",
- "contentPlain": "string",
- "previousInteractionId": "string",
- "isTransactional": false
}
{- "status": 0,
- "message": "string",
- "data": {
- "interactionId": "string"
}
}
Render a template for "free-form" emails and return is as JSON.
A free-form message is one that can contain any content.
Templates previewed via this endpoint will be free-form but still be branded.
i.e., they will use the freeFormBranded
interaction subject, not freeForm
.
This returns the three contents of a template in a single JSON response,
they are contentHtml
, contentText
and subjectLine
.
OK
{- "subjectLine": "string",
- "contentHtml": "string",
- "contentPlain": "string"
}
{- "subjectLine": "string",
- "contentHtml": "string",
- "contentText": "string"
}
Send a verification code to an email or phone number.
This creates a confirmation code in the system which can be used
via the .../contacts
endpoint to verify the contact. (i.e., this
sets the verified
attribute of the contact to true
.)
This endpoint is rate limited to 10 requests per borrower per hour.
An interaction is created with InteractionSubject confirmationCode
.
NOTE: This endpoint is not checked against Compliance Guard, however it should never be necessary to restrict sending confirmation codes due to compliance guard rules.
OK
{- "personId": "string",
- "email": "string",
- "phone": "string",
- "channel": "voice",
- "context": { }
}
List all the currently available Interaction Subject descriptors.
An interaction subject is the category or topic to which an interaction pertains. (Note this is different from the subject line of an email message.)
For example, an email or a text message will necessarily contain different
content due to their nature, but they still might pertain to
the subject of paymentReminder
. Similarly, a phone call despite not being
text based at all might also pertain to the subject of paymentReminder
.
OK
[- {
- "subject": "annualPrivacyPolicyNotice",
- "title": "string",
- "theme": "agentNotification",
- "caseTypes": [
- "generic"
], - "agentCanSend": true,
- "previewOnly": true
}
]
Get the descriptor for a specific Interaction Subject.
Note that subject descriptors do not have an id
field but are
instead identified by their unique subject
field.
OK
{- "subject": "annualPrivacyPolicyNotice",
- "title": "string",
- "theme": "agentNotification",
- "caseTypes": [
- "generic"
], - "agentCanSend": true,
- "previewOnly": true
}
Update the descriptor for a specific Interaction Subject.
Note that subject descriptors do not have an id
field but are
instead identified by their unique subject
field.
OK
{- "theme": "agentNotification",
- "caseTypes": [
- "generic"
], - "agentCanSend": true,
- "previewOnly": true
}
{- "subject": "annualPrivacyPolicyNotice",
- "title": "string",
- "theme": "agentNotification",
- "caseTypes": [
- "generic"
], - "agentCanSend": true,
- "previewOnly": true
}