Skip to content

API at a glance

Everything crm-sdk exports, crm-sdk/messenger (the drawn messenger), and crm-sdk/debug. Each Value<T> has value and subscribe(listener); every promise that talks to PurrCRM rejects with a CrmFailure unless it says it answers null instead. The package’s .d.ts files carry the same, with a comment on each member.

new Crm({ config, auth, host? }) (CrmOptions). Making one touches neither window nor document.

  • config: CrmConfig, auth: CrmAuth — as made.
  • host: CrmHost — your hooks; assign a new object to hand in more later.
  • start(): Promise<void> — starts it once, in the browser: events read back, app_opened, the public face read, the page followed, the setup check loaded with debug.
  • session(session: CrmSession | null): void — who is signed in, or nobody.
  • setReady(ready: boolean): void — whether the user is past your own first steps.
  • dispose(): Promise<void> — lets go of listeners, timers and requests; waiting events stay for next time.
  • running: boolean — start has run and dispose has not.
  • currentSession: CrmSession | null — the session as last told.
  • sessionValue: Value<CrmSession | null> — the same, to subscribe to.
  • ready: Value<boolean> — as setReady last said.
  • publicApp: Value<CrmPublicApp | null> — the app’s public face: the one kept from the last load until PurrCRM answers.
  • appFeatures: Value<readonly CrmFeature[]> — the parts the app has on.
  • features: CrmFeature[] — the parts the user signed in has.
  • has(feature): boolean — whether the user has a part.
  • mayOpen(where: CrmDestination): boolean — whether the user may open a page.
  • reader: Value<CrmReader> — who the messenger reads as: { kind: "user", guestId }, { kind: "visitor", visitorId } or { kind: "none", visitorsOff }.
  • needReader(): Promise<boolean> — with nobody signed in, makes a visitor where your team lets them in; whether there is someone to write as. Call it as the messenger opens, never on the page’s load.
  • endVisitor(): Promise<void> — ends the visitor and forgets it.
  • productName: string — config.productName, else the brand’s name.
  • isTestMode: boolean — the build talks to a test app.
  • messenger: CrmMessenger — the home, earlier conversations and the badge.
  • unread: Value<number> — the badge.
  • conversation(id): CrmConversation — one conversation.
  • newConversation(): CrmConversation — a conversation its first message starts.
  • ticketConversation(ticket: SupportTicket): CrmConversation — a ticket’s conversation.
  • tickets(): CrmFetch<SupportTicketPage> — the user’s tickets.
  • ticket(id): CrmFetch<SupportTicket> — one ticket.
  • ticketForms(): Promise<TicketForms> — the forms the user may open a ticket from.
  • openTicket(body: NewTicketBody, idempotencyKey?): Promise<SupportTicket> — opens a ticket.
  • uploadPicture(file: Blob, { name?, type? }?): CrmUpload — one picture, for a message you send yourself.
  • helpCenter({ debounceMs? }?): CrmHelpCenter — collections, featured articles and a search.
  • collection(slug): CrmFetch<CollectionArticles> — one collection and its articles.
  • article(slug): CrmArticle — one article, and whether it helped.
  • inApp: CrmInApp — what to draw, and what the user did.
  • checkNow(): Promise<number | null> — checks in at once; how many tests arrived, or null.
  • showMessage(id): Promise<boolean> — shows the message a link names.
  • registerPushToken(token, { platform? }?): Promise<boolean> — the browser’s push token, registered for each user.
  • forgetPushToken(): Promise<boolean> — lets go of it for the user, before sign-out.
  • handlePushArrival(data): CrmPushResult — a push arrived while the page was open.
  • handlePushTap(data): boolean — a push was tapped; whether PurrCRM takes the user where it goes.
  • notices: Value<CrmNotices> — the inbox of notices.
  • refreshNotices(): Promise<void> — reads the first page again.
  • moreNotices(): Promise<void> — reads older notices.
  • markNoticesRead(ids, { all? }?): Promise<boolean> — marks notices read.
  • offersByPush(): Promise<boolean | null> — consent to offers by push.
  • setOffersByPush(on): Promise<boolean | null> — keeps it.
  • preferences(): Promise<CrmPreferences | null> — topics and channels.
  • setPreferences(choices, { allOff?, wording? }?): Promise<CrmPreferences | null> — keeps choices.
  • preferencesEditor({ wording? }?): CrmPreferencesEditor — backs a screen that changes a switch at a time.
  • handleLink(href): Promise<boolean> — the address the page loaded at (or a link of the app’s you came by): whether the SDK takes the user there (a link under the link base, or one of PurrCRM‘s pages on your own site), once a user is ready; crm_c and crm_l on your own page are counted and read, and answer false (Links).
  • createLink(path, { data?, channel? }?): Promise<CrmSharedLink | null> — a link for the user to share.
  • referralLink(): Promise<CrmReferralLink | null> — the user’s referral link.
  • open(where): Promise<boolean> — a page in place of the current one, through navigate.
  • show(where): Promise<boolean> — a page over the current one, through navigate.
  • openLink(link): boolean — follows a link from content by PurrCRM‘s rules.
  • linkTargetOf(link): LinkTarget | null — where it would go, without going.
  • track(name, props?): void — one of the SDK’s events, or one declared in customEvents.
  • screen(name): void — screen_viewed, unless it is the screen last named.
  • permissionChanged(permission: CrmPermission, allowed: boolean | null): Promise<void> — a permission’s answer.
  • flushEvents(): Promise<void> — sends what is waiting now.
  • CrmOptions — config, auth, host?.
  • CrmConfig — apiBase, appKey, appVersion, productName?, storagePrefix?, initialFeatures?, customEvents?, followLifecycle?, languageTag?, flushEveryMs?, store?, now?, fetch?, debug?, releaseBuild?, logger? (Initialise).
  • CrmAuth.tokens(tokens, { tokenFailure? }?) — tokens from a CrmTokens.
  • CrmAuth.unverified(userId) — the user’s id alone, as X-CRM-User-Id.
  • CrmAuth members — tokens, tokenFailure, userId, isUnverified.
  • CrmTokens (interface) — current(): Promise<string | null>, expired(token): Promise<void>.
  • CrmTokens.fetched(fetch, { now?, earlierMs? }?): CrmFetchedTokens — tokens from your backend.
  • CrmFetchedTokens — current(), expired(token), forget(), fetch, earlierMs (60 000).
  • CrmFetchedToken(token, expiresAt?) — a token and when it expires; expiry and lifetimeMs read its claims.
  • CrmNoTokens — the tokens of an app with none.
  • CrmSession — guestId, displayName?, productEventsOff?, features?.
  • sessionHas(session, feature) — whether a session lets its user have a part.
  • crmFeaturesFor(session, appFeatures) — the parts a user has.
  • CrmHost — navigate?, followable?, openInApp?, openExternal?, timeZone?, askPermission?, onUnreadChanged?, links?, linkOpened? (Host hooks).
  • CrmNavigation — "open" or "push".
  • openInNewTab(url): boolean — the default openExternal.
  • browserLanguage(): string — the default languageTag.
  • browserTimeZone(): string — the default timeZone.
  • CrmLogger — debug(message, data?), warn(message, data?); consoleLogger is the default.
  • CrmStore — prefix, read(name), write(name, value), remove(name), names(start).
  • LocalCrmStore(prefix?, storage?) — localStorage, in memory where refused; blocked says so.
  • MemoryCrmStore(prefix?) — in memory, for tests; values holds them.
  • crmStoreKey(prefix, name) — the key a name is kept under.
  • defaultStoragePrefix — "crm".
  • FetchFn — the fetch a config may hand in.
  • CrmRequestLine — one request as the debug log sees it: method, path, status, requestId, ms, code.
  • crmSdkVersion, crmSdkKind — this package’s version, and "web".
  • isTestAppKey(key) — whether a key is a test app’s.
  • Value<T> — value, subscribe(listener) (called at once, answers the function that stops it).
  • MutableValue<T> — a Value the SDK sets: set(next), clear(), listenerCount.
  • CrmFetch<T> — state: Value<Fetched<T>>, load(), close().
  • Fetched<T> — value, loading, message.
  • CrmFailure — why a request did not succeed; one of the four below.
  • CrmProblem — PurrCRM said no: problem, status, code, error, detail, requestId, scope, retryAfterMs; CrmProblem.of({...}) makes one.
  • CrmAppUnavailable — the app is archived or deleted; final for this Crm.
  • CrmOffline — PurrCRM could not be reached, or did not answer in time: reason, timedOut.
  • CrmContractError — PurrCRM answered something the SDK cannot read.
  • Problem — status, code, title, detail, requestId, scope, retryAfterSeconds.
  • CrmMessage — what to tell the user: sentence, detail, retry.
  • CrmSentence, crmSentences — offline, unavailable, rateLimited, rateLimitedGuest, signInAgain, badRequest, notFound, conversationGone, ticketGone, ticketFormGone, articleGone, ratingClosed, surveyClosed, botMovedOn, answerInvalid, attachmentInvalid, refused, somethingWentWrong.
  • CrmRetryHint — at, afterMs.
  • CrmAttempt — "messenger", "ticket", "help", "other": what “not found” means.
  • tellCrmFailure(failure, attempt, now?), tellCrmProblem(problem, attempt, now) — a failure as a CrmMessage.
  • CrmDestination (interface) — place, id.
  • CrmDestination.messenger, .newConversation, .tickets, .helpCenter, .preferences — the pages with no id.
  • CrmDestination.conversation(id), .ticket(id), .collection(slug), .article(slug), .message(id) — the pages with one.
  • CrmDestination.same(a, b), .feature(d), .gated(d), .link(d) — compare, the part that holds it back, whether one does, its path.
  • CrmPlace, crmPlaces — messenger, newConversation, conversation, tickets, ticket, helpCenter, collection, article, message, preferences.
  • CrmLinks — the paths (messages, newConversation, tickets, helpCenter, helpCollections, messageShow, preferences) and parse(link).
  • CrmMessenger — state, unread, load(), refresh(), loadMore().
  • MessengerState — home, earlier, nextBefore, unread, loading, loadingMore, message.
  • hasMoreConversations(state) — earlier conversations are left to read.
  • openingOf(state) — what the help bot says first, as the home last said.
  • CrmConversation — state, open(), close(), retry(), addPicture(file, name?, type?), addFile(file, name, type?), removePicture(key), send(text), resend(key), answerBot(part, { button?, value? }), clearBotNote(), rate(stars, remark?).
  • ChatState — id, ticketId, parts, status, lastSeq, reply, assignee, loading, loaded, gone, message, troubled, sending, sendMessage, sentSerial, pictures, note, rating, ratingMessage, shown, awaiting, botSending, botNote, botMessage, outgoing, opening, openingKnown, typing, seenSeq.
  • OutgoingMessage — key, text, pictures, at, status, message; OutgoingStatus is "sending" or "failed".
  • PendingPicture — key, file, name, contentType, status, sent, total, attachmentId, isFile, refused; PictureStatus is "uploading", "ready" or "failed".
  • ComposerNote — tooLong, tooManyPictures, pictureTooLarge, pictureWrongType, waitForPictures, tooManyFiles, fileTooLarge, fileWrongType, fileBadName.
  • checkFile(contentType, bytes, name): FileProblem | null (wrongType, tooLarge, badName), fileTypeOf(fileName), fileKindOf(contentType): FileKind (pdf, text, table, archive, document, spreadsheet, slides, other), fileSizeOf(bytes) (size, megabytes) — a file’s checks and how to draw it.
  • seenUnder(parts, seenSeq): string | null — the reader’s message to show Seen under.
  • BotNote — notEmail, notOrderRef, notText, refused.
  • RatingPhase — open, sending, sent, closed.
  • isNewChat(state), threadOf(state), ratingRequestOf(state), isUploading(state) — read a ChatState.
  • CrmUpload — file, name, contentType, done, progress, cancel(); CrmUploadProgress is sent, total.
  • placeParts(parts, gapMs?) — each part’s PartPlace: firstOfRun, newDay, timed.
  • teammatesOf(conversations, most?) — the teammates who wrote last.
  • replyLine(reply, now) — a ReplyLine: { kind: "within", within } or { kind: "backAt", at, today }.
  • NewTicketSession(source, { forms?, now?, newKey? }?) — a new ticket’s state: state, load(), choose(form), unchoose(), title(s), text(s), setValue(key, value), send(), close(). source is the Crm, or anything with ticketForms() and openTicket() (NewTicketSource).
  • NewTicketState — forms, loading, loadMessage, form, draft, problems, tried, sending, message, ticket; isPicking(state) says the user is choosing between forms.
  • TicketDraft — title, text, values; emptyTicketDraft. TicketFieldValue — text, boolean, date; emptyTicketFieldValue, isEmptyValue(v).
  • TicketDraftProblem — problem, max, detail; TicketProblem is "missing", "tooLong", "notANumber" or "refused".
  • checkTicketDraft(form, draft), ticketBody(form, draft), ticketProblemFrom(form, detail), ticketNumberOf(words), ticketDay(day), ticketFieldTarget(key), ticketTitleTarget, ticketTextTarget — a new ticket’s rules, as NewTicketSession keeps them.
  • CrmHelpCenter — state, load(), search(query), close().
  • HelpCenterState — collections, featured, loaded, loading, message, query, results, searching, searched, searchMessage.
  • isSearch(state) — a search is typed.
  • CrmArticle — slug, state, load(), rate(helpful), close().
  • ArticleState — article, loading, message, helpful, rating, rateMessage, answer.
  • drawnBlocks(blocks) — the blocks to draw, unknown types left out.
  • plainText(blocks) — their words, a line each.
  • linkTarget(link, follow) — where a link goes by the content’s rules; LinkTarget is { kind: "inApp", location } or { kind: "web", url }.
  • CrmInApp — state, next, banner, testPhone, shown(m), dismissed(m), completed(m), closed(m), openLink(m, link), survey(m), carousel(m), checkNow().
  • InAppState — banner, waiting, showing, testPhone; nextOf(state) is the one to show next.
  • CrmLinkWent — "inApp", "web" or null.
  • CrmSurvey — message, survey, state, shown(), answer(questionId, given), next(), back(), dismiss(), close().
  • SurveyState — step, answers, missing, sending, failed, done, over, canGoBack.
  • SurveyAnswers — answers by question id; SubmitOutcome is "sent", "closed" or "failed".
  • nextStep(survey, i, answers), surveyPath(survey, answers), unansweredRequired(survey, i, answers), answersOnPath(survey, answers), answerFits(question, answer) — a survey’s rules, as CrmSurvey keeps them.
  • CrmCarousel — message, flow, state, shown(), tap(button), pick(option), swipeForward(), back(), openLink(link), dismiss().
  • CarouselState — at, screen, buttons, picked, busy, progress, dot, canGoBack, over.
  • CarouselFlow(carousel) — the screens as a graph: screens, startIndex, screenIndex(id), nextOf(i), resolve(i, to), targets(i), backs(i), reachable(), deadEnds(), buttonsOf(i), leadOf(i, button), leadOfOption(i, option), leadOfNext(i), endsAtNext(i), swipesForward(i), pathAhead(i), line, linear, progress(dotsUpTo?), picturesOf(i); implicitNext and implicitContinue are the buttons it adds.
  • CarouselWalk(flow) — one way through: at, screen, behind, canGoBack, path, go(index), back(), progress, dot.
  • CarouselLead — where a tap leads: a screen (index), the end, back, or a link; carouselEndIndex is -1.
  • CrmPushResult — isCrm, replyOnScreen, noticeId, silent.
  • readCrmPush(data) — a push’s data read: CrmPush with isCrm, type, noticeId, link, silent.
  • CrmNotices — notices, unread, loaded, loading, failure, nextBefore.
  • CrmPreferencesEditor — state, load(), choose(topicId, channel, on), turnAllOff(), close().
  • PreferencesState — preferences, loading, message, saving, saveMessage, kept.
  • CrmPermission — "push" or "location".
  • CrmLink — a declared place: name, path, webUrl?, screen?.
  • CrmLinkContext — a link about to be followed: path, from, saved, data, campaign, channel.
  • CrmLinkSpace — prefix (/l/), clickParam (crm_c), slugParam (crm_l), shortRoot (go), shortSlug(path), inAppPath(link, base, apiBase).
  • InAppPath — what inAppPath answers: path, token, saved.
  • canDigest() — the page has WebCrypto.
  • crmLinksDigest(links) — the digest a check-in sends.
  • parseTemplate(path) — a place’s path as a LinkTemplate (segments, query of TemplateParts: lit? or param?), or why PurrCRM would refuse it.
  • templateParams(t), fillTemplate(t, values), matchTemplate(t, link) — a template’s placeholders, filled, matched.
  • matchLink(catalogue, link) — which of several places a link is, and its values; LinkParam is key, type, options?.

