WiseParts
Calls

Look up a caller's priority

Given a phone number, returns the priority of the segment the matching customer belongs to.
GETPOST
https://app.wiseparts.ai/api/v1/voice/priority

Given a phone number, returns the priority of the segment the matching customer belongs to. Use it in your phone system's routing plan to put known customers in the right queue before the call is even offered.

Numbers that match no customer return the priority of the account's default segment, and so does a customer with no segment of its own — an unrecognised number is never an error here.

POST is accepted with from in the body, for systems that prefer it. Neither verb creates a call or stores anything about the lookup, but the request itself is recorded in the request history like every other Voice API call, so expect it to appear in GET /voice.

One asymmetry to know about: this lookup assumes no country, whereas call ingestion falls back to the account's own country when a number is ambiguous. A number in national format can therefore resolve to a different customer here than on the call that follows. Send numbers in full international format and the two stay in step.

Query parameters

fromstringRequired

The caller's number, ideally in full international format. Short numbers are not ruled out: a number saved as a contact on a customer or branch is matched at any length, and it is only the fallback that scans the customer and branch phone and mobile fields which skips anything shorter than eight digits. So a four-digit number resolves if somebody recorded it as a contact, and not otherwise.

cURL
curl --request GET \
  --url 'https://app.wiseparts.ai/api/v1/voice/priority?from=%2B351210000000' \
  --header 'Authorization: Bearer REPLACE_BEARER_TOKEN'
JavaScript
const options = {method: 'GET', headers: {Authorization: 'Bearer REPLACE_BEARER_TOKEN'}};

fetch('https://app.wiseparts.ai/api/v1/voice/priority?from=%2B351210000000', options)
  .then(response => response.json())
  .then(response => console.log(response))
  .catch(err => console.error(err));
PHP
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://app.wiseparts.ai/api/v1/voice/priority?from=%2B351210000000",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer REPLACE_BEARER_TOKEN"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
Python
import requests

url = "https://app.wiseparts.ai/api/v1/voice/priority"

querystring = {"from":"+351210000000"}

headers = {"Authorization": "Bearer REPLACE_BEARER_TOKEN"}

response = requests.request("GET", url, headers=headers, params=querystring)

print(response.text)
Go
package main

import (
    "fmt"
    "net/http"
    "io/ioutil"
)

func main() {

    url := "https://app.wiseparts.ai/api/v1/voice/priority?from=%2B351210000000"

    req, _ := http.NewRequest("GET", url, nil)

    req.Header.Add("Authorization", "Bearer REPLACE_BEARER_TOKEN")

    res, _ := http.DefaultClient.Do(req)

    defer res.Body.Close()
    body, _ := ioutil.ReadAll(res.Body)

    fmt.Println(res)
    fmt.Println(string(body))

}
Ruby
require 'uri'
require 'net/http'
require 'openssl'

url = URI("https://app.wiseparts.ai/api/v1/voice/priority?from=%2B351210000000")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer REPLACE_BEARER_TOKEN'

response = http.request(request)
puts response.read_body

Responses

200

The caller's segment priority.

401

The token is missing, wrong, or belongs to an integration that is not active. Requests that fail here leave no entry in the request history, because the account could not be identified. POST /voice/call and /voice/priority always answer with this JSON body. GET /voice only does so when the request asks for JSON — send Accept: application/json or you will get a 302 redirect to a browser page instead of a 401, which is a confusing thing to debug from a script.

422

from was missing or was not a string. It is the only field this endpoint validates, so it is the only key errors can ever carry here — a number that matches nothing is a 200, not a 422.

Response fields

priorityinteger or null

The matching segment's priority, or the default segment's when nothing matched. null in the one case where there is nothing to fall back to either: an account with no default segment configured.

200 matched
{
  "priority": 3
}
200 no-default-segment
{
  "priority": null
}
401
{
  "message": "Unauthenticated."
}
422
{
  "message": "The from field is required.",
  "errors": {
    "from": [
      "The from field is required."
    ]
  }
}