Ppoppo Docs

Event Streaming

ExternalMessageService.StreamSendRequestEvents is a server-streaming RPC that delivers real-time events for your send requests. It replaces webhooks: your server opens the connection, so there is no public endpoint to expose, and gRPC TLS provides authentication and integrity (no HMAC signatures to verify).

Event types

Event typeMeaning
RECIPIENT_DELIVEREDMessage delivered to the recipient
RECIPIENT_FAILEDDelivery failed
RECIPIENT_PENDING_CONSENTAwaiting the recipient's consent
CONSENT_GRANTEDThe recipient allowed messages from your app
CONSENT_DENIEDThe recipient declined
REQUEST_COMPLETEDAll recipients in a send request were processed
POLL_RESPONSE_RECEIVEDA recipient answered a poll

Event payload

Each SendRequestEvent contains:

FieldTypeDescription
event_idstringULID — unique event id; use it as your cursor
send_request_idstringThe send request this event belongs to
event_typeenumOne of the types above
recipientoptionalPresent for per-recipient events (ppnum, error_code, …)
summaryoptionalPresent for REQUEST_COMPLETED (delivered, failed, …)
occurred_atstringEvent timestamp (RFC 3339)

Reconnection

Pass after_event_id to resume from where you left off. Event IDs are ULIDs (chronologically sortable), and events missed during a disconnect are replayed on reconnect. Filter to a single send request with send_request_id, or omit it to receive all events for your app.

let mut cursor = load_saved_cursor().await;  // persisted last_event_id
loop {
    let mut client = connect_client(&token).await;
    if let Err(e) = stream_events(&mut client, cursor.clone()).await {
        eprintln!("stream error: {e}; reconnecting…");
        // back off before retrying
    }
    cursor = load_saved_cursor().await;       // updated as events arrive
}

Persist last_event_id durably — it's how the stream resumes without gaps. See Security.

First-time recipients must consent before they receive messages. Handle the RECIPIENT_PENDING_CONSENT / CONSENT_GRANTED / CONSENT_DENIED events — the bulk-messaging guide walks through the consent flow.