Guide
MOI

Handle User Actions

12min



Filter Selection

As an example, let us assume that the shopper was presented different sizes as options based on the earlier response provided by the Moi backend.

JSON


When a shopper selects a filter option, for example, size "s", we expect a request such as the following to be submitted to the Moi backend.

JSON


Please note how the message is submitted and the filter element with the value "size:s" is submitted. This is the value of the option that was sent in the original response.

If customer chooses two sizes “s” and “m”, the request for the same should look like the following:

JSON


Please note how the value element inside the filter element now has two semicolon separated values.





Product Questions

This particular option requires a special way of handling. When a shopper clicks on this option, in our current (default) interface we open a separate tab, where we allow shoppers to ask questions about the respective product (see below). 



Document image


Within this new tab, now when a shopper asks a question, a request such as the following should be made:

Request:

JSON


Here, as can be seen, we have included three more parameters in the context as well as the shopper's question as message

Parameter

Description

url

The respective product's url

productId

The respective product's id

mode

Must have the value "product-specific-question"

message

The customers question *Note: must be sent outside of the context clause



Response:

The Moi backend produces a standard response as it does for any other requests.

JSON






Product Click

It could be as easy as taking customers to the respective product URL, however, the Moi backend needs to know the products that the shoppers are clicking on to collect analytics events and provide:

  1. Personalized search experience
  2. Reports on conversions that were driven by the Moi application.

For this reason, when a shopper clicks on a product, we ask you to submit the following request:

Request:

JSON




Response:

JSON




Feedback

It is important to get shopper feedback on the responses the Moi engine produces.

For example, not integrated in Moi but in another application of ours, currently, we show the thumbs up and down as below:

Document image


Feedback Needed

Every message we return would have an id associated with it and an element called collectFeedback with its value either set to "true" or "false"

If it is set to "true", we request you to collect feedback from the shopper.

JSON


Once the feedback is collected, it can be sent as the following request. 

Send Feedback

Important 

  1. The endpoint to submit feedback is different.
  2. the messageId here must be the same as the id of the message sent in the response. The value of the thumbs parameter must be either "UP" or "DOWN".
JSON