NAV Navbar

Introduction

Welcome to cashbot.ai! Our APIs will connect your users to products they will love and allow you to monetize your conversational experiences.

Once you have finished reading our documentation, head to the dashboard to give our APIs a try.

Integrations

Getting Started

Creating an Account

You will need to create an account by navigating to the dashboard. You can signup using either an email and password or Facebook login.

If you choose to signup using an email and password, you will also need to verify your email by clicking on the verification link we send you in a verification email. You will not be able to access any of the cashbot features until you verify your account.

If you choose to signup with Facebook login, you will need to authorize access to your Facebook profile. We use your Facebook email to create your account. We do not share your Facebook profile information with any third parties.

Registering an Agent

Once you have created an account, you will be able to register agents, provision API keys, and train cashbot.

In the dashboard, click the Add an Agent button. An agent registration form should load.

The only required field is a Name. The other fields are optional and can be filled in later. Once you are ready, click Submit.

Note: if you do not enable and configure an Amazon Affiliate tracking ID, you will not receive payment for your product recommendations.

See the Recommendation Sources section for more information.

Training cashbot

Once you have registered an agent, cashbot will populate your agent with a default set of product recommendations, generally targeted at bot developers.

You will need to train cashbot to understand what products your users will be interested in. To train cashbot, load the dashboard. Click the TRAIN button beside your agent name. This will load the training page for your agent.

Enter keywords that describe the types of products your users will be interested in. You can add them one by one or as a comma delimited string. Press SAVE once you are done. A confirmation modal will pop up to show you the changes you are about to submit. Press Confirm Changes to start the training of cashbot. Training can take up to 1-2 minutes to complete.

You can remove previously defined keywords by pressing the X beside the keyword. A confirmation modal will pop up to show you the changes you are about to submit. Again, press Confirm Changes to start the re-training of cashbot.

Bot Integrations

There are currently two optional bot integrations, Chatfuel and nodejs. If you are interested in additional integrations, please submit a request to support@cashbot.ai.

If you enable either Chatfuel or nodejs, you will be able to access easy-to-use integration instructions from your agent settings page. Load the dashboard then click on your agent to launch the agent settings page.

Click on the CHATFUEL or NODEJS tabs along the top of the agent settings page. The integration instructions page will load and provide detailed information on how to integrate cashbot.

Recommendation Sources

Currently, there is one optional recommendation source, Amazon. If you are interested in additional recommendation sources, please submit a request to support@cashbot.ai.

If you enable Amazon, you will be able to access the Amazon configuration page. Load the dashboard then click on your agent to launch the agent settings page. Click on the Amazon tab along the top of the agent settings page. An Amazon configuration page will load.

You will need to enter an Amazon Affiliate tracking ID. Information about the Amazon Affiliate program and tracking IDs can be found at https://affiliate-program.amazon.com.

Note: if you do not enable and configure an Amazon Affiliate tracking ID, you will not receive payment for your product recommendations.

Once you have enabled and configured an Amazon Affiliate tracking ID, payments will be processed and paid directly from your Amazon Affiliate account. cashbot does not currently handle payments to developers.

Authenticating Requests

Every request to cashbot.ai must include your API key in the header of the request.

Every POST request to cashbot.ai must also include a content type of JSON. Other media types are currently not supported.

x-api-key: AGENT_TOKEN
Content-Type: application/json

Improving Recommendations

cashbot recommendations can be improved by training through the dashboard (see the Training cashbot section for more information) or by submitting user inputs through the POST RECOMMEND API (see POST /recommend/{userId} section for more information).

The more cashbot understands about your users through explict training in the dashboard or through user inputs submitted to POST RECOMMEND the better the product recommendations will be.

RECOMMEND Reference

These are the main cashbot.ai APIs for receiving and improving product recommendations.

NOTE: there are a rate limits of 100 requests per second and 1,000,000 total requests per month for these types of requests. If these rate limits are too restrictive, please e-mail us at support@cashbot.ai.

Bolded query parameters are required.

All requests and responses should be in JSON format.

GET /recommend/{userId}

Get product recommendations.

Query Parameters

Parameter Default Type Description
userId string A unique identifier for the end user that the product recommendation is for
n 5 integer Number of requested product recommendations, up to 20 at a time
var request = require('request');

var options = {
  url: 'https://api.cashbot.ai/recommend/USER_ID?n=2',
  method: 'GET',
  headers: [
    {
      name: 'x-api-key',
      value: 'AGENT_TOKEN'
    },
    {
      name: 'Content-Type',
      value: 'application/json'
    }
  ]
};

request(options, function(err, res, body) {
  if (err) {
    console.log('[ERROR] GET recommend', err);
  } else if (res.statusCode === 401) {
    console.log('[ERROR] GET recommend: authorization failed');
  } else if (res.statusCode === 400 || res.statusCode === 405) {
    console.log('[ERROR] GET recommend: bad request');
  } else {
    console.log(JSON.parse(body));
  }
});

Response

ARRAY productRecommendation Objects