What PurrCRM answers, as plain read-only objects. A word the SDK does not know reads as "unknown".

  • CrmPublicApp — key, handle, mode, brand, features, currency, languages, linkBase, minSdkVersion, orderRef.
  • CrmPublicBrand — name, accent, logoUrl, supportEmail.
  • CrmOrderRef — label, example, pattern, prop, upper.
  • MessengerHome — open, reply, articles, tickets, unread, opening, layout.
  • MessengerLayout — greeting, intro, faces, team, names, replyText, awayText, cards, newConversation, attachments, files, helpCenter.
  • HomeCard — id, kind, title, text, link, articles.
  • MessengerOpening — parts, awaiting, workflow, version; OpeningRef is workflow, version.
  • ReplyExpectation — within, open, opensAt.
  • ConversationSummary — id, state, preview, previewAuthor, unread, createdAt, updatedAt.
  • ConversationPage — items, nextBefore.
  • Conversation — id, ticketId, state, parts, lastSeq, unread, reply, assignee, awaiting, seenSeq, createdAt, updatedAt.
  • ConversationUpdate — parts, state, lastSeq, unread, awaiting, typing, seenSeq, live.
  • Part — id, seq, kind, author, text, blocks, attachments (pictures), files, bot, rating, state, createdAt.
  • Author — kind, name.
  • BotPart — kind, buttons, collect, orderRef, articles, reply; BotButton is id, label.
  • Attachment — id, url, contentType, bytes, expiresAt, name.
  • SupportTicket — id, ref, type, title, state, fields, description, conversationId, parts, createdAt, updatedAt, resolvedAt.
  • SupportTicketSummary — id, ref, type, title, state, updatedAt; SupportTicketPage is items.
  • TicketField — key, label, type, text, number, boolean, date.
  • TicketForms — items. TicketForm — id, name, description, fields. TicketFormField — key, label, type, options, required.
  • NewTicketBody — typeId, title, text, fields.
  • Collection — id, slug, title, description, articles (a count); Collections is items.
  • CollectionArticles — collection, articles.
  • Article — id, slug, title, summary, blocks, collection, related, language, languages, updatedAt.
  • ArticleSummary — id, slug, title, summary, collection, updatedAt; Articles is items.
  • ContentBlock — type, spans, level, items, imageUrl, alt, aspect, fit, shape, size, label, link, style, tone, color, emoji, align, weight.
  • Span — text, bold, italic, underline, strike, highlight, color, link; ListItem is spans.
  • InAppMessage — id, kind, variant, test, screens, and one of banner, post, carousel, survey.
  • InAppBanner — blocks, style, dismissible, link.
  • InAppPost — blocks, sender.
  • Survey — format, intro, steps.
  • SurveyStep — id, kind, blocks, questions, branches.
  • SurveyQuestion — id, type, title, description, required, options, other, min, max, minLabel, maxLabel, placeholder; SurveyOption is id, label.
  • SurveyBranch — questionId, values, min, max, next.
  • SurveyAnswer — questionId, number, choices, other, text.
  • Carousel — screens, start, progress, skip, presentation, locked, style.
  • CarouselScreen — id, layout, image, background, blocks, buttons, choice, next, align, valign, style.
  • CarouselButton — id, label, style, action, screen, link, permission.
  • CarouselChoice — multiple, options; CarouselOption is id, label, emoji, next.
  • CarouselImage — url, alt, aspect, fit, shape, size.
  • CarouselBackground — kind, color, color2, angle, imageUrl, scrim.
  • CarouselStyle — accent, corner, buttonShape, textScale.
  • Checkin — messages, nextCheckinSeconds, throttled, testPhone, unread, unreadNotices, sendLinks.
  • CrmNotice — id, type, title, body, link, createdAt, readAt; CrmNoticePage is notices, unread, nextBefore.
  • CrmUnreadCount — unread.
  • CrmConsent — offersByPush.
  • CrmPreferences — topics, allOff.
  • CrmPreferenceTopic — id, name, description, channels; CrmPreferenceState is channel, subscribed.
  • CrmPreferenceChoice — topicId, channel, subscribed.
  • CrmSharedLink, CrmReferralLink — url, shortUrl, slug.
  • SavedLinkOpen — path, saved, data, campaign, channel.
  • CrmPublicLinkApp — key, name, brand, linkBase, appStoreUrl, playStoreUrl.
  • CrmPublicPreferences — product, accent, logoUrl, email, preferences.
  • EventsAccepted — accepted, rejected (EventRejected: index, id, reason).
  • AttachmentUpload — id, url, fields, maxBytes, expiresAt.
  • CrmProblemBody — status, code, title, detail, requestId; CrmRateLimited is scope, retryAfterSeconds.

