Authenticate a widget user
curl --request POST \
--url http://localhost:8080/widget/authenticate-user \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"email": "[email protected]",
"name": "<string>",
"avatar_url": "<string>",
"phone": "<string>",
"customData": {},
"chat_context": "<string>",
"http_action_overrides": {
"query_params": {},
"path_params": {},
"body_params": {},
"headers": {}
}
}
'import requests
url = "http://localhost:8080/widget/authenticate-user"
payload = {
"email": "[email protected]",
"name": "<string>",
"avatar_url": "<string>",
"phone": "<string>",
"customData": {},
"chat_context": "<string>",
"http_action_overrides": {
"query_params": {},
"path_params": {},
"body_params": {},
"headers": {}
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
email: '[email protected]',
name: '<string>',
avatar_url: '<string>',
phone: '<string>',
customData: {},
chat_context: '<string>',
http_action_overrides: {query_params: {}, path_params: {}, body_params: {}, headers: {}}
})
};
fetch('http://localhost:8080/widget/authenticate-user', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "8080",
CURLOPT_URL => "http://localhost:8080/widget/authenticate-user",
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([
'email' => '[email protected]',
'name' => '<string>',
'avatar_url' => '<string>',
'phone' => '<string>',
'customData' => [
],
'chat_context' => '<string>',
'http_action_overrides' => [
'query_params' => [
],
'path_params' => [
],
'body_params' => [
],
'headers' => [
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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 := "http://localhost:8080/widget/authenticate-user"
payload := strings.NewReader("{\n \"email\": \"[email protected]\",\n \"name\": \"<string>\",\n \"avatar_url\": \"<string>\",\n \"phone\": \"<string>\",\n \"customData\": {},\n \"chat_context\": \"<string>\",\n \"http_action_overrides\": {\n \"query_params\": {},\n \"path_params\": {},\n \"body_params\": {},\n \"headers\": {}\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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("http://localhost:8080/widget/authenticate-user")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"[email protected]\",\n \"name\": \"<string>\",\n \"avatar_url\": \"<string>\",\n \"phone\": \"<string>\",\n \"customData\": {},\n \"chat_context\": \"<string>\",\n \"http_action_overrides\": {\n \"query_params\": {},\n \"path_params\": {},\n \"body_params\": {},\n \"headers\": {}\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:8080/widget/authenticate-user")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"email\": \"[email protected]\",\n \"name\": \"<string>\",\n \"avatar_url\": \"<string>\",\n \"phone\": \"<string>\",\n \"customData\": {},\n \"chat_context\": \"<string>\",\n \"http_action_overrides\": {\n \"query_params\": {},\n \"path_params\": {},\n \"body_params\": {},\n \"headers\": {}\n }\n}"
response = http.request(request)
puts response.read_body{
"token": "<string>",
"contact": {
"id": "<string>"
}
}{
"statusCode": 123,
"message": "<string>",
"error": "<string>"
}Contacts
Authenticate a widget user
Authenticate a widget user — authenticate the contacts. Use when authenticating widget visitors against your own identity provider.
POST
/
widget
/
authenticate-user
Authenticate a widget user
curl --request POST \
--url http://localhost:8080/widget/authenticate-user \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"email": "[email protected]",
"name": "<string>",
"avatar_url": "<string>",
"phone": "<string>",
"customData": {},
"chat_context": "<string>",
"http_action_overrides": {
"query_params": {},
"path_params": {},
"body_params": {},
"headers": {}
}
}
'import requests
url = "http://localhost:8080/widget/authenticate-user"
payload = {
"email": "[email protected]",
"name": "<string>",
"avatar_url": "<string>",
"phone": "<string>",
"customData": {},
"chat_context": "<string>",
"http_action_overrides": {
"query_params": {},
"path_params": {},
"body_params": {},
"headers": {}
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
email: '[email protected]',
name: '<string>',
avatar_url: '<string>',
phone: '<string>',
customData: {},
chat_context: '<string>',
http_action_overrides: {query_params: {}, path_params: {}, body_params: {}, headers: {}}
})
};
fetch('http://localhost:8080/widget/authenticate-user', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "8080",
CURLOPT_URL => "http://localhost:8080/widget/authenticate-user",
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([
'email' => '[email protected]',
'name' => '<string>',
'avatar_url' => '<string>',
'phone' => '<string>',
'customData' => [
],
'chat_context' => '<string>',
'http_action_overrides' => [
'query_params' => [
],
'path_params' => [
],
'body_params' => [
],
'headers' => [
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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 := "http://localhost:8080/widget/authenticate-user"
payload := strings.NewReader("{\n \"email\": \"[email protected]\",\n \"name\": \"<string>\",\n \"avatar_url\": \"<string>\",\n \"phone\": \"<string>\",\n \"customData\": {},\n \"chat_context\": \"<string>\",\n \"http_action_overrides\": {\n \"query_params\": {},\n \"path_params\": {},\n \"body_params\": {},\n \"headers\": {}\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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("http://localhost:8080/widget/authenticate-user")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"email\": \"[email protected]\",\n \"name\": \"<string>\",\n \"avatar_url\": \"<string>\",\n \"phone\": \"<string>\",\n \"customData\": {},\n \"chat_context\": \"<string>\",\n \"http_action_overrides\": {\n \"query_params\": {},\n \"path_params\": {},\n \"body_params\": {},\n \"headers\": {}\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:8080/widget/authenticate-user")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"email\": \"[email protected]\",\n \"name\": \"<string>\",\n \"avatar_url\": \"<string>\",\n \"phone\": \"<string>\",\n \"customData\": {},\n \"chat_context\": \"<string>\",\n \"http_action_overrides\": {\n \"query_params\": {},\n \"path_params\": {},\n \"body_params\": {},\n \"headers\": {}\n }\n}"
response = http.request(request)
puts response.read_body{
"token": "<string>",
"contact": {
"id": "<string>"
}
}{
"statusCode": 123,
"message": "<string>",
"error": "<string>"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Pattern:
^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$Available options:
en, fr, de, nl, pl, pt, es, it, ru, ja, ko, zh, ar, tr, sv, da, no, fi, el, cs, hu, th, vi, id, he, hi, uk, ro, bg, hr, sk, sl, sr, et, lv, lt, is, ga, ms, tl, fa, bn, ta, te, ur, sw, zu, af, sq, hy, az, eu, be, bs, ca, cy, ku, ckb, kmr Show child attributes
Show child attributes
Show child attributes
Show child attributes
Was this page helpful?
⌘I