POST /recommend/{userId}

Submit a user’s input and, if available, receive a product recommendation.

Query Parameters

Parameter Default Type Description
userId string A unique identifier for the end user that the product recommendation is for
userInput userInput Object The user input that will be stored and used to improve product recommendations
var request = require('request');

var options = {
  url: 'https://api.cashbot.ai/recommend/USER_ID',
  method: 'POST',
  json: true,
  headers: [
    {
      name: 'x-api-key',
      value: 'AGENT_TOKEN'
    },
    {
      name: 'Content-Type',
      value: 'application/json'
    }
  ],
  body:JSON.stringify({
    userInput: USER_INPUT_OBJECT
  })
};

request(options, function(err, res, body) {
  if (err) {
    console.log('[ERROR] POST recommend', err);
  } else if (res.statusCode === 401) {
    console.log('[ERROR] POST recommend: authorization failed');
  } else if (res.statusCode === 400 || res.statusCode === 405) {
    console.log('[ERROR] POST recommend: bad request');
  } else {
    console.log(JSON.parse(body));
  }
});

Response

ARRAY productRecommendation Objects

userInput Object

Parameter Default Type Description
type enum String enumerated input type: speech, text, multimedia, event, blob
value inputValue Object Value of user input
date now integer A unix timestamp in milliseconds representing when the user input occurred
recommend false boolean Return product recommendations in the response
n 5 integer Number of requested product recommendations (if they exist), up to 20 at a time
{
  type: INPUT_TYPE,
  value: INPUT_VALUE_OBJECT
}

inputValue Object

Parameter Type Description
intent string The interpreted intent of the user
value string The explicit input from the user
{
  intent: USER_INTENT,
  value: USER_INPUT
}

productRecommendation Object

Parameter Type Description
url string A URL that points to the product purchase page
image string A URL that points to the product image
title string The name of the product
description string A short summary of the product
seller string The name of the seller of the product
{
  url: PRODUCT_URL,
  image: IMAGE_URL,
  title: PRODUCT_TITLE,
  description: PRODUCT_DESCRIPTION,
  seller: SELLER_NAME
}

QUERY Reference

Below are a set of APIs that can be used to query for information about your account.

NOTE: there is a rate limit of 50 requests per 10 minutes for these types of requests. If these rate limits are too restrictive, please e-mail us at support@cashbot.ai.

Bolded query parameters are required.

All requests and responses should be in JSON format.

GET /query/inputs

Get a “raw dump” of inputs over a given time period.

Query Parameters

Parameter Default Type Description
start integer A unix timestamp in milliseconds representing the inclusive start of the query date range
end integer A unix timestamp in milliseconds representing the inclusive end of the query date range
type all string A value from the enumerated types of the userInput object, defaults to “all”
var request = require('request');

var options = {
  url: 'https://api.cashbot.ai/query/inputs?start=START_TIMESTAMP&end=END_TIMESTAMP&type=touch',
  method: 'GET',
  headers: [
    {
      name: 'x-api-key',
      value: 'AGENT_TOKEN'
    },
    {
      name: 'Content-Type',
      value: 'application/json'
    }
  ]
};

request(options, function(err, res, body) {
  if (err) {
    console.log('[ERROR] GET query/inputs', err);
  } else if (res.statusCode === 401) {
    console.log('[ERROR] GET query/inputs: authorization failed');
  } else if (res.statusCode === 400 || res.statusCode === 405) {
    console.log('[ERROR] GET query/inputs: bad request');
  } else {
    console.log(JSON.parse(body));
  }
});

Response

ARRAY userInput objects

GET /query/stats

Get a set of monetization data about your experience over a given time period.

Query Parameters

Parameter Type Description
start integer A unix timestamp in milliseconds representing the inclusive start of the query date range
end integer A unix timestamp in milliseconds representing the inclusive end of the query date range
var request = require('request');

var options = {
  url: 'https://api.cashbot.ai/query/stats?start=START_TIMESTAMP&end=END_TIMESTAMP',
  method: 'GET',
  headers: [
    { 
      name: 'x-api-key',
      value: 'AGENT_TOKEN'
    },
    {
      name: 'Content-Type',
      value: 'application/json'
    }
  ]
};

request(options, function(err, res, body) {
  if (err) {
    console.log('[ERROR] GET query/inputs', err);
  } else if (res.statusCode === 401) {
    console.log('[ERROR] GET query/inputs: authorization failed');
  } else if (res.statusCode === 400 || res.statusCode === 405) {
    console.log('[ERROR] GET query/inputs: bad request');
  } else {
    console.log(JSON.parse(body));
  }
});

Response

agentStats Object

agentStats Object

Parameter Type Description
recommendations integer Number of recommendations provided by cashbot.ai during the query date range
clicks integer Number of click throughs during the query date range
bounties integer Number of bounties collected through product purchases during the query date range
revenue float Amount of revenue in US dollars generated during the query date range
{
  recommendations: 3723,
  clicks: 558,
  bounties: 113,
  revenue: 226.00
}