You rarely build these; the facade does: CheckinBody, ReceiptBody, SurveyAnswerBody, SurveySubmit, OpenMessageBody, EventsBody, EventBody, MessageBody, StartBody, BotReplyBody, RatingBody, ReadBody, AttachmentBody, ArticleRatingBody, CrmPublicRatingBody, CrmDeviceBody, CrmForgetDeviceBody, CrmNoticesReadBody, CrmConsentBody, CrmPreferencesBody, ShareLinkBody, LinkClaimBody, AppLinksReport, DeclaredLink.

The shapes of a contact’s data export, shared with the API: ExportContact, ExportAttribute, ExportArticleRating, ExportCollected, ExportConversation, ExportPart, ExportNote, ExportEvent, ExportReceipt, ExportSurveyResponse, ExportSurveyAnswer, ExportTestPhone, ExportTestSend, ExportTicket, ExportWorkflowRun, CrmExportConsentChange, CrmExportDevice, CrmExportNotice, CrmExportSubscription.

Each is a type and the list of its words (AuthorKind and authorKinds, and so on); every type also takes "unknown".

  • AuthorKind — guest, teammate, bot, system.
  • PartKind — message, reply, note, bot, assignment, state, rating_request.
  • BotKind — says, asks, collects, suggests, hands_off, resolves.
  • CollectField — text, email, order_ref.
  • ConversationState — open, snoozed, closed.
  • ReplyTime — minutes, hours, day.
  • HomeCardKind — send, search_help, articles, conversations, tickets, link, status.
  • NewConversations (newConversationsWords) — always, when_none_open, never.
  • TeamFaces (teamFacesWords) — auto, chosen, none.
  • TicketState — submitted, in_progress, waiting_on_guest, resolved.
  • FieldType — text, list, number, bool, date.
  • MessageKind — chat, post, banner, carousel, survey, push, email.
  • BannerStyle — inline, floating.
  • ReceiptAction — seen, clicked, dismissed, completed, answered.
  • SurveyFormat — small, large; SurveyStepKind — questions, thank_you.
  • QuestionType — nps, numeric, stars, emoji, dropdown, short_text, long_text, single_choice, multi_choice.
  • CarouselButtonAction (buttonActions) — next, screen, back, end, link, permission.
  • CarouselPermission — notifications, location.
  • CarouselPresentation — sheet, card, full; CarouselProgress — dots, bar, none.
  • CarouselLayout — centred, image_top, image_full, text.
  • CarouselCorner, CarouselButtonShape, CarouselTextScale, CarouselScrim, BackgroundKind — a carousel’s look.
  • BlockType — paragraph, heading, bullets, numbers, image, button, divider, eyebrow, callout, checklist, spacer, emoji.
  • CalloutTone — info, good, warn.
  • ContentAlign, ContentVAlign, ContentButtonStyle, ColorToken, TextSize, TextWeight, SpacerSize, ImageAspect, ImageFit, ImageShape, ImageSize — how a block is drawn.
  • CrmFeature — messenger, help_center, in_app_messages.
  • CrmEvent — app_opened, session_ended, screen_viewed, app_updated, push_permission_changed, location_permission_changed, push_opened, link_opened.
  • CrmPushType — support_reply, crm_message.
  • CrmPlatform, CrmPushPlatform — ios, android, web.
  • CrmPreferenceChannel — email, push, in_app, chat.
  • CrmErrorCode — bad_request, unauthorized, token_expired, not_found, rate_limited, unavailable, internal_error, app_key_required, app_unavailable, refused, rating_closed, attachment_invalid, survey_closed, bot_moved_on, answer_invalid, visitors_off, visitor_ended, visitor_merged_elsewhere.
  • CrmLimitScope — guest.
  • SdkKind — the SDKs’ kinds, as X-Crm-Sdk-Kind says them.

