Skip to content

Example B · Invite & Send

Gateway invites a cloud operator → peer joins → send an encrypted message.

Scenario: A factory gateway (factory-gw-01) connects to an ops-center operator and sends a status update.


Prerequisites

  • Gateway running (Example A)
  • Active license (License Management)
  • Operator has Privitty Edge, mobile, or desktop client to accept the invite

Step 1 — Gateway generates invite

On the gateway:

curl -s -X POST http://127.0.0.1:7200/rpc \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","method":"get_chat_securejoin_qr_code","params":[1,null],"id":1}' | jq -r .result

Output (example):

OPENPGP4FPR:AABBCCDD…?a=factory-gw-01%40chat.privittytech.com&n=factory-gw-01&i=…&s=…

Or via CLI:

docker exec privitty-edged privitty-edge invite

Share this link with the operator (e-mail, ticketing system, QR code).


Step 2 — Operator joins

On the operator device (different account):

privitty-edge join --link "OPENPGP4FPR:…"
curl -s -X POST http://127.0.0.1:7200/rpc \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","method":"secure_join","params":[1,"OPENPGP4FPR:…"],"id":1}'

Scan the QR code or open the invite link in the Privitty app.

Warning

The invite link must come from a different account. Joining your own invite will fail.

Monitor join progress on the gateway via SSE:

curl -N http://127.0.0.1:7200/events

Look for SecurejoinInviterProgress with progress: 1000.


Step 3 — Resolve operator's chat ID

After join completes, list chats:

curl -s -X POST http://127.0.0.1:7200/rpc \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","method":"get_chatlist_entries","params":[1,null,null,null],"id":1}' | jq .

curl -s -X POST http://127.0.0.1:7200/rpc \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","method":"get_chatlist_items_by_entries","params":[1,[7]],"id":2}' | jq .

Note the chat ID (e.g. 7) for the operator conversation.


Step 4 — Send encrypted message

curl -s -X POST http://127.0.0.1:7200/rpc \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","method":"send_msg","params":[1,7,{"text":"Line 3 batch complete — 1,240 units"}],"id":3}' | jq .
{"jsonrpc":"2.0","result":88,"id":3}

Message ID 88 confirms the send was queued.


Step 5 — Confirm delivery (optional)

Watch SSE for delivery receipts:

curl -N http://127.0.0.1:7200/events
data: {"type":"MsgDelivered","account_id":1,"chat_id":7,"msg_id":88}
data: {"type":"MsgRead","account_id":1,"chat_id":7,"msg_id":88}

Next