Entries
All the data sent by someone to an Inbox is called an Entry. In Threads and Stores, a user must be assigned to the Module to send data. In Inboxes, however, anyone who has Inbox ID can send a reply (assuming they have the Bridge URL and Solution ID).
Inboxes allow users to receive encrypted entries, either from external or internal sources.
-
Internal sources are people who have access to an Inbox, or are simply registered in a given Context. Those users are known to your application, and their entries can be linked to their accounts.
-
External sources are people from the outside; they do not have an account linked with your app. For example, someone who fills out an online contact form without the need to create an account.
About Entries
The structure of an entry and a brief description of its elements is outlined in the following table:
| Field | Type | Encrypted | Description |
|---|---|---|---|
data | binary | Content of the entry | |
files | File[] | List of attached files | |
authorPubKey | string | Public key of the author |
Define Data Structure
Inbox's architecture does not require you to use a specific data structure inside the entries. Before working with Inboxes, define the structure of your entries.
We recommend future-proofing your entries by choosing an easily modifiable format. It is a good idea to include both a type and a version field in the structure.
Example: Form with Text Answer
The type field allows future support for different types of entries like: "select_answer", or "multi_select".
And in case of changing the schema, you can always distinguish between them using "version" field.
Remember that this is only an example and you should consider your app's requirements and limitations.
Entry's publicMeta and privateMeta fields support any kind of data formats encoded to byte arrays. Examples in this section use kotlinx-serialization-json-jvm dependency for Kotlin and com.google.code.gson:gson for Java to serialize object to JSON format.
Sample code on this page is based on the initial assumptions.
Sending Entries Using Public API
Public submissions require using connectPublic function, provided by the Connection class, to establish a public connection to the platform.
After connecting, create an InboxApi instance, which allows to operate on Inboxes.
Assuming you need some kind of structure in entries, define a data struct InboxPublicEntryData, and its instance:
Define structure of data sending to Inbox entry:
Now, having established public connection and inboxApi, you can send data to the Inbox:
Listing Entries
Created entries can be listed by non-public connections created using PrivmxEndpoint class.
Listing the most recent Entries in given Inbox:
Reading Files from Entries
Files from Entries can be read by non-public connections created using PrivmxEndpoint class.
We use cookies on our website. We use them to ensure proper functioning of the site and, if you agree, for purposes such as analytics, marketing, and targeting ads.
PrivMX Endpoint Java v2.6