The drawn messenger (Add the messenger to your website).

  • attachMessenger(crm, options?, doc?): CrmDrawnMessenger — draws the launcher, the messenger and the in-app messages over the page.
  • CrmMessengerOptions — opens?, launcher?, signIn?, inAppMessages?, phoneWidth?, emoji?, language?, words?, sound?, desktopNotifications?.
  • CrmDrawnMessenger — isOpen, open(space?), newConversation(), close(), toggle(), show(where), showLauncher(shown), setLanguage(tag, words?), askToNotify(), remove().
  • CrmMessengerSpace — "home", "messages", "help" or "tickets".
  • CrmMessengerWords, CrmMessengerWord — a table of your own words: words, words with {name}s, a function, a list, or a nested table (sentences, account, ticketForm).
  • crmWordTableProblems(table): Record<string, string> — the entries a table has that would not be used, with why.
  • boot(config, settings?): CrmMessengerApi | null — what the one tag runs; CrmMessengerBoot is apiBase, appKey.
  • CrmMessengerSettings — window.crmMessengerSettings: user?, opens?, launcher?, signIn?, customEvents?, appVersion?, emoji?, language?, words?, sound?, desktopNotifications?. CrmMessengerUser is id, name?, token?.
  • CrmMessengerApi — window.CrmMessenger: crm, messenger, signIn(user), signOut(), open(space?), newConversation(), close(), toggle(), showLauncher(shown), setLanguage(tag, words?), askToNotify(), onUnread(listener), onReader(listener), track(name, props?), page(href?), endVisitor().
  • themeOf(app, darkMode, reducedMotion), accentOf(app, darkMode), isDark(look, systemDark), inkOn(hex) — the look as the messenger draws it.

The setup check, loaded by itself with debug: true.

  • attachSetupCheck(crm, doc?): SetupPanel — draws the panel once.
  • SetupPanel — host (its element), refresh(), remove().
  • gatherFacts(crm): Promise<SetupFacts> — what the checks look at, with the token and guest calls.
  • runChecks(facts): SetupCheck[] — every check, in the panel’s order.
  • tally(checks) — ok, of and the worst status.
  • reportText(checks, facts): string — the report.
  • SetupCheck — id, section, title, status, summary, detail, fix.
  • CheckStatus — "ok", "warn", "fail", "skip".
  • CheckSection, checkSections — SDK, App, Auth, Events, Pushes, Links, Host, Storage.
  • SetupFacts — now, sdk, config, run, publicApp, auth, token, guestCall, session, events, push, links, host, storage, online.
  • FailureFact — kind, status, code, detail, requestId.
  • setupCheckVersion — the report’s version.