Gmail Pub/Sub push webhook
curl --request POST \
--url https://your-instance.example.com/api/webhook/email/gmail \
--header 'Content-Type: application/json' \
--data '
{
"message": {
"data": "eyJlbWFpbEFkZHJlc3MiOiJvcHNAYWNtZS5leGFtcGxlIiwiaGlzdG9yeUlkIjoxMjM0NTZ9"
}
}
'import requests
url = "https://your-instance.example.com/api/webhook/email/gmail"
payload = { "message": { "data": "eyJlbWFpbEFkZHJlc3MiOiJvcHNAYWNtZS5leGFtcGxlIiwiaGlzdG9yeUlkIjoxMjM0NTZ9" } }
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({
message: {
data: 'eyJlbWFpbEFkZHJlc3MiOiJvcHNAYWNtZS5leGFtcGxlIiwiaGlzdG9yeUlkIjoxMjM0NTZ9'
}
})
};
fetch('https://your-instance.example.com/api/webhook/email/gmail', 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://your-instance.example.com/api/webhook/email/gmail",
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([
'message' => [
'data' => 'eyJlbWFpbEFkZHJlc3MiOiJvcHNAYWNtZS5leGFtcGxlIiwiaGlzdG9yeUlkIjoxMjM0NTZ9'
]
]),
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://your-instance.example.com/api/webhook/email/gmail"
payload := strings.NewReader("{\n \"message\": {\n \"data\": \"eyJlbWFpbEFkZHJlc3MiOiJvcHNAYWNtZS5leGFtcGxlIiwiaGlzdG9yeUlkIjoxMjM0NTZ9\"\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://your-instance.example.com/api/webhook/email/gmail")
.header("Content-Type", "application/json")
.body("{\n \"message\": {\n \"data\": \"eyJlbWFpbEFkZHJlc3MiOiJvcHNAYWNtZS5leGFtcGxlIiwiaGlzdG9yeUlkIjoxMjM0NTZ9\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://your-instance.example.com/api/webhook/email/gmail")
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 \"message\": {\n \"data\": \"eyJlbWFpbEFkZHJlc3MiOiJvcHNAYWNtZS5leGFtcGxlIiwiaGlzdG9yeUlkIjoxMjM0NTZ9\"\n }\n}"
response = http.request(request)
puts response.read_body"OK"{
"error": "Email account not found"
}Email
Gmail Pub/Sub push webhook
Receives Gmail Pub/Sub push notifications. The relay decodes the base64 payload, looks up the matching EmailAccount by history id, and triggers an incremental sync. Public endpoint — auth is enforced by the Pub/Sub OIDC token, not bearer JWT.
POST
/
api
/
webhook
/
email
/
gmail
Gmail Pub/Sub push webhook
curl --request POST \
--url https://your-instance.example.com/api/webhook/email/gmail \
--header 'Content-Type: application/json' \
--data '
{
"message": {
"data": "eyJlbWFpbEFkZHJlc3MiOiJvcHNAYWNtZS5leGFtcGxlIiwiaGlzdG9yeUlkIjoxMjM0NTZ9"
}
}
'import requests
url = "https://your-instance.example.com/api/webhook/email/gmail"
payload = { "message": { "data": "eyJlbWFpbEFkZHJlc3MiOiJvcHNAYWNtZS5leGFtcGxlIiwiaGlzdG9yeUlkIjoxMjM0NTZ9" } }
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({
message: {
data: 'eyJlbWFpbEFkZHJlc3MiOiJvcHNAYWNtZS5leGFtcGxlIiwiaGlzdG9yeUlkIjoxMjM0NTZ9'
}
})
};
fetch('https://your-instance.example.com/api/webhook/email/gmail', 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://your-instance.example.com/api/webhook/email/gmail",
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([
'message' => [
'data' => 'eyJlbWFpbEFkZHJlc3MiOiJvcHNAYWNtZS5leGFtcGxlIiwiaGlzdG9yeUlkIjoxMjM0NTZ9'
]
]),
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://your-instance.example.com/api/webhook/email/gmail"
payload := strings.NewReader("{\n \"message\": {\n \"data\": \"eyJlbWFpbEFkZHJlc3MiOiJvcHNAYWNtZS5leGFtcGxlIiwiaGlzdG9yeUlkIjoxMjM0NTZ9\"\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://your-instance.example.com/api/webhook/email/gmail")
.header("Content-Type", "application/json")
.body("{\n \"message\": {\n \"data\": \"eyJlbWFpbEFkZHJlc3MiOiJvcHNAYWNtZS5leGFtcGxlIiwiaGlzdG9yeUlkIjoxMjM0NTZ9\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://your-instance.example.com/api/webhook/email/gmail")
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 \"message\": {\n \"data\": \"eyJlbWFpbEFkZHJlc3MiOiJvcHNAYWNtZS5leGFtcGxlIiwiaGlzdG9yeUlkIjoxMjM0NTZ9\"\n }\n}"
response = http.request(request)
puts response.read_body"OK"{
"error": "Email account not found"
}Body
application/json
Pub/Sub push envelope wrapping the Gmail notification; decoded server-side to identify the affected mailbox.
Show child attributes
Show child attributes
Response
Plain-text acknowledgement. The body is the literal text OK; Pub/Sub only checks the 2xx status to mark the push delivery as acknowledged.
The response is of type string.
Example:
"OK"
⌘I