Your Logic

7 min read
icon
Your Logic is currently in development. Format of requests and responses may change and you MUST be able to respond to these changes in a timely manner. We will collaborate closely with you and keep you in the loop.

Your Logic enables you to easily integrate Salted CX with your infrastructure. Salted CX has only one integration point that you can use to connect to your internal systems. Your Logic can intercept any message sent by any participant and tell us what to do.

Typical use cases for Your Logic:

  • Respond to customers using a custom generative AI
  • Perform actions when customers reach certain points in the self-service
  • Ask agents to confirm impactful operations before they are performed
  • Query internal systems to provide more information to agents
icon
You can use only one endpoint for Your Logic. In case you have multiple services that need to receive events from Your Logic you have to implement this distribution mechanism into Your Logic endpoint.
icon
Only communication that happens via Salted CX Live Conversations integrate with Your Logic. You cannot connect Your Logic to conversations that we ingest from 3rd party systems into analytics.

High Level Architecture

Your Logic plugs into the Conversation Management that notifies you about important events. Your Logic tells what we should do next.

Separation of Concerns

What Salted CX does for you:

  • Connection to multiple channels such as web chat, WhatsApp, etc.
  • Unification of multiple channels to a unified format
  • Queue events in individual conversations so Your Logic can tackle them one by one
  • Preprocessing of messages — language detection, translation, etc.
  • Keeping conversation context data
  • Fallback in case Your Logic is unresponsive
  • Escalation to agents in Live Conversations

What you SHOULD do:

  • Integrate with your systems in Your Logic to obtain data and perform actions
  • Scale Your Logic to handle the expected volume of conversations and respond within set timeouts
icon
Your Logic has to be able to handle multiple parallel conversations from the same customer. While we ensure that we will sequence all requests for individual conversations we do no sequence requests for customers. Customers can be involved in multiple conversations by simply emailing you and chatting at the same time. This might impact you when you are modifying customer-related data in your system. One conversation can update customer information that may influence other conversations.

Prerequisites

Contact Salted CX to get Your Logic ready for your account:

  • Provide Salted CX with your Salted CX account domain and endpoint that should receive requests from Your Logic
  • Get Shared Secret from Salted CX that enables you to verify requests sent to your endpoint are authentic and authenticate your responses

Your Logic Tech Stack

Salted CX does not force you into adopting any specific tools, technology, infrastructure nor programming language for Your Logic implementation. We define and enforce the communication protocol between Salted CX and Your Logic. You can choose your preferred technological stack to implement Your Logic to take advantage of people and skills you already have in your company.

You have many solutions to pick from including but not limited to:

  • NodeJS server — provides ultimate flexibility as you can code in any behavior that you want. You can use AWS Lambda or Kubernetes to enable Your Logic to scale.
  • n8n — universal workflow editor with large community and large set of built-in integrations.

Authorization

Salted CX uses shared secret authorization to ensure both sides can verify that the HTTP communication is sent by their counterparty.

Authorization of Your Logic Requests

You can check that requests are sent from Salted CX by checking the Authorization header in every HTTP request for the shared secret. You SHOULD not process requests that have the header missing or have an unexpected value.

Authorization: Bearer <shared secret>

Authorization of Your Logic Responses

Your Logic sends the request to https://api.eu.salted.cx/api/v1/live/your-logic endpoint that contains account ID and conversation PID.

https://api.eu.salted.cx/api/v1/live/your-logic/accounts/[ACCOUNT]/conversations/[CONVERSATION]

Each call to this endpoint MUST contain shared secret in the Authorization header. Each response that does not contain the header or contains unexpected value is ignored and no action is taken.

Authorization: Bearer <shared secret>

Requests from Salted

Whenever an action happens in a conversation Salted CX notifies you on your web hook. Salted CX sequences requests for individual conversations so you have a time to respond. Each event such as sent message goes through multiple stages when processed by Salted CX before it is shown to the other participants. Your Logic receives requests from one conversation in sequential order. Your Logic waits for Your Logic to respond to a request before sending another.

icon
Actions returned by Your Logic do not cause subsequent calls to Your Logic. They are directly shown to all participants. Post-processing may involve translation and other operation necessary.

Your Logic SHOULD send at most one response to one request. First response is accepted, all subsequent responses to the same request are ignored.

Activity Your Logic does not receive notifications about:

  • Typing (and similar activity) indicators

Action Stages

Each action such as sending a message goes through multiple stages from the moment it is performed by a participant until it is visible by other participants. The following table describes the stages in the chronological order.

Action StageDescription
Action StoredSalted CX received the action from a participant. The action is visible only to that original participant. Nobody else can see effect of the action (for example a message).
PreprocessingSalted CX processes the captured action and tries to provide Your Logic with the best possible input. The exact processing depends on action type. For messaging the pre-processing includes language detection and language translation.
Ready for Your LogicSalted CX is ready to send the information about the action to Your Logic. In case there is no request related to this conversation in Your Logic Salted CX sends the request with this action to Your Logic. If Your Logic is still processing a previous request related to the conversation the action is send after Your Logic responds together with other actions. See Asynchronous Behavior in Your Logic for more details.
Post-processingSalted CX executes actions that Your Logic returned in its response. Part of the execution of the actions may be additional processing such as translation of messages to the customer language. At the end of this stage Salted CX can send to Your Logic a next request related to the conversation.
Ready for ParticipantsSalted CX shows the effect of the action (for example a message) to other participants.

Error Handling

We ensure fallback in case Your Logic is not available due to network error, the service is down or the service is too slow to respond. The fallback ensures the stability of the infrastructure and maintain certain level of service for your customers.

icon
Common fallback action for messaging conversations is to ask human agents for help. Depending on the volume of your conversations this may be overwhelming for them and people might not be able to provide the same response times and quality of service under such load.

Your Logic is Not Available

In case an event happens and Your Logic is not available we resort to performing a default action that would be done as if Your Logic was not setup at all. If the conversation has no engaged human agent then we mark the conversation with Needs Help flag which makes it appear in agents Live screen in Salted CX. The messages between participants continue to function normally.

Your Logic Returns an Error

If Your Logic returns an error we behave as if Your Logic was not available.

Possible errors handled by Salted CX:

  • When calling your web hook Your Logic returns HTTPS response code outside of 2xx range
  • Your Logic responds in unsupported format, corrupted file, etc.

Your Logic is Too Slow

If Your Logic does not respond in timeout in settings we behave also as if Your Logic was not available. Each request from Salted CX contains an expiration time in UTC that lets you know how much time Your Logic has to respond.

Salted CX may have additional grace period to accommodate for network delay and other potential issues. So it is possible that even responses after the timeout get accepted but there is no extra guarantee beyond the timeout. You can adjust the timeout in settings. We recommend to set the timeout as low as possible but with enough buffer for spikes during normal operations.

One Your Logic per Account

You can have only one Your Logic web hook endpoint per account. We do not support calling multiple web hooks. In case you need to send requests from Salted CX to multiple destinations you have to implement this behavior in Your Logic.

Additional Resources

Your Logic Requests — what you will receive from Salted CX

Your Logic Responses — what you should send to Salted CX as response to the requests

Your Logic Data — what data are exchanged during Your Logic

Asynchronous Behavior in Your Logic — how to work with asynchronous communication

Your Logic Implementation Tips — some tips how to make Your Logic behave in a customer friendly way

Did this answer your question?