1. Home
  2. Docs
  3. Dynamic Integration
  4. Endpoint 4 – Searching based on a search expression

Endpoint 4 – Searching based on a search expression

Resource

GET https://demo.com/search?=$Expression
Parameters: $Expression

 

We call Endpoint 4 when:

1. The ROBIN Agent performs a search in the dashboard

2. When a phone link has been setup; endpoint 4 is called everytime a call comes in.


Endpoint

The “Search” endpoint shows results of the search expression so that the ROBIN Agent can see all known orders, customers and conversations relating to the search keyword.

What is important to know is that, once a ROBIN Agent performs a search, several things happen. I will describe these down below by grouping the three results the Agent will see.

1. Conversations

ROBIN will search our own platform for a conversation with the expression

2. Orders

ROBIN will request all Dynamic Links attached to a webstore with the expression

3. Customers

ROBIN will request all Dynamic Links attached to a webstore with the expression

 

Once a ROBIN Agent performs a search in ROBIN, the parameter $Expression will be filled, and the request will be sent to endpoint 4.

Below I will show you an example:

ROBIN agent performs the search looking for a customer with an email address: Email@address.com

Endpoint 4 request URL: https://demo.com/search?=email@address.com

 

The Minimum response

The minimum response from endpoint four consists of 3 situations:

Situation 1: A customer exist only doesn’t have a order

Situation 2: A customer exists and has one, or several, orders

Situation 3: There is no customer nor an order

I will show down below the minimum required JSON returns we need when one of the above three situations arise.

Situation 1: A customer exist only doesn’t have an order

{
    "customers": 
    [
        {
            "email_address": "email@address.com",
            "name": "John Doe",
            "phone_number": "0612345678",
            "order_count": "1",
            "total_spent": "€123,45"
        }
    ],
    "orders": 
    [ ]
}

Search result from Situation 1

 

Situation 2: A customer exists and has one, or several, orders

{
    "customers": 
    [
        {
            "email_address": "email@address.com",
            "name": "John Doe",
            "phone_number": "0612345678",
            "order_count": "2",
            "total_spent": "€70,50"
        }
    ],
    "orders": 
    [
        {
            "email_address": "email@address.com",
            "order_number": "RHQ1234",
            "order_date": "2017-01-12T12:34:56Z",
            "revenue": "€15,35",
            "name": "John Doe"
        },
        {
            "email_address": "email@address.com",
            "order_number": "RHQ4321",
            "order_date": "2018-01-12T12:34:56Z",
            "revenue": "€55,15",
            "name": "John Doe"
        }
    ]
}

Search result from Situation 2

Situation 3: There is no customer nor an order

{
    "customers": 
    [ ],
    "orders": 
    [ ]
}

Search result from Situation 3

 

By adding these three situations, you’ve set up the minimum response for endpoint 4.
Even though you can’t customise the results being shown, extending this search has its own beauty.

 

Schema of Endpoint 4

KeyTypeRequiredDescriptionExample
customersObjectYesCustomer specific contact details{}
email_addressStringYesE-mail from the customer which resembles the search expression"email@address.com"
nameStringYesName of the customer"John Doe"
phone_numberStringYesPhone number from the customer"+31612345678"
order_countStringYesTotal amount of orders the customer has"1"
total_spentStringYesTotal amount of money the customer has spent"€123,45"
OrdersObjectYesObject which contains order details that resembles the search expression{}
email_addressStringYesThe email address from the customer who filled in the order"email@address.com"
order_numberStringYesNumber from the order search expression"RHQ1234"
order_dateStringYesDate that the order has been received"2017-01-12T12:34:56Z"
revenueStringYesTotal amount of money that the order resembles"€12,34"
NameStringYesName from the customer that has filled in the order"John Doe"