Notifications

How notifications work in Trever

Notifications can be added in the Workspace Settings of a workspace. Trever supports different recipient types, resource types, and event types, that allows for a granular configuration of different notification options.

With the API endpoint POST /subscriptions/templates, one can configure different Notification templates, that are tailored to the clients specific needs. To change a template, the endpoint PUT /subscriptions/templates can be used.

Recipient Types

There are four different recipient types currently supported:

  • Email Address: The user can provide specific email addresses, that will be notified, once an event occurs.
  • Email Customer: The customers notification email addresses will be notified, once an event occurs. (Only if the customer is related to the event)
  • Teams Webhook: A notification will be sent to a Microsoft Teams channel, once an event occurs.
  • Slack Webhook: A notification will be sent to a Slack channel, once an event occurs.

Resource Types

  • All
  • Woms
  • Toms
  • Bots
  • Pricestream
  • Execution Engine
  • Booking
  • Recon
  • Customer

Event Types

  • All
  • Started
  • Running
  • Stopped
  • Created
  • Deleted
  • Failed
  • Successful
  • Updated
  • Undesired Behaviour
  • Balance updated
  • Unknown

Notification Templates

Here are some examples, of how such a notification template could look like for different purposes:

Successful execution - Email address

An email address recipient wants to get notified, every time an execution is successful:

{
  "workspace": "trever",
  "recipient_type": "EMAIL_ADDRESS",
  "event_type": "SUCCESSFUL",
  "resource_type": "EXECUTION_ENGINE",
  "language": "en",
  "template_subject": "Successful Execution",
  "template_string": "An Execution was successful.",
  "version": "v0"
}

Balance updated - Email customer

A customer wants to get notified, every time the balance is set by the client via the API endpoint /bookings/accounts/:id/balance/set:

{
  "workspace": "trever",
  "recipient_type": "EMAIL_CUSTOMER",
  "event_type": "BALANCE_UPDATED",
  "resource_type": "CUSTOMER",
  "language": "de",
  "template_subject": "{{ if .IsDeposit }}Erfolgreicher Geldeingang auf Kryptokonto{{ else }}Erfolgreicher Geldausgang von Kryptokonto{{ end }}",
  "template_string": "Sehr geehrter Kunde,\n\nSie haben erfolgreich {{.BookingEntry.Quantity}} {{.Booking.Asset}} {{ if .IsDeposit }}auf Ihr{{ else }}von Ihrem{{ end }} Kryptokonto {{.Customer.Label}} {{ if .IsDeposit }}eingezahlt{{ else }}behoben{{ end }}.\n\nDer Saldo des Krypto-Cash-Accounts beträgt {{.Balance.Trading}} {{.Booking.Asset}} und kann ab sofort für den Erwerb von Kryptowerten genutzt werden. (Stand: {{ .ValueTime.Format \"02.01.2006 15:04\" }})\n\n\nBeste Grüße,\n\nIhre Bank",
  "version": "v0"
}

Successful execution - Email customer

A customer wants to get notified, every time an execution of the customer is successful. Here are two templates for the same event:

{
  "workspace": "trever",
  "recipient_type": "EMAIL_CUSTOMER",
  "event_type": "SUCCESSFUL",
  "resource_type": "EXECUTION_ENGINE",
  "language": "de",
  "template_subject": "Erfolgreiche Ausführung",
  "template_string": "Sehr geehrte/r Kunde/in,\n\nwir bestätigen die Ausführung eines Handelsgeschäfts. Die Details dazu können Sie der Abrechnung anbei entnehmen.\n\nMit freundlichen Grüßen\nIhre Bank\n",
  "version": "v0"
}

or

{
  "workspace": "trever",
  "recipient_type": "EMAIL_CUSTOMER",
  "event_type": "SUCCESSFUL",
  "resource_type": "EXECUTION_ENGINE",
  "language": "de",
  "template_subject": "Erfolgreiche Ausführung {{.Execution.Side}} {{.Execution.Route.BaseAsset}}/{{.Execution.Route.QuoteAsset}}",
  "template_string": "Sehr geehrte/r {{.Customer.CompanyName}}{{.Customer.JointName}}{{.Customer.FirstName}} {{.Customer.LastName}},\n\nFolgender Trade wurde erfolgreich durchgeführt:\n\n- Kontonummer: {{.Customer.ForeignId}}\n- Handelspaar: {{.Execution.Route.BaseAsset}}/{{.Execution.Route.QuoteAsset}}\n- Geschäftsart: {{.Execution.Side}}\n- Stückzahl: {{.Execution.Amount}} {{.Execution.Route.BaseAsset}}\n- Ausführungszeit: {{.Execution.SystemUpdatedAt}}\n- Ausführungskurs: {{.Execution.Price}}\n- Gebühren: {{.Execution.Margin}} \n- Gesamtbetrag: {{.Execution.ExecutionResult.Volume}} {{.Execution.Route.QuoteAsset}}\n",
  "version": "v0"
}

Customer created - Email customer

A customer wants to get notified, once the customer object is successfully created on the workspace and ready for trading:

{
  "workspace": "trever",
  "recipient_type": "EMAIL_CUSTOMER",
  "event_type": "CREATED",
  "resource_type": "CUSTOMER",
  "language": "de",
  "template_subject": "Erfolgreiche Eröffnung Kryptokonto {{.Customer.Label}}",
  "template_string": "Sehr geehrter Kunde,\n\nIhr Kryptokonto {{.Customer.Label}} wurde erfolgreich angelegt.\n\nViel Erfolg beim Handel.\n\nBeste Grüße,\n\nIhre Bank",
  "version": "v0"
}