curl --request POST \
--url https://your-instance.example.com/api/workflows/{id}/execute/sendgrid-inbound \
--header 'Content-Type: application/json' \
--data '
{
"organizationId": "64a1b2c3d4e5f60012345678",
"userId": "64a1b2c3d4e5f60012345679",
"emailData": {
"email": {
"from": "alex.nguyen@example.com",
"to": "inbound+org-64a1b@inbound.tetherai.ca",
"subject": "Question about Maple Court",
"body": "Hi — could you confirm the unit availability for next month?"
},
"metadata": {
"messageId": "sg_msg_1234567890"
}
}
}
'import requests
url = "https://your-instance.example.com/api/workflows/{id}/execute/sendgrid-inbound"
payload = {
"organizationId": "64a1b2c3d4e5f60012345678",
"userId": "64a1b2c3d4e5f60012345679",
"emailData": {
"email": {
"from": "alex.nguyen@example.com",
"to": "inbound+org-64a1b@inbound.tetherai.ca",
"subject": "Question about Maple Court",
"body": "Hi — could you confirm the unit availability for next month?"
},
"metadata": { "messageId": "sg_msg_1234567890" }
}
}
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({
organizationId: '64a1b2c3d4e5f60012345678',
userId: '64a1b2c3d4e5f60012345679',
emailData: {
email: {
from: 'alex.nguyen@example.com',
to: 'inbound+org-64a1b@inbound.tetherai.ca',
subject: 'Question about Maple Court',
body: JSON.stringify('Hi — could you confirm the unit availability for next month?')
},
metadata: {messageId: 'sg_msg_1234567890'}
}
})
};
fetch('https://your-instance.example.com/api/workflows/{id}/execute/sendgrid-inbound', 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/workflows/{id}/execute/sendgrid-inbound",
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([
'organizationId' => '64a1b2c3d4e5f60012345678',
'userId' => '64a1b2c3d4e5f60012345679',
'emailData' => [
'email' => [
'from' => 'alex.nguyen@example.com',
'to' => 'inbound+org-64a1b@inbound.tetherai.ca',
'subject' => 'Question about Maple Court',
'body' => 'Hi — could you confirm the unit availability for next month?'
],
'metadata' => [
'messageId' => 'sg_msg_1234567890'
]
]
]),
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/workflows/{id}/execute/sendgrid-inbound"
payload := strings.NewReader("{\n \"organizationId\": \"64a1b2c3d4e5f60012345678\",\n \"userId\": \"64a1b2c3d4e5f60012345679\",\n \"emailData\": {\n \"email\": {\n \"from\": \"alex.nguyen@example.com\",\n \"to\": \"inbound+org-64a1b@inbound.tetherai.ca\",\n \"subject\": \"Question about Maple Court\",\n \"body\": \"Hi — could you confirm the unit availability for next month?\"\n },\n \"metadata\": {\n \"messageId\": \"sg_msg_1234567890\"\n }\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/workflows/{id}/execute/sendgrid-inbound")
.header("Content-Type", "application/json")
.body("{\n \"organizationId\": \"64a1b2c3d4e5f60012345678\",\n \"userId\": \"64a1b2c3d4e5f60012345679\",\n \"emailData\": {\n \"email\": {\n \"from\": \"alex.nguyen@example.com\",\n \"to\": \"inbound+org-64a1b@inbound.tetherai.ca\",\n \"subject\": \"Question about Maple Court\",\n \"body\": \"Hi — could you confirm the unit availability for next month?\"\n },\n \"metadata\": {\n \"messageId\": \"sg_msg_1234567890\"\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://your-instance.example.com/api/workflows/{id}/execute/sendgrid-inbound")
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 \"organizationId\": \"64a1b2c3d4e5f60012345678\",\n \"userId\": \"64a1b2c3d4e5f60012345679\",\n \"emailData\": {\n \"email\": {\n \"from\": \"alex.nguyen@example.com\",\n \"to\": \"inbound+org-64a1b@inbound.tetherai.ca\",\n \"subject\": \"Question about Maple Court\",\n \"body\": \"Hi — could you confirm the unit availability for next month?\"\n },\n \"metadata\": {\n \"messageId\": \"sg_msg_1234567890\"\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Workflow executed successfully"
}{
"success": false,
"message": "Workflow not found"
}{
"success": false,
"message": "Workflow not found"
}{
"success": false,
"message": "Workflow not found"
}{
"success": false,
"message": "Workflow not found"
}Execute a workflow for a SendGrid inbound email
Internal service endpoint that runs a workflow against an inbound SendGrid email payload. Authenticated via the INTERNAL_SERVICE_TOKEN bearer (not user auth). Validates the email payload (from / to / subject required) and rejects unauthorized requests with 403.
curl --request POST \
--url https://your-instance.example.com/api/workflows/{id}/execute/sendgrid-inbound \
--header 'Content-Type: application/json' \
--data '
{
"organizationId": "64a1b2c3d4e5f60012345678",
"userId": "64a1b2c3d4e5f60012345679",
"emailData": {
"email": {
"from": "alex.nguyen@example.com",
"to": "inbound+org-64a1b@inbound.tetherai.ca",
"subject": "Question about Maple Court",
"body": "Hi — could you confirm the unit availability for next month?"
},
"metadata": {
"messageId": "sg_msg_1234567890"
}
}
}
'import requests
url = "https://your-instance.example.com/api/workflows/{id}/execute/sendgrid-inbound"
payload = {
"organizationId": "64a1b2c3d4e5f60012345678",
"userId": "64a1b2c3d4e5f60012345679",
"emailData": {
"email": {
"from": "alex.nguyen@example.com",
"to": "inbound+org-64a1b@inbound.tetherai.ca",
"subject": "Question about Maple Court",
"body": "Hi — could you confirm the unit availability for next month?"
},
"metadata": { "messageId": "sg_msg_1234567890" }
}
}
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({
organizationId: '64a1b2c3d4e5f60012345678',
userId: '64a1b2c3d4e5f60012345679',
emailData: {
email: {
from: 'alex.nguyen@example.com',
to: 'inbound+org-64a1b@inbound.tetherai.ca',
subject: 'Question about Maple Court',
body: JSON.stringify('Hi — could you confirm the unit availability for next month?')
},
metadata: {messageId: 'sg_msg_1234567890'}
}
})
};
fetch('https://your-instance.example.com/api/workflows/{id}/execute/sendgrid-inbound', 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/workflows/{id}/execute/sendgrid-inbound",
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([
'organizationId' => '64a1b2c3d4e5f60012345678',
'userId' => '64a1b2c3d4e5f60012345679',
'emailData' => [
'email' => [
'from' => 'alex.nguyen@example.com',
'to' => 'inbound+org-64a1b@inbound.tetherai.ca',
'subject' => 'Question about Maple Court',
'body' => 'Hi — could you confirm the unit availability for next month?'
],
'metadata' => [
'messageId' => 'sg_msg_1234567890'
]
]
]),
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/workflows/{id}/execute/sendgrid-inbound"
payload := strings.NewReader("{\n \"organizationId\": \"64a1b2c3d4e5f60012345678\",\n \"userId\": \"64a1b2c3d4e5f60012345679\",\n \"emailData\": {\n \"email\": {\n \"from\": \"alex.nguyen@example.com\",\n \"to\": \"inbound+org-64a1b@inbound.tetherai.ca\",\n \"subject\": \"Question about Maple Court\",\n \"body\": \"Hi — could you confirm the unit availability for next month?\"\n },\n \"metadata\": {\n \"messageId\": \"sg_msg_1234567890\"\n }\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/workflows/{id}/execute/sendgrid-inbound")
.header("Content-Type", "application/json")
.body("{\n \"organizationId\": \"64a1b2c3d4e5f60012345678\",\n \"userId\": \"64a1b2c3d4e5f60012345679\",\n \"emailData\": {\n \"email\": {\n \"from\": \"alex.nguyen@example.com\",\n \"to\": \"inbound+org-64a1b@inbound.tetherai.ca\",\n \"subject\": \"Question about Maple Court\",\n \"body\": \"Hi — could you confirm the unit availability for next month?\"\n },\n \"metadata\": {\n \"messageId\": \"sg_msg_1234567890\"\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://your-instance.example.com/api/workflows/{id}/execute/sendgrid-inbound")
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 \"organizationId\": \"64a1b2c3d4e5f60012345678\",\n \"userId\": \"64a1b2c3d4e5f60012345679\",\n \"emailData\": {\n \"email\": {\n \"from\": \"alex.nguyen@example.com\",\n \"to\": \"inbound+org-64a1b@inbound.tetherai.ca\",\n \"subject\": \"Question about Maple Court\",\n \"body\": \"Hi — could you confirm the unit availability for next month?\"\n },\n \"metadata\": {\n \"messageId\": \"sg_msg_1234567890\"\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Workflow executed successfully"
}{
"success": false,
"message": "Workflow not found"
}{
"success": false,
"message": "Workflow not found"
}{
"success": false,
"message": "Workflow not found"
}{
"success": false,
"message": "Workflow not found"
}Path Parameters
Body
Internal service payload forwarded by an inbound-email adapter (e.g. services/sendgrid-inbound). The workflow is run against the supplied email under the specified organization.
Owning organization for the run — must match the workflow's organizationId.
Parsed inbound email payload. Either supply the flat fields (from/to/subject/…) or a nested email object — from, to, and subject are required.
Show child attributes
Show child attributes
Optional User _id to attribute the run to. Falls back to the workflow's creator when omitted.