curl --request POST \
--url https://yghpblhxrfmxkwejvpjz.supabase.co/functions/v1/web-push-register \
--header 'Content-Type: application/json' \
--data '
{
"client_id": "client_a3f8b2...",
"user_id": "user_42",
"fcm_token": "d9k3s...",
"user_hash": "4f1d8a..."
}
'import requests
url = "https://yghpblhxrfmxkwejvpjz.supabase.co/functions/v1/web-push-register"
payload = {
"client_id": "client_a3f8b2...",
"user_id": "user_42",
"fcm_token": "d9k3s...",
"user_hash": "4f1d8a..."
}
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({
client_id: 'client_a3f8b2...',
user_id: 'user_42',
fcm_token: 'd9k3s...',
user_hash: '4f1d8a...'
})
};
fetch('https://yghpblhxrfmxkwejvpjz.supabase.co/functions/v1/web-push-register', 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://yghpblhxrfmxkwejvpjz.supabase.co/functions/v1/web-push-register",
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([
'client_id' => 'client_a3f8b2...',
'user_id' => 'user_42',
'fcm_token' => 'd9k3s...',
'user_hash' => '4f1d8a...'
]),
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://yghpblhxrfmxkwejvpjz.supabase.co/functions/v1/web-push-register"
payload := strings.NewReader("{\n \"client_id\": \"client_a3f8b2...\",\n \"user_id\": \"user_42\",\n \"fcm_token\": \"d9k3s...\",\n \"user_hash\": \"4f1d8a...\"\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://yghpblhxrfmxkwejvpjz.supabase.co/functions/v1/web-push-register")
.header("Content-Type", "application/json")
.body("{\n \"client_id\": \"client_a3f8b2...\",\n \"user_id\": \"user_42\",\n \"fcm_token\": \"d9k3s...\",\n \"user_hash\": \"4f1d8a...\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://yghpblhxrfmxkwejvpjz.supabase.co/functions/v1/web-push-register")
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 \"client_id\": \"client_a3f8b2...\",\n \"user_id\": \"user_42\",\n \"fcm_token\": \"d9k3s...\",\n \"user_hash\": \"4f1d8a...\"\n}"
response = http.request(request)
puts response.read_body{
"success": true
}Registrar dispositivo Web Push
Associa o token FCM de um navegador ao user_id do usuário no seu sistema. Chamado pelo script de registro que roda no site, com o client_id público do OAuth Client. Um usuário tem um token por conta: um registro novo substitui o anterior, e o mesmo token registrado para outro user_id é removido para evitar entrega duplicada. Usa a mesma verificação de identidade do In-App (mesmo segredo e mesma exigência): user_hash = HMAC-SHA256 do user_id com o segredo de verificação da conta, em hexadecimal. Limite: 60 chamadas por minuto por IP.
curl --request POST \
--url https://yghpblhxrfmxkwejvpjz.supabase.co/functions/v1/web-push-register \
--header 'Content-Type: application/json' \
--data '
{
"client_id": "client_a3f8b2...",
"user_id": "user_42",
"fcm_token": "d9k3s...",
"user_hash": "4f1d8a..."
}
'import requests
url = "https://yghpblhxrfmxkwejvpjz.supabase.co/functions/v1/web-push-register"
payload = {
"client_id": "client_a3f8b2...",
"user_id": "user_42",
"fcm_token": "d9k3s...",
"user_hash": "4f1d8a..."
}
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({
client_id: 'client_a3f8b2...',
user_id: 'user_42',
fcm_token: 'd9k3s...',
user_hash: '4f1d8a...'
})
};
fetch('https://yghpblhxrfmxkwejvpjz.supabase.co/functions/v1/web-push-register', 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://yghpblhxrfmxkwejvpjz.supabase.co/functions/v1/web-push-register",
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([
'client_id' => 'client_a3f8b2...',
'user_id' => 'user_42',
'fcm_token' => 'd9k3s...',
'user_hash' => '4f1d8a...'
]),
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://yghpblhxrfmxkwejvpjz.supabase.co/functions/v1/web-push-register"
payload := strings.NewReader("{\n \"client_id\": \"client_a3f8b2...\",\n \"user_id\": \"user_42\",\n \"fcm_token\": \"d9k3s...\",\n \"user_hash\": \"4f1d8a...\"\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://yghpblhxrfmxkwejvpjz.supabase.co/functions/v1/web-push-register")
.header("Content-Type", "application/json")
.body("{\n \"client_id\": \"client_a3f8b2...\",\n \"user_id\": \"user_42\",\n \"fcm_token\": \"d9k3s...\",\n \"user_hash\": \"4f1d8a...\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://yghpblhxrfmxkwejvpjz.supabase.co/functions/v1/web-push-register")
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 \"client_id\": \"client_a3f8b2...\",\n \"user_id\": \"user_42\",\n \"fcm_token\": \"d9k3s...\",\n \"user_hash\": \"4f1d8a...\"\n}"
response = http.request(request)
puts response.read_body{
"success": true
}Body
client_id público do OAuth Client
Identificador do usuário no seu sistema — o mesmo usado depois em recipient.user_id
Token FCM do navegador
HMAC-SHA256 do user_id com o segredo de verificação de identidade da conta (o mesmo do In-App), em hexadecimal. Obrigatório quando a conta liga Exigir verificação de identidade; quando enviado, é sempre conferido
Response
Registrado