Offer Qualification

Offer qualification pre-ping API

This endpoint is used to pre-ping/qualify a lead given a set of identifiers. If the user identifiers match an offer, the lead is accepted. API Reference can be found here

Endpoint

URL

https://data.getangler.ai/v1/workspaces/<workspace_id>/qualifications

Authorization

Bearer Token in Authorization Header like Authorization: Bearer <TOKEN>

Query Parameters

  • workspace_id: Required Workspace Identifier

Request Parameters

  • source: Required Source of the lead.
  • offer_id: Required Offer id to check the lead for.
  • email: Lead's email address.
  • phone: Lead's phone number.
  • first_name: Lead's first name.
  • last_name: Lead's last name.
  • street_address: Lead's address line 1.
  • city: Lead's city.
  • state: Lead's state code - 2 characters.
  • zip: Lead's zip - 5 digit string.
  • email_md5: Lead's email address, md5 hashed.
  • phone_md5: Lead's phone number, md5 hashed (format 1XXXXXXXXXX).
  • first_name_md5: Lead's first name, md5 hashed.
  • last_name_md5: Lead's last name, md5 hashed.
  • street_address_md5: Lead's address line 1, md5 hashed.
  • zip_md5: Lead's zip - 5 digit string, md5 hashed.

Response

  • accepted: true if the lead is qualified
  • request: A unique ID for the request
  • offer: The offers that the lead was qualified for

Status Codes

  • 200: Request was successful. Even if leads were not accepted, you will get a 200 status.
  • 401: Unauthorized. Check workspace id and token.
  • 400: Bad Request. Check input format.

Examples

1. All identifiers provided

Request:

curl --location 'https://dev-data.getangler.ai/v1/workspaces/<workspace_id>/qualifications' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <token>' \
--data '{
    "source": "abc",
    "first_name": "John",
    "last_name": "Smith",
    "street_address": "112 Low Valley",
    "zip": "92610",
    "city": "Lake Forest",
    "state": "CA",
    "dob": "1991-02-04",
    "phone": "+15624463362",
    "offer_id": "abc123"
}'
import requests
import json

url = "https://dev-data.getangler.ai/v1/workspaces/<workspace_id>/qualifications"

payload = json.dumps({
  "source": "abc",
  "first_name": "John",
  "last_name": "Smith",
  "street_address": "112 Low Valley",
  "zip": "92610",
  "city": "Lake Forest",
  "state": "CA",
  "dob": "1991-02-04",
  "phone": "+15624463362",
  "offer_id": "abc123"
})
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer <token>'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

import http.client
import json

conn = http.client.HTTPSConnection("dev-data.getangler.ai")
payload = json.dumps({
  "source": "abc",
  "first_name": "John",
  "last_name": "Smith",
  "street_address": "112 Low Valley",
  "zip": "92610",
  "city": "Lake Forest",
  "state": "CA",
  "dob": "1991-02-04",
  "phone": "+15624463362",
  "offer_id": "abc123"
})
headers = {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer <token>'
}
conn.request("POST", "/v1/workspaces/<workspace_id>/qualifications", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
var request = require('request');
var options = {
  'method': 'POST',
  'url': 'https://dev-data.getangler.ai/v1/workspaces/<workspace_id>/qualifications',
  'headers': {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer <token>'
  },
  body: JSON.stringify({
    "source": "abc",
    "first_name": "John",
    "last_name": "Smith",
    "street_address": "112 Low Valley",
    "zip": "92610",
    "city": "Lake Forest",
    "state": "CA",
    "dob": "1991-02-04",
    "phone": "+15624463362",
    "offer_id": "abc123"
  })

};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

const axios = require('axios');
let data = JSON.stringify({
  "source": "abc",
  "first_name": "John",
  "last_name": "Smith",
  "street_address": "112 Low Valley",
  "zip": "92610",
  "city": "Lake Forest",
  "state": "CA",
  "dob": "1991-02-04",
  "phone": "+15624463362",
  "offer_id": "abc123"
});

let config = {
  method: 'post',
  maxBodyLength: Infinity,
  url: 'https://dev-data.getangler.ai/v1/workspaces/<workspace_id>/qualifications',
  headers: { 
    'Content-Type': 'application/json', 
    'Authorization': 'Bearer <token>'
  },
  data : data
};

axios.request(config)
.then((response) => {
  console.log(JSON.stringify(response.data));
})
.catch((error) => {
  console.log(error);
});

Response:

{
    "request_id": "pre-1yiidjjie",
    "accepted": true,
    "offer": {
      "offer_id": "abc123",
      "score": 0.9
    }
}

2. Invalid Data Format

Request:

{
    "source": "abc",
    "first_name": "John",
    "last_name": "Smith",
    "street_address": "112 Low Valley",
    "zip": "92610",
    "city": "Lake Forest",
    "state": "CA",
    "dob": "19910204",
    "phone": "+15624463362",
    "offer_id": "abc123"
}

Response:

{
    "statusCode": 400,
    "error": "Bad Request",
    "message": "body/dob must match format \"date\""
}