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 container to send data. In Inboxes, however, anyone who has Inbox ID can send a reply (assuming they have the Bridge URL and Solution ID).
Info
The sample code on this page is based on the same assumptions mentioned in Fist App.
Public Connection
Endpoint provides different ways to connect to a Bridge instance.
When using "public" connection you don't have to pass a private key. A random private key will be generated for each connection. The public connection provides only the methods related to sending Inbox entries and retrieving public metadata related to the Inbox.
To submit data using public connection use sendDataToInbox
:
const publicConnection = await EndpointApi.connectPublic(
"SOLUTION_ID",
"BRIDGE_URL"
);
You have to pass required Bridge URL and Solution ID. Then use an inboxApi
.
Submitting Entries
const inboxHandle = await inboxApi.prepareEntry(
"INBOX_ID",
serializeObject("text to send"),
[], // no files this time
undefined // if logged with private connection, use user private key here.
);
await inboxApi.sendEntry(
inboxHandle
);
Fetching Entries
Fetching entries requires secure private connection.
Fetching the most recent Entries submitted to Inbox:
const defaultListQuery = {skip:0, limit: 100, sortOrder: "desc"};
const entries = inboxApi.listEntries(
"INBOX_ID",
defaultListQuery
);