Skip to main content
POST
/
nous
/
signals
Create Signal
curl --request POST \
  --url https://api.sophra.org/api/nous/signals \
  --header 'Content-Type: application/json' \
  --data '
{
  "type": "SEARCH",
  "source": "web",
  "value": {
    "sessionId": "sess_123abc",
    "queryId": "q_789xyz",
    "resultId": "res_456def",
    "position": 3,
    "metadata": {
      "documentType": "product",
      "timeToClick": 2.5,
      "deviceType": "mobile",
      "viewport": {
        "width": 375,
        "height": 812
      }
    }
  },
  "strength": 0.8,
  "priority": 1,
  "metadata": {
    "status": "PENDING",
    "attempts": 0
  }
}
'
import requests

url = "https://api.sophra.org/api/nous/signals"

payload = {
"type": "SEARCH",
"source": "web",
"value": {
"sessionId": "sess_123abc",
"queryId": "q_789xyz",
"resultId": "res_456def",
"position": 3,
"metadata": {
"documentType": "product",
"timeToClick": 2.5,
"deviceType": "mobile",
"viewport": {
"width": 375,
"height": 812
}
}
},
"strength": 0.8,
"priority": 1,
"metadata": {
"status": "PENDING",
"attempts": 0
}
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
type: 'SEARCH',
source: 'web',
value: {
sessionId: 'sess_123abc',
queryId: 'q_789xyz',
resultId: 'res_456def',
position: 3,
metadata: {
documentType: 'product',
timeToClick: 2.5,
deviceType: 'mobile',
viewport: {width: 375, height: 812}
}
},
strength: 0.8,
priority: 1,
metadata: {status: 'PENDING', attempts: 0}
})
};

fetch('https://api.sophra.org/api/nous/signals', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sophra.org/api/nous/signals",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'type' => 'SEARCH',
'source' => 'web',
'value' => [
'sessionId' => 'sess_123abc',
'queryId' => 'q_789xyz',
'resultId' => 'res_456def',
'position' => 3,
'metadata' => [
'documentType' => 'product',
'timeToClick' => 2.5,
'deviceType' => 'mobile',
'viewport' => [
'width' => 375,
'height' => 812
]
]
],
'strength' => 0.8,
'priority' => 1,
'metadata' => [
'status' => 'PENDING',
'attempts' => 0
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);

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

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

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

func main() {

url := "https://api.sophra.org/api/nous/signals"

payload := strings.NewReader("{\n \"type\": \"SEARCH\",\n \"source\": \"web\",\n \"value\": {\n \"sessionId\": \"sess_123abc\",\n \"queryId\": \"q_789xyz\",\n \"resultId\": \"res_456def\",\n \"position\": 3,\n \"metadata\": {\n \"documentType\": \"product\",\n \"timeToClick\": 2.5,\n \"deviceType\": \"mobile\",\n \"viewport\": {\n \"width\": 375,\n \"height\": 812\n }\n }\n },\n \"strength\": 0.8,\n \"priority\": 1,\n \"metadata\": {\n \"status\": \"PENDING\",\n \"attempts\": 0\n }\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Content-Type", "application/json")

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

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

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.sophra.org/api/nous/signals")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"SEARCH\",\n \"source\": \"web\",\n \"value\": {\n \"sessionId\": \"sess_123abc\",\n \"queryId\": \"q_789xyz\",\n \"resultId\": \"res_456def\",\n \"position\": 3,\n \"metadata\": {\n \"documentType\": \"product\",\n \"timeToClick\": 2.5,\n \"deviceType\": \"mobile\",\n \"viewport\": {\n \"width\": 375,\n \"height\": 812\n }\n }\n },\n \"strength\": 0.8,\n \"priority\": 1,\n \"metadata\": {\n \"status\": \"PENDING\",\n \"attempts\": 0\n }\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.sophra.org/api/nous/signals")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"type\": \"SEARCH\",\n \"source\": \"web\",\n \"value\": {\n \"sessionId\": \"sess_123abc\",\n \"queryId\": \"q_789xyz\",\n \"resultId\": \"res_456def\",\n \"position\": 3,\n \"metadata\": {\n \"documentType\": \"product\",\n \"timeToClick\": 2.5,\n \"deviceType\": \"mobile\",\n \"viewport\": {\n \"width\": 375,\n \"height\": 812\n }\n }\n },\n \"strength\": 0.8,\n \"priority\": 1,\n \"metadata\": {\n \"status\": \"PENDING\",\n \"attempts\": 0\n }\n}"

response = http.request(request)
puts response.read_body
{
  "success": true,
  "data": {
    "signalId": "<string>",
    "status": "<string>",
    "timestamp": "2023-11-07T05:31:56Z"
  }
}

Body

application/json
type
enum<string>
required

Type of signal

Available options:
SEARCH,
CLICK,
FEEDBACK,
SYSTEM
source
enum<string>
required

Source of the signal

Available options:
web,
api,
mobile,
system
value
object
required
strength
number

Signal strength or confidence

Required range: 0 <= x <= 1
priority
integer

Processing priority

Required range: 1 <= x <= 10
metadata
object

Response

201 - application/json

Signal created successfully

success
boolean
data
object