1.Introduction

Welcome to the NGChat API documentation.

The entire communication with the API is executed using the following URL address: https://app.ngchat.com/api. All communications are in JSON format. The API server always returns an HTTP Status 200 and the information about the error is included in the response (pole status).

Correct answer:

 {  "status" : 0, ... } 

 

Wrong answer:

 { "status" : 1, ... }

 

Each request sent to the API server requires the x-user-token header to be used. This transfers an authorization token which enables further communication with the API. The token is dynamically changed after every request.

 

Own data included in JSON

Do you want to include more information about a client to enable an agent to preview it in the NGChat dashboard? No problem! Use a widget wizard in the Partners NGChat system.

BECOME A PARTNER

SIGN UP

2. Authentication

Authentication is executed using an API Key to obtain an x-user-token. You can generate an API key as an administrator in the NGChat application dashboard (Settings -> API Key). You can generate a new API key at any time.

Sample authentication:

 curl -i https://app.ngchat.com/api/developer/inicialize?developer_token=4805a594dbaf6422afe1e3629c6f1d19

Server response:

HTTP/1.1 200 OK
Date: Tue, 04 Aug 2015 10:13:26 GMT
Content-Type: text/html; charset=UTF-8
Content-Length: 15
Connection: keep-alive
x-user-token: 1234567890

{"status" : 1}

After a correct authentication the server will return a header with a token.

 x-token-user: 1234567890

The token will be necessary for further communication with the API.
Please remember that the x-token-user is changed after each sent server request!

WebHooks

