Conversations between an account and the creators it works with. Everything an inbox needs is in the API, so you can build your own.
Start a conversation
POST /v1/threads opens a direct conversation with a creator you work with, or returns the existing one. Include a first message if you like:
const { data: thread } = await lucra.threads.create({
body: { kind: "direct", with: "crtr_06ZqNevhUeDnqxzC6VkeuQr", message: { body: "Welcome aboard!" } },
})
kind: "program" opens a program's group chat instead, with program set to its ID.
Read and reply
GET /v1/threads lists conversations, most recently active first. GET /v1/messages?thread=thr_… reads one. Reply with POST /v1/messages:
await lucra.messages.create({ body: { thread: thread.id, body: "Loved the first cut!" } })
PATCH /v1/messages/:id edits or deletes a message you sent (send its version), sets a reaction like { "reaction": { "emoji": "🎉", "active": true } }, or reports a message. One change per request.
Notes
- A partner does all of this as a roster creator with
Lucra-Account: crtr_…. - The
message.createdwebhook tells you when a message arrives. - Read state, muting and live updates are yours to keep in your own app: track what each of your users has seen by message ID.
Endpoints
/v1/messagesList messages
const { data } = await lucra.messages.list({
query: { thread: "thr_…" },
})Response200A page of items, 12 fields each, and nextCursorShow
idstringthreadstringsenderobjectShow 4 child fieldsHide child fields
idstringtypeenumorganizationcreatorsupportnamestringnullableavatarstringnullable
automatedbooleanbodystringfilesobject[]Show 8 child fieldsHide child fields
idstringnamestringkindenumimagevideodocumentsizenumbernullablewidthnumbernullableheightnumbernullableurlstringnullablethumbnailUrlstringnullable
replyTostringnullablereactionsobject[]Show 2 child fieldsHide child fields
emojistringactorsstring[]
createdAtstringeditedAtstringnullabledeletedAtstringnullableversioninteger
/v1/messagesSend a message
const { data } = await lucra.messages.create({
body: { thread: "thr_…" },
})Body
threadthr_…· requiredbodystringfilesfile_…[]Attachments:
chat_attachmentfiles.replyTomsg_…
Response20112 fieldsShow
idstringthreadstringsenderobjectShow 4 child fieldsHide child fields
idstringtypeenumorganizationcreatorsupportnamestringnullableavatarstringnullable
automatedbooleanbodystringfilesobject[]Show 8 child fieldsHide child fields
idstringnamestringkindenumimagevideodocumentsizenumbernullablewidthnumbernullableheightnumbernullableurlstringnullablethumbnailUrlstringnullable
replyTostringnullablereactionsobject[]Show 2 child fieldsHide child fields
emojistringactorsstring[]
createdAtstringeditedAtstringnullabledeletedAtstringnullableversioninteger
/v1/messages/:idEdit or delete a message the caller sent (at its version), react to a message, or report it; one change per request
const { data } = await lucra.messages.update({
path: { id: "…" },
body: { version: 1000 },
})Path parameters
idstring· required
Body
versionintegerThe message's
versionas read; required to edit or delete.bodystringNew text for a message the caller sent.
statusstringDelete a message the caller sent.
deletedreactionobjectAdd or remove the caller's emoji reaction.
Show 2 child fieldsHide child fields
emojistring· requiredactiveboolean· requiredtrue adds the reaction, false removes it.
reportobjectReport the message to Lucra.
Show 2 child fieldsHide child fields
reasonenum· requiredspamharassmentunsafe_contentotherdetailstring
Response20012 fieldsShow
idstringthreadstringsenderobjectShow 4 child fieldsHide child fields
idstringtypeenumorganizationcreatorsupportnamestringnullableavatarstringnullable
automatedbooleanbodystringfilesobject[]Show 8 child fieldsHide child fields
idstringnamestringkindenumimagevideodocumentsizenumbernullablewidthnumbernullableheightnumbernullableurlstringnullablethumbnailUrlstringnullable
replyTostringnullablereactionsobject[]Show 2 child fieldsHide child fields
emojistringactorsstring[]
createdAtstringeditedAtstringnullabledeletedAtstringnullableversioninteger
/v1/threadsList the conversations the account (or, acting as a creator, the creator) takes part in, most recently active first
const { data } = await lucra.threads.list({
query: { kind: "direct" },
})Query parameters
kindenumdirectprogramsupportprogramprog_…
Plus paging: limit, cursor, createdAfter and createdBefore.
Response200A page of items, 15 fields each, and nextCursorShow
idstringkindenumdirectprogramsupportaccountstringnullableprogramstringnullableprogramNamestringnullablesupportobjectnullableShow 2 child fieldsHide child fields
statusenumwaiting_on_lucrawaiting_on_customerresolvedresolvedAtstringnullable
participantsobject[]Show 3 child fieldsHide child fields
actorobjectShow 4 child fieldsHide child fields
idstringtypeenumorganizationcreatorsupportnamestringnullableavatarstringnullable
lastReadstringnullablejoinedAtstring
lastMessageobjectnullableShow 12 child fieldsHide child fields
idstringthreadstringsenderobjectShow 4 child fieldsHide child fields
idstringtypeenumorganizationcreatorsupportnamestringnullableavatarstringnullable
automatedbooleanbodystringfilesobject[]Show 8 child fieldsHide child fields
idstringnamestringkindenumimagevideodocumentsizenumbernullablewidthnumbernullableheightnumbernullableurlstringnullablethumbnailUrlstringnullable
replyTostringnullablereactionsobject[]Show 2 child fieldsHide child fields
emojistringactorsstring[]
createdAtstringeditedAtstringnullabledeletedAtstringnullableversioninteger
mutedbooleanblockedstring[]canSendbooleanunreadCountintegercreatedAtstringupdatedAtstringversioninteger
/v1/threadsOpen a direct conversation with an account or creator you work with (an account can also message any creator it finds in the marketplace), a program's group chat or a Lucra Support thread; an existing one is returned
const { data } = await lucra.threads.create({
body: { kind: "direct" },
})Body
kindenum· requireddirect: one account or creator; program: a program's group chat; support: Lucra Support.
directprogramsupportwithstringdirect: the account (acct_) or creator (crtr_) to talk to; a creator must work with the account (and the reverse).
programstringprogram: the program (prog_) whose group chat to open.
messageobjectA first message, sent when the conversation is new.
Show 2 child fieldsHide child fields
bodystringThe message text.
filesstring[]Attachments:
chat_attachmentfiles (file_).
Response20115 fieldsShow
idstringkindenumdirectprogramsupportaccountstringnullableprogramstringnullableprogramNamestringnullablesupportobjectnullableShow 2 child fieldsHide child fields
statusenumwaiting_on_lucrawaiting_on_customerresolvedresolvedAtstringnullable
participantsobject[]Show 3 child fieldsHide child fields
actorobjectShow 4 child fieldsHide child fields
idstringtypeenumorganizationcreatorsupportnamestringnullableavatarstringnullable
lastReadstringnullablejoinedAtstring
lastMessageobjectnullableShow 12 child fieldsHide child fields
idstringthreadstringsenderobjectShow 4 child fieldsHide child fields
idstringtypeenumorganizationcreatorsupportnamestringnullableavatarstringnullable
automatedbooleanbodystringfilesobject[]Show 8 child fieldsHide child fields
idstringnamestringkindenumimagevideodocumentsizenumbernullablewidthnumbernullableheightnumbernullableurlstringnullablethumbnailUrlstringnullable
replyTostringnullablereactionsobject[]Show 2 child fieldsHide child fields
emojistringactorsstring[]
createdAtstringeditedAtstringnullabledeletedAtstringnullableversioninteger
mutedbooleanblockedstring[]canSendbooleanunreadCountintegercreatedAtstringupdatedAtstringversioninteger
/v1/threads/:idGet a conversation; its messages are GET /v1/messages?thread=
const { data } = await lucra.threads.retrieve({
path: { id: "…" },
})Path parameters
idstring· required
Response20015 fieldsShow
idstringkindenumdirectprogramsupportaccountstringnullableprogramstringnullableprogramNamestringnullablesupportobjectnullableShow 2 child fieldsHide child fields
statusenumwaiting_on_lucrawaiting_on_customerresolvedresolvedAtstringnullable
participantsobject[]Show 3 child fieldsHide child fields
actorobjectShow 4 child fieldsHide child fields
idstringtypeenumorganizationcreatorsupportnamestringnullableavatarstringnullable
lastReadstringnullablejoinedAtstring
lastMessageobjectnullableShow 12 child fieldsHide child fields
idstringthreadstringsenderobjectShow 4 child fieldsHide child fields
idstringtypeenumorganizationcreatorsupportnamestringnullableavatarstringnullable
automatedbooleanbodystringfilesobject[]Show 8 child fieldsHide child fields
idstringnamestringkindenumimagevideodocumentsizenumbernullablewidthnumbernullableheightnumbernullableurlstringnullablethumbnailUrlstringnullable
replyTostringnullablereactionsobject[]Show 2 child fieldsHide child fields
emojistringactorsstring[]
createdAtstringeditedAtstringnullabledeletedAtstringnullableversioninteger
mutedbooleanblockedstring[]canSendbooleanunreadCountintegercreatedAtstringupdatedAtstringversioninteger