JSON type data is inserted into the website source code to enable proper communication between e-commerce systems and NGChat. JSON data comprises several branches. Each of the branches is responsible for data displayed in the NGChat system dashboard. The NGChat plug-in installed on the website is responsible for the transfer of data between an e-commerce system and NGChat (go to http://www.ngchat.com/integration to view the installation manual).

Information about a user—user_info

  • uid – a unique client ID
  • email – client’s e-mail address
  • name – client’s first name
  • lastname – client’s last name
  • conversion – client’s conversion
  • street – client’s street
  • city – client’s city
  • postcode – client’s postal code
  • country – client’s country
  • telephone – client’s telephone number

A sample JSON for user_info

user_info:{
        "uuid":"32dcds932d8c0j3209ji20n",
        "email":"john.doe@mail.com",
        "name":"John",
        "lastname":"Doe",
        "conversion":"0.73",
        "street":[
            "123 Main St"
        ],
        "city":"New York",
        "postcode":"NY 10016",
        "country":"USA",
        "telephone":"+1 555 555 666"
    }

Information about a user’s cart—cart_info

The list of products in the cart—products

  • name_prod – product name
  • qty – quantity
  • price_prod – product price
  • id_prod – product ID
  • currency_code – currency symbol
  • order_c – how many times a product was ordered
  • cart_c – how many times a product was added to the cart
  • view_c – how many times a product was viewed
  • url_prod – a link to a product
  • img_url_prod – a link to product image
  • conversion – product conversion rate

The list of products in the cart—total_cart_price

  • total_price – the total value of the cart
  • currency_code – currency symbol

A sample JSON for cart_info

cart_info:{
        products:[   
            {
                "name_prod": "Apple I-Phone 6",
                "qty": 1,
                "price_prod": 399,
                "id_prod": "32kdmc932k",
                "currency_code": "USD",
                "order_c": 1,
                "cart_c": 1,
                "view_c": 10,
		"url_prod": "http://example-shop.com/iphone6",
		"img_url_prod": "http://example-shop.com/img/iphone6.jpg",
                "conversion": 0.1
            }
        ],
        total_cart_price:[
            {
                "total_price": 399
                "currency_code": "USD"
            }
        ]
    }

Information about a user’s orders—order_info

The list of a user’s orders—order

  • order_id – a unique order ID
  • total_price – the total price of the order
  • currency_code – currency symbol
  • date – order date
  • order_url – link to the order in the e-commerce system
  • order_status – order status

A summary of all user’s orders—total

  • qty -the number of all user’s orders
  • total_price – the total value of all user’s orders
  • average – the average order value
  • currency_code – currency symbol

A sample JSON for order_info

order_info:{   
        order:[
            {
                "order_id": "100013517",
                "total_price": 39.84,
                "currency_code": "USD",
                "date": "05-05-2015 10:56:10",                
                "order_url": "http://example-shop.com/orders/id/0ed956464a327060c65e62d601d0d8ab",
                "order_status": "Canceled"
            }
        ],
        total:[ 
            {
                "qty": 1,
                "total_price": 39.84,
                "average": 39.84,
                "currency_code": "USD"
            }
        ]
    }

User activity over the last 24 h—latest24

The list of viewed products—view

  • id_prod – a unique product ID
  • name_prod – product name
  • price_prod – product price
  • currency_code – currency symbol
  • url_prod – a link to a product webpage
  • img_url_prod – a link to product image

The list of products added to the cart—cart

  • id_prod – product ID
  • name_prod – product name
  • price_prod – product price
  • currency_code – currency symbol
  • url_prod – a link to a product
  • img_url_prod – a link to product image

The list of products ordered by a user—order

  • id_prod – product ID
  • name_prod – product name
  • price_prod – product price
  • currency_code – currency symbol
  • url_prod – a link to a product
  • img_url_prod – a link to product image

A sample JSON for latest24

latest24:{ 
        view:[ 
            {
                "id_prod": 321ecdc244e,
                "name_prod": "Apple IPad 3",
                "price_prod": 499.99,
                "currency_code": "USD", 
		"url_prod": "http://example-shop.com/ipad3",
		"img_url_prod": "http://example-shop.com/img/ipad3.jpg"
            }
        ],
        cart:[ 
            {
                "id_prod": 321ecdc244e,
                "name_prod": "Apple IPad 3",
                "price_prod": 499.99,
                "currency_code": "USD", 
		"url_prod": "http://example-shop.com/ipad3",
		"img_url_prod": "http://example-shop.com/img/ipad3.jpg"
            }        
        ],
        order:[ 
                 {
                "id_prod": 321ecdc244e,
                "name_prod": "Apple IPad 3",
                "price_prod": 499.99,
                "currency_code": "USD", 
		"url_prod": "http://example-shop.com/ipad3",
		"img_url_prod": "http://example-shop.com/img/ipad3.jpg"
            }
        ]
    }

Products abandoned by a user—abandoned_products

The list of abandoned products

  • id_prod – product ID
  • name_prod – product name
  • price_prod – product price
  • currency_code – currency symbol
  • url_prod – a link to a product
  • img_url_prod – a link to product image
abandoned_products:[ 
        {
            "id_prod": 4640,
            "name_prod": "Apple IPhone5s",
            "url_prod": "http://example-shop.com/iphone5s",
            "img_url_prod": "http://example-shop.com/img/iphone5s.jpg",
            "price_prod": 299.99,
            "currency_code": "USD"
        },
        {
            "id_prod": 4941,
            "name_prod":"Samsung Glaxy S6",
            "url_prod":"http://example-shop.com/sgalaxys6",
            "img_url_prod":"http://example-shop.com/img/sgalaxys6.jpg",
            "price_prod": 699.99,
            "currency_code": "USD"
        }
    ]

Own data included in JSON

Do you want to include more information about a client to enable an agent to preview it in the NGChat dashboard? No problem! Use a widget wizard in the Partners NGChat system.

A sample JSON—complete

A sample JSON which will enable testing of the communication between the plug-in and the NGChat system.

{
user_info:{
        "uuid":"32dcds932d8c0j3209ji20n",
        "email":"john.doe@mail.com",
        "name":"John",
        "lastname":"Doe",
        "conversion":"0.73",
        "street":[
            "123 Main St"
        ],
        "city":"New York",
        "postcode":"NY 10016",
        "country":"USA",
        "telephone":"+1 555 555 666"
    },
cart_info:{
        products:[   
            {
                "name_prod": "Apple I-Phone 6",
                "qty": 1,
                "price_prod": 399,
                "id_prod": "32kdmc932k",
                "currency_code": "USD",
                "order_c": 1,
                "cart_c": 1,
                "view_c": 10,
		"url_prod": "http://example-shop.com/iphone6",
		"img_url_prod": "http://example-shop.com/img/iphone6.jpg",
                "conversion": 0.1
            }
        ],
        total_cart_price:[
            {
                "total_price": 399
                "currency_code": "USD"
            }
        ]
    },
order_info:{   
        order:[
            {
                "order_id": "100013517",
                "total_price": 39.84,
                "currency_code": "USD",
                "date": "05-05-2015 10:56:10",                
                "order_url": "http://example-shop.com/orders/id/0ed956464a327060c65e62d601d0d8ab",
                "order_status": "Canceled"
            }
        ],
        total:[ 
            {
                "qty": 1,
                "total_price": 39.84,
                "average": 39.84,
                "currency_code": "USD"
            }
        ]
    },
latest24:{ 
        view:[ 
            {
                "id_prod": 321ecdc244e,
                "name_prod": "Apple IPad 3",
                "price_prod": 499.99,
                "currency_code": "USD", 
		"url_prod": "http://example-shop.com/ipad3",
		"img_url_prod": "http://example-shop.com/img/ipad3.jpg"
            }
        ],
        cart:[ 
            {
                "id_prod": 321ecdc244e,
                "name_prod": "Apple IPad 3",
                "price_prod": 499.99,
                "currency_code": "USD", 
		"url_prod": "http://example-shop.com/ipad3",
		"img_url_prod": "http://example-shop.com/img/ipad3.jpg"
            }        
        ],
        order:[ 
                 {
                "id_prod": 321ecdc244e,
                "name_prod": "Apple IPad 3",
                "price_prod": 499.99,
                "currency_code": "USD", 
		"url_prod": "http://example-shop.com/ipad3",
		"img_url_prod": "http://example-shop.com/img/ipad3.jpg"
            }
        ]
    },
abandoned_products:[ 
        {
            "id_prod": 4640,
            "name_prod": "Apple IPhone5s",
            "url_prod": "http://example-shop.com/iphone5s",
            "img_url_prod": "http://example-shop.com/img/iphone5s.jpg",
            "price_prod": 299.99,
            "currency_code": "USD"
        },
        {
            "id_prod": 4941,
            "name_prod":"Samsung Glaxy S6",
            "url_prod":"http://example-shop.com/sgalaxys6",
            "img_url_prod":"http://example-shop.com/img/sgalaxys6.jpg",
            "price_prod": 699.99,
            "currency_code": "USD"
        }
    ]
}