From caf6919eb6f119f96fc90467f84f744e8fa103a7 Mon Sep 17 00:00:00 2001 From: fern-api <115122769+fern-api[bot]@users.noreply.github.com> Date: Thu, 11 Sep 2025 21:45:42 +0000 Subject: [PATCH] SDK regeneration --- README.md | 32 +- package.json | 2 +- reference.md | 9957 ++++++++++++----- src/Client.ts | 62 +- src/api/errors/TooManyRequestsError.ts | 19 + src/api/errors/index.ts | 3 +- src/api/resources/admins/client/Client.ts | 55 +- .../requests/ConfigureAwayAdminRequest.ts | 13 +- .../client/requests/FindAdminRequest.ts | 4 +- src/api/resources/admins/types/Admin.ts | 20 +- src/api/resources/aiAgent/types/AiAgent.ts | 6 +- src/api/resources/aiContent/client/Client.ts | 982 ++ src/api/resources/aiContent/client/index.ts | 1 + .../CreateContentImportSourceRequest.ts | 27 + .../requests/CreateExternalPageRequest.ts | 30 + .../DeleteContentImportSourceRequest.ts | 16 + .../requests/DeleteExternalPageRequest.ts | 16 + .../requests/GetContentImportSourceRequest.ts | 16 + .../client/requests/GetExternalPageRequest.ts | 16 + .../UpdateContentImportSourceRequest.ts | 44 + .../requests/UpdateExternalPageRequest.ts | 33 + .../aiContent/client/requests/index.ts | 8 + src/api/resources/aiContent/index.ts | 2 + .../aiContent/types/ContentImportSource.ts | 45 + .../types/ContentImportSourcesList.ts | 18 + .../resources/aiContent/types/ExternalPage.ts | 37 + .../aiContent/types/ExternalPagesList.ts | 18 + src/api/resources/aiContent/types/index.ts | 4 + .../aiContentSource/types/ContentSource.ts | 8 +- src/api/resources/articles/client/Client.ts | 47 +- .../client/requests/DeleteArticleRequest.ts | 4 +- .../client/requests/FindArticleRequest.ts | 4 +- .../client/requests/UpdateArticleRequest.ts | 16 +- .../articles/client/requests/index.ts | 1 - .../articles/types/ArticleListItem.ts | 4 +- .../articles/types/ArticleSearchHighlights.ts | 6 +- ...esResponse.ts => ArticleSearchResponse.ts} | 10 +- .../articles/types/InternalArticle.ts | 10 + src/api/resources/articles/types/index.ts | 3 +- .../awayStatusReasons/client/Client.ts | 170 + .../awayStatusReasons/client/index.ts | 1 + src/api/resources/awayStatusReasons/index.ts | 1 + src/api/resources/calls/client/Client.ts | 540 + src/api/resources/calls/client/index.ts | 1 + .../calls/client/requests/ListCallsRequest.ts | 18 + .../ListCallsWithTranscriptsRequest.ts | 14 + .../requests/ShowCallRecordingRequest.ts | 16 + .../calls/client/requests/ShowCallRequest.ts | 16 + .../requests/ShowCallTranscriptRequest.ts | 16 + .../resources/calls/client/requests/index.ts | 5 + src/api/resources/calls/index.ts | 2 + src/api/resources/calls/types/Call.ts | 42 + .../types/ListCallsWithTranscriptsResponse.ts | 23 + src/api/resources/calls/types/index.ts | 2 + src/api/resources/companies/client/Client.ts | 84 +- .../requests/AttachContactToCompanyRequest.ts | 10 +- .../requests/ListAttachedContactsRequest.ts | 8 - .../companies/client/requests/index.ts | 1 - src/api/resources/companies/types/Company.ts | 12 +- src/api/resources/contacts/client/Client.ts | 282 +- .../client/requests/ArchiveContactRequest.ts | 2 +- .../client/requests/BlockContactRequest.ts | 16 + .../client/requests/DeleteContactRequest.ts | 2 +- .../client/requests/FindContactRequest.ts | 2 +- .../client/requests/MergeContactsRequest.ts | 8 +- .../ShowContactByExternalIdRequest.ts | 16 + .../requests/UnarchiveContactRequest.ts | 2 +- .../client/requests/UpdateContactRequest.ts | 10 + .../contacts/client/requests/index.ts | 2 + src/api/resources/contacts/types/Contact.ts | 24 +- .../contacts/types/ContactsCreateResponse.ts | 10 + .../contacts/types/ContactsFindResponse.ts | 10 + .../types/ContactsMergeLeadInUserResponse.ts | 10 + .../contacts/types/ContactsUpdateResponse.ts | 10 + .../types/ShowContactByExternalIdResponse.ts | 10 + src/api/resources/contacts/types/index.ts | 5 + .../resources/conversations/client/Client.ts | 415 +- .../AttachContactToConversationRequest.ts | 4 +- .../requests/AutoAssignConversationRequest.ts | 5 +- .../ConvertConversationToTicketRequest.ts | 10 +- .../requests/CreateConversationRequest.ts | 2 +- .../requests/DeleteConversationRequest.ts | 16 + .../requests/FindConversationRequest.ts | 8 +- .../requests/ReplyToConversationRequest.ts | 35 +- .../requests/UpdateConversationRequest.ts | 21 +- .../conversations/client/requests/index.ts | 3 +- .../conversations/types/Conversation.ts | 24 +- .../customChannelEvents/client/Client.ts | 535 + .../customChannelEvents/client/index.ts | 1 + .../NotifyAttributeCollectedRequest.ts | 26 + .../requests/NotifyNewMessageRequest.ts | 24 + .../NotifyQuickReplySelectedRequest.ts | 24 + .../client/requests/index.ts | 3 + .../resources/customChannelEvents/index.ts | 1 + .../customObjectInstances/client/Client.ts | 589 + .../customObjectInstances/client/index.ts | 1 + ...eateOrUpdateCustomObjectInstanceRequest.ts | 31 + ...ustomObjectInstancesByExternalIdRequest.ts | 21 + .../DeleteCustomObjectInstancesByIdRequest.ts | 18 + ...ustomObjectInstancesByExternalIdRequest.ts | 18 + .../GetCustomObjectInstancesByIdRequest.ts | 21 + .../client/requests/index.ts | 5 + .../resources/customObjectInstances/index.ts | 2 + .../types/CustomObjectInstance.ts | 25 + .../customObjectInstances/types/index.ts | 1 + .../resources/dataAttributes/client/Client.ts | 87 +- .../requests/CreateDataAttributeRequest.ts | 86 - .../requests/UpdateDataAttributeRequest.ts | 79 +- .../dataAttributes/client/requests/index.ts | 1 - .../dataAttributes/types/DataAttribute.ts | 2 +- src/api/resources/dataExport/client/Client.ts | 201 +- .../requests/CreateDataExportRequest.ts | 4 +- .../DownloadReportingDataExportRequest.ts | 15 + .../requests/ExportReportingDataRequest.ts | 30 + .../dataExport/client/requests/index.ts | 2 + .../resources/dataExport/types/DataExport.ts | 8 +- .../DataExportExportReportingDataResponse.ts | 10 + src/api/resources/dataExport/types/index.ts | 1 + src/api/resources/events/client/Client.ts | 12 +- src/api/resources/export/client/Client.ts | 262 + src/api/resources/export/client/index.ts | 1 + .../PostExportReportingDataEnqueueRequest.ts | 19 + .../resources/export/client/requests/index.ts | 1 + src/api/resources/export/index.ts | 2 + ...tExportReportingDataGetDatasetsResponse.ts | 33 + .../PostExportReportingDataEnqueueResponse.ts | 10 + src/api/resources/export/types/index.ts | 2 + .../resources/helpCenter/types/Collection.ts | 2 +- .../resources/helpCenter/types/HelpCenter.ts | 16 +- .../helpCenter/types/HelpCenterList.ts | 4 +- .../resources/helpCenters/client/Client.ts | 10 +- .../client/requests/FindHelpCenterRequest.ts | 6 +- .../resources/collections/client/Client.ts | 26 +- .../requests/DeleteCollectionRequest.ts | 4 +- .../client/requests/FindCollectionRequest.ts | 4 +- .../requests/UpdateCollectionRequest.ts | 6 +- src/api/resources/index.ts | 29 +- .../internalArticles/client/Client.ts | 647 ++ .../internalArticles/client/index.ts | 1 + .../requests/DeleteInternalArticleRequest.ts | 16 + .../RetrieveInternalArticleRequest.ts | 16 + .../requests/SearchInternalArticlesRequest.ts | 14 + .../UpdateInternalArticleRequestBody.ts | 33 + .../internalArticles/client/requests/index.ts | 4 + src/api/resources/internalArticles/index.ts | 2 + .../types/InternalArticleListItem.ts | 27 + .../types/InternalArticleSearchResponse.ts | 28 + .../resources/internalArticles/types/index.ts | 2 + src/api/resources/jobs/client/Client.ts | 179 + src/api/resources/jobs/client/index.ts | 1 + .../jobs/client/requests/JobsStatusRequest.ts | 16 + .../resources/jobs/client/requests/index.ts | 1 + src/api/resources/jobs/index.ts | 2 + src/api/resources/jobs/types/Jobs.ts | 35 + src/api/resources/jobs/types/index.ts | 1 + src/api/resources/messages/client/Client.ts | 14 +- src/api/resources/messages/types/Message.ts | 4 +- .../news/resources/feeds/client/Client.ts | 24 +- .../news/resources/items/client/Client.ts | 40 +- .../client/requests/DeleteNewsItemRequest.ts | 4 +- .../client/requests/FindNewsItemRequest.ts | 4 +- .../client/requests/UpdateNewsItemRequest.ts | 10 +- src/api/resources/news/types/NewsItem.ts | 16 +- src/api/resources/news/types/Newsfeed.ts | 8 +- .../news/types/NewsfeedAssignment.ts | 4 +- src/api/resources/notes/client/Client.ts | 14 +- .../notes/client/requests/FindNoteRequest.ts | 4 +- src/api/resources/notes/types/Note.ts | 12 +- .../phoneCallRedirects/client/Client.ts | 18 +- .../phoneCallRedirects/client/index.ts | 2 +- .../CreatePhoneCallRedirectRequest.ts | 48 - .../client/requests/index.ts | 1 - src/api/resources/segments/client/Client.ts | 8 +- src/api/resources/segments/types/Segment.ts | 10 +- .../subscriptionTypes/client/Client.ts | 4 +- .../types/SubscriptionType.ts | 14 +- src/api/resources/tags/client/Client.ts | 40 +- .../requests/UntagConversationRequest.ts | 2 +- src/api/resources/tags/types/Tag.ts | 4 +- src/api/resources/tags/types/TagBasic.ts | 15 + src/api/resources/tags/types/index.ts | 1 + src/api/resources/teams/client/Client.ts | 8 +- src/api/resources/teams/types/Team.ts | 8 +- .../resources/ticketStates/client/Client.ts | 170 + .../resources/ticketStates/client/index.ts | 1 + src/api/resources/ticketStates/index.ts | 1 + .../resources/ticketTypes/client/Client.ts | 40 +- .../ticketTypes/client/requests/index.ts | 1 - .../resources/attributes/client/Client.ts | 26 +- src/api/resources/tickets/client/Client.ts | 278 +- .../client/requests/CreateTicketRequest.ts | 19 + .../client/requests/DeleteTicketRequest.ts | 16 + .../requests/EnqueueCreateTicketRequest.ts | 19 + .../client/requests/ReplyToTicketRequest.ts | 12 +- .../client/requests/UpdateTicketRequest.ts | 60 +- .../tickets/client/requests/index.ts | 3 + .../tickets/types/DeleteTicketResponse.ts | 15 + src/api/resources/tickets/types/Ticket.ts | 31 +- .../resources/tickets/types/TicketContacts.ts | 4 +- src/api/resources/tickets/types/TicketPart.ts | 66 +- .../resources/tickets/types/TicketState.ts | 32 + .../tickets/types/TicketStateDetailed.ts | 48 + src/api/resources/tickets/types/TicketType.ts | 32 +- src/api/resources/tickets/types/index.ts | 3 + src/api/resources/unstable/client/Client.ts | 30 + .../resources/admins/client/Client.ts | 20 +- .../resources/aiAgent/types/AiAgent.ts | 4 + .../resources/aiContent/client/Client.ts | 40 +- .../resources/articles/client/Client.ts | 20 +- .../articles/types/InternalArticle.ts | 10 + .../resources/articles/types/index.ts | 1 + .../awayStatusReasons/client/Client.ts | 4 +- .../resources/brands/client/Client.ts | 259 + .../unstable/resources/brands/client/index.ts | 1 + .../client/requests/RetrieveBrandRequest.ts | 16 + .../resources/brands/client/requests/index.ts | 1 + .../unstable/resources/brands/index.ts | 2 + .../unstable/resources/brands/types/Brand.ts | 25 + .../resources/brands/types/BrandList.ts | 14 + .../unstable/resources/brands/types/index.ts | 2 + .../unstable/resources/calls/client/Client.ts | 540 + .../unstable/resources/calls/client/index.ts | 1 + .../calls/client/requests/ListCallsRequest.ts | 18 + .../ListCallsWithTranscriptsRequest.ts | 14 + .../requests/ShowCallRecordingRequest.ts | 16 + .../calls/client/requests/ShowCallRequest.ts | 16 + .../requests/ShowCallTranscriptRequest.ts | 16 + .../resources/calls/client/requests/index.ts | 5 + .../unstable/resources/calls/index.ts | 2 + .../unstable/resources/calls/types/Call.ts | 42 + .../types/ListCallsWithTranscriptsResponse.ts | 23 + .../unstable/resources/calls/types/index.ts | 2 + .../resources/companies/client/Client.ts | 44 +- .../resources/contacts/client/Client.ts | 60 +- .../resources/conversations/client/Client.ts | 54 +- .../requests/RetrieveConversationRequest.ts | 4 + .../requests/UpdateConversationRequest.ts | 2 + .../conversations/types/Conversation.ts | 2 + .../customChannelEvents/client/Client.ts | 24 +- .../customObjectInstances/client/Client.ts | 20 +- .../resources/dataAttributes/client/Client.ts | 82 +- .../requests/CreateDataAttributeRequest.ts | 86 - .../requests/UpdateDataAttributeRequest.ts | 38 +- .../dataAttributes/client/requests/index.ts | 1 - .../resources/dataEvents/client/Client.ts | 12 +- .../resources/dataExport/client/Client.ts | 16 +- .../resources/emails/client/Client.ts | 258 + .../unstable/resources/emails/client/index.ts | 1 + .../client/requests/RetrieveEmailRequest.ts | 16 + .../resources/emails/client/requests/index.ts | 1 + .../unstable/resources/emails/index.ts | 2 + .../resources/emails/types/EmailList.ts | 14 + .../resources/emails/types/EmailSetting.ts | 29 + .../unstable/resources/emails/types/index.ts | 2 + .../resources/export/client/Client.ts | 10 +- .../PostExportReportingDataEnqueueRequest.ts | 2 +- .../resources/helpCenter/client/Client.ts | 28 +- .../resources/helpCenter/types/HelpCenter.ts | 4 + src/api/resources/unstable/resources/index.ts | 15 + .../internalArticles/client/Client.ts | 644 ++ .../internalArticles/client/index.ts | 1 + .../requests/DeleteInternalArticleRequest.ts | 16 + .../RetrieveInternalArticleRequest.ts | 16 + .../requests/SearchInternalArticlesRequest.ts | 14 + .../UpdateInternalArticleRequestBody.ts | 33 + .../internalArticles/client/requests/index.ts | 4 + .../resources/internalArticles/index.ts | 2 + .../types/InternalArticleListItem.ts | 27 + .../types/InternalArticleSearchResponse.ts | 28 + .../resources/internalArticles/types/index.ts | 2 + .../unstable/resources/jobs/client/Client.ts | 4 +- .../resources/macros/client/Client.ts | 323 + .../unstable/resources/macros/client/index.ts | 1 + .../macros/client/requests/GetMacroRequest.ts | 31 + .../client/requests/ListMacrosRequest.ts | 49 + .../resources/macros/client/requests/index.ts | 2 + .../unstable/resources/macros/index.ts | 2 + .../unstable/resources/macros/types/Macro.ts | 49 + .../resources/macros/types/MacroList.ts | 41 + .../unstable/resources/macros/types/index.ts | 2 + .../resources/messages/client/Client.ts | 42 +- .../resources/messages/types/Message.ts | 7 +- .../unstable/resources/news/client/Client.ts | 32 +- .../unstable/resources/notes/client/Client.ts | 12 +- .../resources/segments/client/Client.ts | 8 +- .../subscriptionTypes/client/Client.ts | 12 +- .../resources/switch/client/Client.ts | 4 +- .../unstable/resources/tags/client/Client.ts | 40 +- .../unstable/resources/teams/client/Client.ts | 8 +- .../resources/ticketStates/client/Client.ts | 4 +- .../ticketTypeAttributes/client/Client.ts | 8 +- .../resources/ticketTypes/client/Client.ts | 12 +- .../resources/tickets/client/Client.ts | 31 +- .../resources/visitors/client/Client.ts | 12 +- .../resources/unstable/types/ActivityLog.ts | 6 +- .../unstable/types/ActivityLogMetadata.ts | 4 + src/api/resources/unstable/types/CallList.ts | 18 + .../unstable/types/ConversationRating.ts | 2 + ...RequestBody.ts => CreateArticleRequest.ts} | 14 +- .../types/CreateDataAttributeRequest.ts | 17 + .../types/CreateInternalArticleRequest.ts | 17 + .../types/CreateOrUpdateCompanyRequest.ts | 27 + .../types/CreatePhoneSwitchRequest.ts | 14 + .../types}/CreateTicketTypeRequest.ts | 9 +- .../unstable/types/CustomChannelContact.ts | 8 +- .../types/DeletedInternalArticleObject.ts | 15 + .../unstable/types/IntercomVersion.ts | 6 + .../unstable/types/IntercomVersionUnstable.ts | 2 +- .../unstable/types/InternalArticleList.ts | 18 + .../types/UpdateDataAttributeRequestBody.ts | 14 + src/api/resources/unstable/types/index.ts | 12 +- src/api/resources/visitors/client/Client.ts | 26 +- src/api/types/ActionComponent.ts | 24 - src/api/types/ActivityLog.ts | 14 +- src/api/types/ActivityLogList.ts | 4 +- src/api/types/ActivityLogMetadata.ts | 4 + src/api/types/AddressableList.ts | 6 +- src/api/types/AdminList.ts | 4 +- .../types/AdminReplyConversationRequest.ts | 5 +- src/api/types/AdminWithApp.ts | 20 +- src/api/types/App.ts | 14 +- src/api/types/ArticleContent.ts | 12 +- src/api/types/ArticleList.ts | 6 +- src/api/types/ArticleStatistics.ts | 2 +- src/api/types/ArticleTranslatedContent.ts | 2 +- src/api/types/AwayStatusReason.ts | 21 + src/api/types/ButtonComponent.ts | 36 - src/api/types/CallList.ts | 18 + src/api/types/CanvasObject.ts | 22 - src/api/types/CheckboxComponent.ts | 39 - src/api/types/CheckboxOption.ts | 17 - src/api/types/CollectionList.ts | 6 +- src/api/types/CompanyAttachedContacts.ts | 6 +- src/api/types/CompanyAttachedSegments.ts | 4 +- src/api/types/CompanyData.ts | 15 + src/api/types/CompanyList.ts | 4 +- src/api/types/CompanyScroll.ts | 4 +- src/api/types/Component.ts | 69 - src/api/types/ConfigureRequest.ts | 26 - src/api/types/ConfigureResponse.ts | 16 - src/api/types/ContactArchived.ts | 12 +- src/api/types/ContactAttachedCompanies.ts | 6 +- src/api/types/ContactBlocked.ts | 13 + src/api/types/ContactCompanies.ts | 16 +- src/api/types/ContactCompany.ts | 15 - src/api/types/ContactDeleted.ts | 12 +- src/api/types/ContactList.ts | 6 +- src/api/types/ContactLocation.ts | 2 +- src/api/types/ContactNotes.ts | 8 +- src/api/types/ContactReference.ts | 4 +- src/api/types/ContactReplyBaseRequest.ts | 15 + src/api/types/ContactSegments.ts | 4 +- src/api/types/ContactSocialProfiles.ts | 2 +- src/api/types/ContactSubscriptionTypes.ts | 8 +- src/api/types/ContactTags.ts | 8 +- src/api/types/ContactUnarchived.ts | 12 +- src/api/types/ContentObject.ts | 15 - src/api/types/ContentSourcesList.ts | 6 +- src/api/types/Context.ts | 36 - src/api/types/ConversationAttachmentFiles.ts | 6 +- .../ConversationAttributeUpdatedByAdmin.ts | 23 + .../ConversationAttributeUpdatedByWorkflow.ts | 29 + src/api/types/ConversationContacts.ts | 5 +- src/api/types/ConversationDeleted.ts | 15 + .../types/ConversationFirstContactReply.ts | 4 +- ...rsationResponse.ts => ConversationList.ts} | 8 +- src/api/types/ConversationPart.ts | 35 +- src/api/types/ConversationPartAuthor.ts | 12 +- src/api/types/ConversationPartMetadata.ts | 26 + src/api/types/ConversationParts.ts | 6 +- src/api/types/ConversationRating.ts | 12 +- src/api/types/ConversationResponseTime.ts | 15 + src/api/types/ConversationSource.ts | 14 +- src/api/types/ConversationStatistics.ts | 10 +- .../CreateArticleRequest.ts | 32 +- src/api/types/CreateDataAttributeRequest.ts | 17 + src/api/types/CreateInternalArticleRequest.ts | 17 + ...estTwo.ts => CreateMessageRequestThree.ts} | 2 +- .../CreateOrUpdateCompanyRequest.ts | 10 +- src/api/types/CreatePhoneSwitchRequest.ts | 14 + src/api/types/CreateTicketRequest.ts | 37 - src/api/types/CreateTicketRequestBody.ts | 50 + .../CreateTicketTypeRequest.ts} | 14 +- src/api/types/CurrentCanvas.ts | 13 - src/api/types/CursorPages.ts | 2 +- src/api/types/CustomActionFinished.ts | 30 + src/api/types/CustomActionStarted.ts | 17 + src/api/types/CustomAttributes.ts | 8 +- src/api/types/CustomChannelAttribute.ts | 10 + src/api/types/CustomChannelBaseEvent.ts | 13 + src/api/types/CustomChannelContact.ts | 25 + .../CustomChannelNotificationResponse.ts | 14 + src/api/types/CustomObjectInstanceDeleted.ts | 15 + src/api/types/CustomObjectInstanceList.ts | 14 + src/api/types/DataAttributeList.ts | 4 +- src/api/types/DataEventList.ts | 4 +- src/api/types/DataEventSummary.ts | 10 +- src/api/types/DataEventSummaryItem.ts | 8 +- src/api/types/DataExportCsv.ts | 16 +- src/api/types/DataTableComponent.ts | 13 - src/api/types/DataTableItem.ts | 15 - src/api/types/Datetime.ts | 11 + src/api/types/DeletedArticleObject.ts | 6 +- src/api/types/DeletedCollectionObject.ts | 6 +- src/api/types/DeletedCompanyObject.ts | 6 +- src/api/types/DeletedInternalArticleObject.ts | 15 + src/api/types/DeletedObject.ts | 6 +- src/api/types/DividerComponent.ts | 13 - src/api/types/DropdownComponent.ts | 37 - src/api/types/DropdownOption.ts | 17 - src/api/types/EmailAddressHeader.ts | 15 + src/api/types/EmailMessageMetadata.ts | 15 + src/api/types/Event.ts | 11 - src/api/types/EventDetails.ts | 12 + src/api/types/FileAttribute.ts | 14 +- src/api/types/GroupContent.ts | 6 +- src/api/types/GroupTranslatedContent.ts | 2 +- src/api/types/ImageComponent.ts | 43 - src/api/types/InitializeRequest.ts | 25 - src/api/types/InitializeResponse.ts | 13 - src/api/types/InputComponent.ts | 40 - src/api/types/InternalArticleList.ts | 18 + src/api/types/LinkedObject.ts | 4 +- src/api/types/LinkedObjectList.ts | 8 +- src/api/types/ListComponent.ts | 27 - src/api/types/ListItem.ts | 27 - src/api/types/ListItemWithImage.ts | 14 - src/api/types/ListItemWithoutImage.ts | 14 - src/api/types/LiveCanvasRequest.ts | 23 - src/api/types/LiveCanvasResponse.ts | 13 - src/api/types/MultipleFilterSearchRequest.ts | 9 +- .../MultipleOrSingleFilterSearchRequest.ts | 9 - src/api/types/NotFoundErrorBody.ts | 25 + src/api/types/NoteList.ts | 7 +- src/api/types/OperatorWorkflowEvent.ts | 25 + src/api/types/PagesLink.ts | 8 +- src/api/types/PaginatedNewsItemResponse.ts | 18 - src/api/types/PaginatedNewsfeedResponse.ts | 18 - src/api/types/PaginatedResponse.ts | 29 + src/api/types/PaginatedResponseDataItem.ts | 19 + src/api/types/PartAttachment.ts | 14 +- src/api/types/PhoneSwitch.ts | 4 +- src/api/types/QuickReplyOption.ts | 10 + src/api/types/Recipient.ts | 24 + src/api/types/Reference.ts | 2 +- src/api/types/ResultsResponse.ts | 11 - src/api/types/SegmentList.ts | 4 +- src/api/types/SheetActionComponent.ts | 13 - src/api/types/SingleFilterSearchRequest.ts | 2 +- src/api/types/SingleSelectComponent.ts | 42 - src/api/types/SingleSelectOption.ts | 17 - src/api/types/SlaApplied.ts | 6 +- src/api/types/SocialProfile.ts | 6 +- src/api/types/SpacerComponent.ts | 27 - src/api/types/StartingAfterPaging.ts | 2 +- src/api/types/SubmitActionComponent.ts | 8 - src/api/types/SubmitRequest.ts | 31 - src/api/types/SubmitResponse.ts | 25 - src/api/types/SubscriptionTypeList.ts | 4 +- src/api/types/TagList.ts | 4 +- src/api/types/Tags.ts | 4 +- src/api/types/TeamList.ts | 4 +- src/api/types/TextAreaComponent.ts | 23 - src/api/types/TextComponent.ts | 41 - src/api/types/TicketList.ts | 6 +- src/api/types/TicketPartAuthor.ts | 6 +- src/api/types/TicketParts.ts | 6 +- src/api/types/TicketReply.ts | 8 +- src/api/types/TicketStateList.ts | 15 + src/api/types/TicketTypeAttribute.ts | 32 +- src/api/types/TicketTypeAttributeList.ts | 4 +- src/api/types/TicketTypeList.ts | 6 +- src/api/types/Translation.ts | 6 +- src/api/types/UntagCompanyRequest.ts | 6 +- src/api/types/UpdateArticleRequestBody.ts | 15 + .../types/UpdateDataAttributeRequestBody.ts | 14 + src/api/types/UrlActionComponent.ts | 11 - src/api/types/Visitor.ts | 16 +- src/api/types/VisitorDeletedObject.ts | 6 +- src/api/types/WhatsappMessageStatusList.ts | 71 + src/api/types/index.ts | 93 +- src/version.ts | 2 +- yarn.lock | 420 +- 483 files changed, 18550 insertions(+), 6245 deletions(-) create mode 100644 src/api/errors/TooManyRequestsError.ts create mode 100644 src/api/resources/aiContent/client/Client.ts create mode 100644 src/api/resources/aiContent/client/index.ts create mode 100644 src/api/resources/aiContent/client/requests/CreateContentImportSourceRequest.ts create mode 100644 src/api/resources/aiContent/client/requests/CreateExternalPageRequest.ts create mode 100644 src/api/resources/aiContent/client/requests/DeleteContentImportSourceRequest.ts create mode 100644 src/api/resources/aiContent/client/requests/DeleteExternalPageRequest.ts create mode 100644 src/api/resources/aiContent/client/requests/GetContentImportSourceRequest.ts create mode 100644 src/api/resources/aiContent/client/requests/GetExternalPageRequest.ts create mode 100644 src/api/resources/aiContent/client/requests/UpdateContentImportSourceRequest.ts create mode 100644 src/api/resources/aiContent/client/requests/UpdateExternalPageRequest.ts create mode 100644 src/api/resources/aiContent/client/requests/index.ts create mode 100644 src/api/resources/aiContent/index.ts create mode 100644 src/api/resources/aiContent/types/ContentImportSource.ts create mode 100644 src/api/resources/aiContent/types/ContentImportSourcesList.ts create mode 100644 src/api/resources/aiContent/types/ExternalPage.ts create mode 100644 src/api/resources/aiContent/types/ExternalPagesList.ts create mode 100644 src/api/resources/aiContent/types/index.ts rename src/api/resources/articles/types/{SearchArticlesResponse.ts => ArticleSearchResponse.ts} (80%) create mode 100644 src/api/resources/articles/types/InternalArticle.ts create mode 100644 src/api/resources/awayStatusReasons/client/Client.ts create mode 100644 src/api/resources/awayStatusReasons/client/index.ts create mode 100644 src/api/resources/awayStatusReasons/index.ts create mode 100644 src/api/resources/calls/client/Client.ts create mode 100644 src/api/resources/calls/client/index.ts create mode 100644 src/api/resources/calls/client/requests/ListCallsRequest.ts create mode 100644 src/api/resources/calls/client/requests/ListCallsWithTranscriptsRequest.ts create mode 100644 src/api/resources/calls/client/requests/ShowCallRecordingRequest.ts create mode 100644 src/api/resources/calls/client/requests/ShowCallRequest.ts create mode 100644 src/api/resources/calls/client/requests/ShowCallTranscriptRequest.ts create mode 100644 src/api/resources/calls/client/requests/index.ts create mode 100644 src/api/resources/calls/index.ts create mode 100644 src/api/resources/calls/types/Call.ts create mode 100644 src/api/resources/calls/types/ListCallsWithTranscriptsResponse.ts create mode 100644 src/api/resources/calls/types/index.ts create mode 100644 src/api/resources/contacts/client/requests/BlockContactRequest.ts create mode 100644 src/api/resources/contacts/client/requests/ShowContactByExternalIdRequest.ts create mode 100644 src/api/resources/contacts/types/ContactsCreateResponse.ts create mode 100644 src/api/resources/contacts/types/ContactsFindResponse.ts create mode 100644 src/api/resources/contacts/types/ContactsMergeLeadInUserResponse.ts create mode 100644 src/api/resources/contacts/types/ContactsUpdateResponse.ts create mode 100644 src/api/resources/contacts/types/ShowContactByExternalIdResponse.ts create mode 100644 src/api/resources/conversations/client/requests/DeleteConversationRequest.ts create mode 100644 src/api/resources/customChannelEvents/client/Client.ts create mode 100644 src/api/resources/customChannelEvents/client/index.ts create mode 100644 src/api/resources/customChannelEvents/client/requests/NotifyAttributeCollectedRequest.ts create mode 100644 src/api/resources/customChannelEvents/client/requests/NotifyNewMessageRequest.ts create mode 100644 src/api/resources/customChannelEvents/client/requests/NotifyQuickReplySelectedRequest.ts create mode 100644 src/api/resources/customChannelEvents/client/requests/index.ts create mode 100644 src/api/resources/customChannelEvents/index.ts create mode 100644 src/api/resources/customObjectInstances/client/Client.ts create mode 100644 src/api/resources/customObjectInstances/client/index.ts create mode 100644 src/api/resources/customObjectInstances/client/requests/CreateOrUpdateCustomObjectInstanceRequest.ts create mode 100644 src/api/resources/customObjectInstances/client/requests/DeleteCustomObjectInstancesByExternalIdRequest.ts create mode 100644 src/api/resources/customObjectInstances/client/requests/DeleteCustomObjectInstancesByIdRequest.ts create mode 100644 src/api/resources/customObjectInstances/client/requests/GetCustomObjectInstancesByExternalIdRequest.ts create mode 100644 src/api/resources/customObjectInstances/client/requests/GetCustomObjectInstancesByIdRequest.ts create mode 100644 src/api/resources/customObjectInstances/client/requests/index.ts create mode 100644 src/api/resources/customObjectInstances/index.ts create mode 100644 src/api/resources/customObjectInstances/types/CustomObjectInstance.ts create mode 100644 src/api/resources/customObjectInstances/types/index.ts delete mode 100644 src/api/resources/dataAttributes/client/requests/CreateDataAttributeRequest.ts create mode 100644 src/api/resources/dataExport/client/requests/DownloadReportingDataExportRequest.ts create mode 100644 src/api/resources/dataExport/client/requests/ExportReportingDataRequest.ts create mode 100644 src/api/resources/dataExport/types/DataExportExportReportingDataResponse.ts create mode 100644 src/api/resources/export/client/Client.ts create mode 100644 src/api/resources/export/client/index.ts create mode 100644 src/api/resources/export/client/requests/PostExportReportingDataEnqueueRequest.ts create mode 100644 src/api/resources/export/client/requests/index.ts create mode 100644 src/api/resources/export/index.ts create mode 100644 src/api/resources/export/types/GetExportReportingDataGetDatasetsResponse.ts create mode 100644 src/api/resources/export/types/PostExportReportingDataEnqueueResponse.ts create mode 100644 src/api/resources/export/types/index.ts create mode 100644 src/api/resources/internalArticles/client/Client.ts create mode 100644 src/api/resources/internalArticles/client/index.ts create mode 100644 src/api/resources/internalArticles/client/requests/DeleteInternalArticleRequest.ts create mode 100644 src/api/resources/internalArticles/client/requests/RetrieveInternalArticleRequest.ts create mode 100644 src/api/resources/internalArticles/client/requests/SearchInternalArticlesRequest.ts create mode 100644 src/api/resources/internalArticles/client/requests/UpdateInternalArticleRequestBody.ts create mode 100644 src/api/resources/internalArticles/client/requests/index.ts create mode 100644 src/api/resources/internalArticles/index.ts create mode 100644 src/api/resources/internalArticles/types/InternalArticleListItem.ts create mode 100644 src/api/resources/internalArticles/types/InternalArticleSearchResponse.ts create mode 100644 src/api/resources/internalArticles/types/index.ts create mode 100644 src/api/resources/jobs/client/Client.ts create mode 100644 src/api/resources/jobs/client/index.ts create mode 100644 src/api/resources/jobs/client/requests/JobsStatusRequest.ts create mode 100644 src/api/resources/jobs/client/requests/index.ts create mode 100644 src/api/resources/jobs/index.ts create mode 100644 src/api/resources/jobs/types/Jobs.ts create mode 100644 src/api/resources/jobs/types/index.ts delete mode 100644 src/api/resources/phoneCallRedirects/client/requests/CreatePhoneCallRedirectRequest.ts delete mode 100644 src/api/resources/phoneCallRedirects/client/requests/index.ts create mode 100644 src/api/resources/tags/types/TagBasic.ts create mode 100644 src/api/resources/ticketStates/client/Client.ts create mode 100644 src/api/resources/ticketStates/client/index.ts create mode 100644 src/api/resources/ticketStates/index.ts create mode 100644 src/api/resources/tickets/client/requests/CreateTicketRequest.ts create mode 100644 src/api/resources/tickets/client/requests/DeleteTicketRequest.ts create mode 100644 src/api/resources/tickets/client/requests/EnqueueCreateTicketRequest.ts create mode 100644 src/api/resources/tickets/types/DeleteTicketResponse.ts create mode 100644 src/api/resources/tickets/types/TicketState.ts create mode 100644 src/api/resources/tickets/types/TicketStateDetailed.ts create mode 100644 src/api/resources/unstable/resources/articles/types/InternalArticle.ts create mode 100644 src/api/resources/unstable/resources/brands/client/Client.ts create mode 100644 src/api/resources/unstable/resources/brands/client/index.ts create mode 100644 src/api/resources/unstable/resources/brands/client/requests/RetrieveBrandRequest.ts create mode 100644 src/api/resources/unstable/resources/brands/client/requests/index.ts create mode 100644 src/api/resources/unstable/resources/brands/index.ts create mode 100644 src/api/resources/unstable/resources/brands/types/Brand.ts create mode 100644 src/api/resources/unstable/resources/brands/types/BrandList.ts create mode 100644 src/api/resources/unstable/resources/brands/types/index.ts create mode 100644 src/api/resources/unstable/resources/calls/client/Client.ts create mode 100644 src/api/resources/unstable/resources/calls/client/index.ts create mode 100644 src/api/resources/unstable/resources/calls/client/requests/ListCallsRequest.ts create mode 100644 src/api/resources/unstable/resources/calls/client/requests/ListCallsWithTranscriptsRequest.ts create mode 100644 src/api/resources/unstable/resources/calls/client/requests/ShowCallRecordingRequest.ts create mode 100644 src/api/resources/unstable/resources/calls/client/requests/ShowCallRequest.ts create mode 100644 src/api/resources/unstable/resources/calls/client/requests/ShowCallTranscriptRequest.ts create mode 100644 src/api/resources/unstable/resources/calls/client/requests/index.ts create mode 100644 src/api/resources/unstable/resources/calls/index.ts create mode 100644 src/api/resources/unstable/resources/calls/types/Call.ts create mode 100644 src/api/resources/unstable/resources/calls/types/ListCallsWithTranscriptsResponse.ts create mode 100644 src/api/resources/unstable/resources/calls/types/index.ts delete mode 100644 src/api/resources/unstable/resources/dataAttributes/client/requests/CreateDataAttributeRequest.ts create mode 100644 src/api/resources/unstable/resources/emails/client/Client.ts create mode 100644 src/api/resources/unstable/resources/emails/client/index.ts create mode 100644 src/api/resources/unstable/resources/emails/client/requests/RetrieveEmailRequest.ts create mode 100644 src/api/resources/unstable/resources/emails/client/requests/index.ts create mode 100644 src/api/resources/unstable/resources/emails/index.ts create mode 100644 src/api/resources/unstable/resources/emails/types/EmailList.ts create mode 100644 src/api/resources/unstable/resources/emails/types/EmailSetting.ts create mode 100644 src/api/resources/unstable/resources/emails/types/index.ts create mode 100644 src/api/resources/unstable/resources/internalArticles/client/Client.ts create mode 100644 src/api/resources/unstable/resources/internalArticles/client/index.ts create mode 100644 src/api/resources/unstable/resources/internalArticles/client/requests/DeleteInternalArticleRequest.ts create mode 100644 src/api/resources/unstable/resources/internalArticles/client/requests/RetrieveInternalArticleRequest.ts create mode 100644 src/api/resources/unstable/resources/internalArticles/client/requests/SearchInternalArticlesRequest.ts create mode 100644 src/api/resources/unstable/resources/internalArticles/client/requests/UpdateInternalArticleRequestBody.ts create mode 100644 src/api/resources/unstable/resources/internalArticles/client/requests/index.ts create mode 100644 src/api/resources/unstable/resources/internalArticles/index.ts create mode 100644 src/api/resources/unstable/resources/internalArticles/types/InternalArticleListItem.ts create mode 100644 src/api/resources/unstable/resources/internalArticles/types/InternalArticleSearchResponse.ts create mode 100644 src/api/resources/unstable/resources/internalArticles/types/index.ts create mode 100644 src/api/resources/unstable/resources/macros/client/Client.ts create mode 100644 src/api/resources/unstable/resources/macros/client/index.ts create mode 100644 src/api/resources/unstable/resources/macros/client/requests/GetMacroRequest.ts create mode 100644 src/api/resources/unstable/resources/macros/client/requests/ListMacrosRequest.ts create mode 100644 src/api/resources/unstable/resources/macros/client/requests/index.ts create mode 100644 src/api/resources/unstable/resources/macros/index.ts create mode 100644 src/api/resources/unstable/resources/macros/types/Macro.ts create mode 100644 src/api/resources/unstable/resources/macros/types/MacroList.ts create mode 100644 src/api/resources/unstable/resources/macros/types/index.ts create mode 100644 src/api/resources/unstable/types/CallList.ts rename src/api/resources/unstable/types/{UpdateArticleRequestBody.ts => CreateArticleRequest.ts} (87%) create mode 100644 src/api/resources/unstable/types/CreateDataAttributeRequest.ts create mode 100644 src/api/resources/unstable/types/CreateInternalArticleRequest.ts create mode 100644 src/api/resources/unstable/types/CreateOrUpdateCompanyRequest.ts create mode 100644 src/api/resources/unstable/types/CreatePhoneSwitchRequest.ts rename src/api/resources/{ticketTypes/client/requests => unstable/types}/CreateTicketTypeRequest.ts (82%) create mode 100644 src/api/resources/unstable/types/DeletedInternalArticleObject.ts create mode 100644 src/api/resources/unstable/types/InternalArticleList.ts create mode 100644 src/api/resources/unstable/types/UpdateDataAttributeRequestBody.ts delete mode 100644 src/api/types/ActionComponent.ts create mode 100644 src/api/types/AwayStatusReason.ts delete mode 100644 src/api/types/ButtonComponent.ts create mode 100644 src/api/types/CallList.ts delete mode 100644 src/api/types/CanvasObject.ts delete mode 100644 src/api/types/CheckboxComponent.ts delete mode 100644 src/api/types/CheckboxOption.ts create mode 100644 src/api/types/CompanyData.ts delete mode 100644 src/api/types/Component.ts delete mode 100644 src/api/types/ConfigureRequest.ts delete mode 100644 src/api/types/ConfigureResponse.ts create mode 100644 src/api/types/ContactBlocked.ts delete mode 100644 src/api/types/ContactCompany.ts delete mode 100644 src/api/types/ContentObject.ts delete mode 100644 src/api/types/Context.ts create mode 100644 src/api/types/ConversationAttributeUpdatedByAdmin.ts create mode 100644 src/api/types/ConversationAttributeUpdatedByWorkflow.ts create mode 100644 src/api/types/ConversationDeleted.ts rename src/api/types/{PaginatedConversationResponse.ts => ConversationList.ts} (76%) create mode 100644 src/api/types/ConversationPartMetadata.ts create mode 100644 src/api/types/ConversationResponseTime.ts rename src/api/{resources/articles/client/requests => types}/CreateArticleRequest.ts (67%) create mode 100644 src/api/types/CreateDataAttributeRequest.ts create mode 100644 src/api/types/CreateInternalArticleRequest.ts rename src/api/types/{CreateMessageRequestTwo.ts => CreateMessageRequestThree.ts} (60%) rename src/api/{resources/companies/client/requests => types}/CreateOrUpdateCompanyRequest.ts (87%) create mode 100644 src/api/types/CreatePhoneSwitchRequest.ts delete mode 100644 src/api/types/CreateTicketRequest.ts create mode 100644 src/api/types/CreateTicketRequestBody.ts rename src/api/{resources/unstable/types/UpdateTicketTypeRequestBody.ts => types/CreateTicketTypeRequest.ts} (64%) delete mode 100644 src/api/types/CurrentCanvas.ts create mode 100644 src/api/types/CustomActionFinished.ts create mode 100644 src/api/types/CustomActionStarted.ts create mode 100644 src/api/types/CustomChannelAttribute.ts create mode 100644 src/api/types/CustomChannelBaseEvent.ts create mode 100644 src/api/types/CustomChannelContact.ts create mode 100644 src/api/types/CustomChannelNotificationResponse.ts create mode 100644 src/api/types/CustomObjectInstanceDeleted.ts create mode 100644 src/api/types/CustomObjectInstanceList.ts delete mode 100644 src/api/types/DataTableComponent.ts delete mode 100644 src/api/types/DataTableItem.ts create mode 100644 src/api/types/Datetime.ts create mode 100644 src/api/types/DeletedInternalArticleObject.ts delete mode 100644 src/api/types/DividerComponent.ts delete mode 100644 src/api/types/DropdownComponent.ts delete mode 100644 src/api/types/DropdownOption.ts create mode 100644 src/api/types/EmailAddressHeader.ts create mode 100644 src/api/types/EmailMessageMetadata.ts delete mode 100644 src/api/types/Event.ts create mode 100644 src/api/types/EventDetails.ts delete mode 100644 src/api/types/ImageComponent.ts delete mode 100644 src/api/types/InitializeRequest.ts delete mode 100644 src/api/types/InitializeResponse.ts delete mode 100644 src/api/types/InputComponent.ts create mode 100644 src/api/types/InternalArticleList.ts delete mode 100644 src/api/types/ListComponent.ts delete mode 100644 src/api/types/ListItem.ts delete mode 100644 src/api/types/ListItemWithImage.ts delete mode 100644 src/api/types/ListItemWithoutImage.ts delete mode 100644 src/api/types/LiveCanvasRequest.ts delete mode 100644 src/api/types/LiveCanvasResponse.ts delete mode 100644 src/api/types/MultipleOrSingleFilterSearchRequest.ts create mode 100644 src/api/types/NotFoundErrorBody.ts create mode 100644 src/api/types/OperatorWorkflowEvent.ts delete mode 100644 src/api/types/PaginatedNewsItemResponse.ts delete mode 100644 src/api/types/PaginatedNewsfeedResponse.ts create mode 100644 src/api/types/PaginatedResponse.ts create mode 100644 src/api/types/PaginatedResponseDataItem.ts create mode 100644 src/api/types/QuickReplyOption.ts create mode 100644 src/api/types/Recipient.ts delete mode 100644 src/api/types/ResultsResponse.ts delete mode 100644 src/api/types/SheetActionComponent.ts delete mode 100644 src/api/types/SingleSelectComponent.ts delete mode 100644 src/api/types/SingleSelectOption.ts delete mode 100644 src/api/types/SpacerComponent.ts delete mode 100644 src/api/types/SubmitActionComponent.ts delete mode 100644 src/api/types/SubmitRequest.ts delete mode 100644 src/api/types/SubmitResponse.ts delete mode 100644 src/api/types/TextAreaComponent.ts delete mode 100644 src/api/types/TextComponent.ts create mode 100644 src/api/types/TicketStateList.ts create mode 100644 src/api/types/UpdateArticleRequestBody.ts create mode 100644 src/api/types/UpdateDataAttributeRequestBody.ts delete mode 100644 src/api/types/UrlActionComponent.ts create mode 100644 src/api/types/WhatsappMessageStatusList.ts diff --git a/README.md b/README.md index 08d01dae..7db3c55f 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![fern shield](https://img.shields.io/badge/%F0%9F%8C%BF-Built%20with%20Fern-brightgreen)](https://buildwithfern.com?utm_source=github&utm_medium=github&utm_campaign=readme&utm_source=https%3A%2F%2Fgithub.com%2Fintercom%2Fintercom-node) [![npm shield](https://img.shields.io/npm/v/intercom-client)](https://www.npmjs.com/package/intercom-client) -The Intercom TypeScript library provides convenient access to the Intercom API from TypeScript. +The Intercom TypeScript library provides convenient access to the Intercom APIs from TypeScript. ## Project Updates @@ -27,12 +27,8 @@ Instantiate and use the client with the following: import { IntercomClient } from "intercom-client"; const client = new IntercomClient({ token: "YOUR_TOKEN" }); -await client.articles.create({ - title: "Thanks for everything", - description: "Description of the Article", - body: "Body of the Article", - author_id: 1295, - state: "published", +await client.aiContent.createContentImportSource({ + url: "https://www.example.com", }); ``` @@ -58,7 +54,7 @@ will be thrown. import { IntercomError } from "intercom-client"; try { - await client.articles.create(...); + await client.aiContent.createContentImportSource(...); } catch (err) { if (err instanceof IntercomError) { console.log(err.statusCode); @@ -96,7 +92,7 @@ while (page.hasNextPage()) { If you would like to send additional headers as part of the request, use the `headers` request option. ```typescript -const response = await client.articles.create(..., { +const response = await client.aiContent.createContentImportSource(..., { headers: { 'X-Custom-Header': 'custom value' } @@ -118,7 +114,7 @@ A request is deemed retryable when any of the following HTTP status codes is ret Use the `maxRetries` request option to configure this behavior. ```typescript -const response = await client.articles.create(..., { +const response = await client.aiContent.createContentImportSource(..., { maxRetries: 0 // override maxRetries at the request level }); ``` @@ -128,7 +124,7 @@ const response = await client.articles.create(..., { The SDK defaults to a 60 second timeout. Use the `timeoutInSeconds` option to configure this behavior. ```typescript -const response = await client.articles.create(..., { +const response = await client.aiContent.createContentImportSource(..., { timeoutInSeconds: 30 // override timeout to 30s }); ``` @@ -139,7 +135,7 @@ The SDK allows users to abort requests at any point by passing in an abort signa ```typescript const controller = new AbortController(); -const response = await client.articles.create(..., { +const response = await client.aiContent.createContentImportSource(..., { abortSignal: controller.signal }); controller.abort(); // aborts the request @@ -151,7 +147,7 @@ The SDK provides access to raw response data, including headers, through the `.w The `.withRawResponse()` method returns a promise that results to an object with a `data` and a `rawResponse` property. ```typescript -const { data, rawResponse } = await client.articles.create(...).withRawResponse(); +const { data, rawResponse } = await client.aiContent.createContentImportSource(...).withRawResponse(); console.log(data); console.log(rawResponse.headers['X-My-Header']); @@ -192,13 +188,3 @@ a proof of concept, but know that we will not be able to merge it as-is. We sugg an issue first to discuss with us! On the other hand, contributions to the README are always very welcome! - -## Contributing - -While we value open-source contributions to this SDK, this library is generated programmatically. -Additions made directly to this library would have to be moved over to our generation code, -otherwise they would be overwritten upon the next generated release. Feel free to open a PR as -a proof of concept, but know that we will not be able to merge it as-is. We suggest opening -an issue first to discuss with us! - -On the other hand, contributions to the README are always very welcome! diff --git a/package.json b/package.json index 00b818fa..da21d6c9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "intercom-client", - "version": "6.4.0", + "version": "7.0.0", "private": false, "repository": "https://github.com/intercom/intercom-node", "main": "./index.js", diff --git a/reference.md b/reference.md index df65e9f7..0530c0e9 100644 --- a/reference.md +++ b/reference.md @@ -2,7 +2,7 @@ ## Admins -
client.admins.identify() -> Intercom.AdminWithApp +
client.admins.identify() -> Intercom.AdminWithApp | undefined
@@ -61,7 +61,7 @@ await client.admins.identify();
-
client.admins.away({ ...params }) -> Intercom.Admin +
client.admins.away({ ...params }) -> Intercom.Admin | undefined
@@ -90,9 +90,10 @@ You can set an Admin as away for the Inbox. ```typescript await client.admins.away({ - admin_id: "admin_id", + admin_id: 1, away_mode_enabled: true, away_mode_reassign: true, + away_status_reason_id: 12345, }); ``` @@ -249,7 +250,7 @@ await client.admins.list();
-
client.admins.find({ ...params }) -> Intercom.Admin +
client.admins.find({ ...params }) -> Intercom.Admin | undefined
@@ -278,7 +279,7 @@ You can retrieve the details of a single admin. ```typescript await client.admins.find({ - admin_id: "123", + admin_id: 1, }); ``` @@ -314,9 +315,9 @@ await client.admins.find({
-## Articles +## AI Content -
client.articles.list({ ...params }) -> core.Page +
client.aiContent.listContentImportSources() -> Intercom.ContentImportSourcesList
@@ -328,11 +329,7 @@ await client.admins.find({
-You can fetch a list of all articles by making a GET request to `https://api.intercom.io/articles`. - -> 📘 How are the articles sorted and ordered? -> -> Articles will be returned in descending order on the `updated_at` attribute. This means if you need to iterate through results then we'll show the most recently updated articles first. +You can retrieve a list of all content import sources for a workspace.
@@ -348,16 +345,7 @@ You can fetch a list of all articles by making a GET request to `https://api.int
```typescript -const response = await client.articles.list(); -for await (const item of response) { - console.log(item); -} - -// Or you can manually iterate page-by-page -const page = await client.articles.list(); -while (page.hasNextPage()) { - page = page.getNextPage(); -} +await client.aiContent.listContentImportSources(); ```
@@ -373,15 +361,7 @@ while (page.hasNextPage()) {
-**request:** `Intercom.ListArticlesRequest` - -
-
- -
-
- -**requestOptions:** `Articles.RequestOptions` +**requestOptions:** `AiContent.RequestOptions`
@@ -392,7 +372,7 @@ while (page.hasNextPage()) {
-
client.articles.create({ ...params }) -> Intercom.Article +
client.aiContent.createContentImportSource({ ...params }) -> Intercom.ContentImportSource
@@ -404,7 +384,7 @@ while (page.hasNextPage()) {
-You can create a new article by making a POST request to `https://api.intercom.io/articles`. +You can create a new content import source by sending a POST request to this endpoint.
@@ -420,24 +400,8 @@ You can create a new article by making a POST request to `https://api.intercom.i
```typescript -await client.articles.create({ - title: "Thanks for everything", - description: "Description of the Article", - body: "Body of the Article", - author_id: 991267407, - state: "published", - parent_id: 145, - parent_type: "collection", - translated_content: { - fr: { - type: "article_content", - title: "Merci pour tout", - description: "Description de l'article", - body: "Corps de l'article", - author_id: 991267407, - state: "published", - }, - }, +await client.aiContent.createContentImportSource({ + url: "https://www.example.com", }); ``` @@ -454,7 +418,7 @@ await client.articles.create({
-**request:** `Intercom.CreateArticleRequest` +**request:** `Intercom.CreateContentImportSourceRequest`
@@ -462,7 +426,7 @@ await client.articles.create({
-**requestOptions:** `Articles.RequestOptions` +**requestOptions:** `AiContent.RequestOptions`
@@ -473,25 +437,10 @@ await client.articles.create({
-
client.articles.find({ ...params }) -> Intercom.Article -
-
- -#### 📝 Description - -
-
- +
client.aiContent.getContentImportSource({ ...params }) -> Intercom.ContentImportSource
-You can fetch the details of a single article by making a GET request to `https://api.intercom.io/articles/`. - -
-
-
-
- #### 🔌 Usage
@@ -501,8 +450,8 @@ You can fetch the details of a single article by making a GET request to `https:
```typescript -await client.articles.find({ - article_id: "123", +await client.aiContent.getContentImportSource({ + source_id: "source_id", }); ``` @@ -519,7 +468,7 @@ await client.articles.find({
-**request:** `Intercom.FindArticleRequest` +**request:** `Intercom.GetContentImportSourceRequest`
@@ -527,7 +476,7 @@ await client.articles.find({
-**requestOptions:** `Articles.RequestOptions` +**requestOptions:** `AiContent.RequestOptions`
@@ -538,7 +487,7 @@ await client.articles.find({
-
client.articles.update({ ...params }) -> Intercom.Article +
client.aiContent.updateContentImportSource({ ...params }) -> Intercom.ContentImportSource
@@ -550,7 +499,7 @@ await client.articles.find({
-You can update the details of a single article by making a PUT request to `https://api.intercom.io/articles/`. +You can update an existing content import source.
@@ -566,10 +515,10 @@ You can update the details of a single article by making a PUT request to `https
```typescript -await client.articles.update({ - article_id: "123", - title: "Christmas is here!", - body: "

New gifts in store for the jolly season

", +await client.aiContent.updateContentImportSource({ + source_id: "source_id", + sync_behavior: "api", + url: "https://www.example.com", }); ``` @@ -586,7 +535,7 @@ await client.articles.update({
-**request:** `Intercom.UpdateArticleRequest` +**request:** `Intercom.UpdateContentImportSourceRequest`
@@ -594,7 +543,7 @@ await client.articles.update({
-**requestOptions:** `Articles.RequestOptions` +**requestOptions:** `AiContent.RequestOptions`
@@ -605,7 +554,7 @@ await client.articles.update({
-
client.articles.delete({ ...params }) -> Intercom.DeletedArticleObject +
client.aiContent.deleteContentImportSource({ ...params }) -> void
@@ -617,7 +566,7 @@ await client.articles.update({
-You can delete a single article by making a DELETE request to `https://api.intercom.io/articles/`. +You can delete a content import source by making a DELETE request this endpoint. This will also delete all external pages that were imported from this source.
@@ -633,8 +582,8 @@ You can delete a single article by making a DELETE request to `https://api.inter
```typescript -await client.articles.delete({ - article_id: "123", +await client.aiContent.deleteContentImportSource({ + source_id: "source_id", }); ``` @@ -651,7 +600,7 @@ await client.articles.delete({
-**request:** `Intercom.DeleteArticleRequest` +**request:** `Intercom.DeleteContentImportSourceRequest`
@@ -659,7 +608,7 @@ await client.articles.delete({
-**requestOptions:** `Articles.RequestOptions` +**requestOptions:** `AiContent.RequestOptions`
@@ -670,7 +619,7 @@ await client.articles.delete({
-
client.articles.search({ ...params }) -> Intercom.SearchArticlesResponse +
client.aiContent.listExternalPages() -> Intercom.ExternalPagesList
@@ -682,7 +631,7 @@ await client.articles.delete({
-You can search for articles by making a GET request to `https://api.intercom.io/articles/search`. +You can retrieve a list of all external pages for a workspace.
@@ -698,10 +647,7 @@ You can search for articles by making a GET request to `https://api.intercom.io/
```typescript -await client.articles.search({ - phrase: "Getting started", - state: "published", -}); +await client.aiContent.listExternalPages(); ```
@@ -717,15 +663,7 @@ await client.articles.search({
-**request:** `Intercom.SearchArticlesRequest` - -
-
- -
-
- -**requestOptions:** `Articles.RequestOptions` +**requestOptions:** `AiContent.RequestOptions`
@@ -736,9 +674,7 @@ await client.articles.search({
-## HelpCenters - -
client.helpCenters.find({ ...params }) -> Intercom.HelpCenter +
client.aiContent.createExternalPage({ ...params }) -> Intercom.ExternalPage
@@ -750,7 +686,7 @@ await client.articles.search({
-You can fetch the details of a single Help Center by making a GET request to `https://api.intercom.io/help_center/help_center/`. +You can create a new external page by sending a POST request to this endpoint. If an external page already exists with the specified source_id and external_id, it will be updated instead.
@@ -766,8 +702,12 @@ You can fetch the details of a single Help Center by making a GET request to `ht
```typescript -await client.helpCenters.find({ - help_center_id: "123", +await client.aiContent.createExternalPage({ + title: "Test", + html: "

Test

", + url: "https://www.example.com", + source_id: 44, + external_id: "abc1234", }); ``` @@ -784,7 +724,7 @@ await client.helpCenters.find({
-**request:** `Intercom.FindHelpCenterRequest` +**request:** `Intercom.CreateExternalPageRequest`
@@ -792,7 +732,7 @@ await client.helpCenters.find({
-**requestOptions:** `HelpCenters.RequestOptions` +**requestOptions:** `AiContent.RequestOptions`
@@ -803,7 +743,7 @@ await client.helpCenters.find({
-
client.helpCenters.list({ ...params }) -> core.Page +
client.aiContent.getExternalPage({ ...params }) -> Intercom.ExternalPage
@@ -815,7 +755,7 @@ await client.helpCenters.find({
-You can list all Help Centers by making a GET request to `https://api.intercom.io/help_center/help_centers`. +You can retrieve an external page.
@@ -831,16 +771,9 @@ You can list all Help Centers by making a GET request to `https://api.intercom.i
```typescript -const response = await client.helpCenters.list(); -for await (const item of response) { - console.log(item); -} - -// Or you can manually iterate page-by-page -const page = await client.helpCenters.list(); -while (page.hasNextPage()) { - page = page.getNextPage(); -} +await client.aiContent.getExternalPage({ + page_id: "page_id", +}); ```
@@ -856,7 +789,7 @@ while (page.hasNextPage()) {
-**request:** `Intercom.ListHelpCentersRequest` +**request:** `Intercom.GetExternalPageRequest`
@@ -864,7 +797,7 @@ while (page.hasNextPage()) {
-**requestOptions:** `HelpCenters.RequestOptions` +**requestOptions:** `AiContent.RequestOptions`
@@ -875,9 +808,7 @@ while (page.hasNextPage()) {
-## Companies - -
client.companies.retrieve({ ...params }) -> Intercom.CompaniesRetrieveResponse +
client.aiContent.updateExternalPage({ ...params }) -> Intercom.ExternalPage
@@ -889,17 +820,7 @@ while (page.hasNextPage()) {
-You can fetch a single company by passing in `company_id` or `name`. - -`https://api.intercom.io/companies?name={name}` - -`https://api.intercom.io/companies?company_id={company_id}` - -You can fetch all companies and filter by `segment_id` or `tag_id` as a query parameter. - -`https://api.intercom.io/companies?tag_id={tag_id}` - -`https://api.intercom.io/companies?segment_id={segment_id}` +You can update an existing external page (if it was created via the API).
@@ -915,11 +836,13 @@ You can fetch all companies and filter by `segment_id` or `tag_id` as a query pa
```typescript -await client.companies.retrieve({ - name: "my company", - company_id: "12345", - tag_id: "678910", - segment_id: "98765", +await client.aiContent.updateExternalPage({ + page_id: "page_id", + title: "Test", + html: "

Test

", + url: "https://www.example.com", + source_id: 47, + external_id: "5678", }); ``` @@ -936,7 +859,7 @@ await client.companies.retrieve({
-**request:** `Intercom.RetrieveCompanyRequest` +**request:** `Intercom.UpdateExternalPageRequest`
@@ -944,7 +867,7 @@ await client.companies.retrieve({
-**requestOptions:** `Companies.RequestOptions` +**requestOptions:** `AiContent.RequestOptions`
@@ -955,7 +878,7 @@ await client.companies.retrieve({
-
client.companies.createOrUpdate({ ...params }) -> Intercom.Company +
client.aiContent.deleteExternalPage({ ...params }) -> Intercom.ExternalPage
@@ -967,15 +890,7 @@ await client.companies.retrieve({
-You can create or update a company. - -Companies will be only visible in Intercom when there is at least one associated user. - -Companies are looked up via `company_id` in a `POST` request, if not found via `company_id`, the new company will be created, if found, that company will be updated. - -{% admonition type="warning" name="Using `company_id`" %} -You can set a unique `company_id` value when creating a company. However, it is not possible to update `company_id`. Be sure to set a unique value once upon creation of the company. -{% /admonition %} +Sending a DELETE request for an external page will remove it from the content library UI and from being used for AI answers.
@@ -991,10 +906,8 @@ You can set a unique `company_id` value when creating a company. However, it is
```typescript -await client.companies.createOrUpdate({ - name: "my company", - company_id: "company_remote_id", - remote_created_at: 1374138000, +await client.aiContent.deleteExternalPage({ + page_id: "page_id", }); ``` @@ -1011,7 +924,7 @@ await client.companies.createOrUpdate({
-**request:** `Intercom.CreateOrUpdateCompanyRequest` +**request:** `Intercom.DeleteExternalPageRequest`
@@ -1019,7 +932,7 @@ await client.companies.createOrUpdate({
-**requestOptions:** `Companies.RequestOptions` +**requestOptions:** `AiContent.RequestOptions`
@@ -1030,7 +943,9 @@ await client.companies.createOrUpdate({
-
client.companies.find({ ...params }) -> Intercom.Company +## Articles + +
client.articles.list({ ...params }) -> core.Page
@@ -1042,7 +957,11 @@ await client.companies.createOrUpdate({
-You can fetch a single company. +You can fetch a list of all articles by making a GET request to `https://api.intercom.io/articles`. + +> 📘 How are the articles sorted and ordered? +> +> Articles will be returned in descending order on the `updated_at` attribute. This means if you need to iterate through results then we'll show the most recently updated articles first.
@@ -1058,9 +977,16 @@ You can fetch a single company.
```typescript -await client.companies.find({ - company_id: "5f4d3c1c-7b1b-4d7d-a97e-6095715c6632", -}); +const response = await client.articles.list(); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +const page = await client.articles.list(); +while (page.hasNextPage()) { + page = page.getNextPage(); +} ```
@@ -1076,7 +1002,7 @@ await client.companies.find({
-**request:** `Intercom.FindCompanyRequest` +**request:** `Intercom.ListArticlesRequest`
@@ -1084,7 +1010,7 @@ await client.companies.find({
-**requestOptions:** `Companies.RequestOptions` +**requestOptions:** `Articles.RequestOptions`
@@ -1095,7 +1021,7 @@ await client.companies.find({
-
client.companies.update({ ...params }) -> Intercom.Company +
client.articles.create({ ...params }) -> Intercom.Article
@@ -1107,11 +1033,7 @@ await client.companies.find({
-You can update a single company using the Intercom provisioned `id`. - -{% admonition type="warning" name="Using `company_id`" %} -When updating a company it is not possible to update `company_id`. This can only be set once upon creation of the company. -{% /admonition %} +You can create a new article by making a POST request to `https://api.intercom.io/articles`.
@@ -1127,8 +1049,23 @@ When updating a company it is not possible to update `company_id`. This can only
```typescript -await client.companies.update({ - company_id: "5f4d3c1c-7b1b-4d7d-a97e-6095715c6632", +await client.articles.create({ + title: "Thanks for everything", + description: "Description of the Article", + body: "Body of the Article", + author_id: 991267497, + state: "published", + parent_id: 145, + parent_type: "collection", + translated_content: { + fr: { + title: "Merci pour tout", + description: "Description de l'article", + body: "Corps de l'article", + author_id: 991267497, + state: "published", + }, + }, }); ``` @@ -1145,7 +1082,7 @@ await client.companies.update({
-**request:** `Intercom.UpdateCompanyRequest` +**request:** `Intercom.CreateArticleRequest`
@@ -1153,7 +1090,7 @@ await client.companies.update({
-**requestOptions:** `Companies.RequestOptions` +**requestOptions:** `Articles.RequestOptions`
@@ -1164,7 +1101,7 @@ await client.companies.update({
-
client.companies.delete({ ...params }) -> Intercom.DeletedCompanyObject +
client.articles.find({ ...params }) -> Intercom.Article
@@ -1176,7 +1113,7 @@ await client.companies.update({
-You can delete a single company. +You can fetch the details of a single article by making a GET request to `https://api.intercom.io/articles/`.
@@ -1192,8 +1129,8 @@ You can delete a single company.
```typescript -await client.companies.delete({ - company_id: "5f4d3c1c-7b1b-4d7d-a97e-6095715c6632", +await client.articles.find({ + article_id: 1, }); ``` @@ -1210,7 +1147,7 @@ await client.companies.delete({
-**request:** `Intercom.DeleteCompanyRequest` +**request:** `Intercom.FindArticleRequest`
@@ -1218,7 +1155,7 @@ await client.companies.delete({
-**requestOptions:** `Companies.RequestOptions` +**requestOptions:** `Articles.RequestOptions`
@@ -1229,7 +1166,7 @@ await client.companies.delete({
-
client.companies.listAttachedContacts({ ...params }) -> Intercom.CompanyAttachedContacts +
client.articles.update({ ...params }) -> Intercom.Article
@@ -1241,7 +1178,7 @@ await client.companies.delete({
-You can fetch a list of all contacts that belong to a company. +You can update the details of a single article by making a PUT request to `https://api.intercom.io/articles/`.
@@ -1257,8 +1194,10 @@ You can fetch a list of all contacts that belong to a company.
```typescript -await client.companies.listAttachedContacts({ - company_id: "5f4d3c1c-7b1b-4d7d-a97e-6095715c6632", +await client.articles.update({ + article_id: 1, + title: "Christmas is here!", + body: "

New gifts in store for the jolly season

", }); ``` @@ -1275,7 +1214,7 @@ await client.companies.listAttachedContacts({
-**request:** `Intercom.ListAttachedContactsRequest` +**request:** `Intercom.UpdateArticleRequest`
@@ -1283,7 +1222,7 @@ await client.companies.listAttachedContacts({
-**requestOptions:** `Companies.RequestOptions` +**requestOptions:** `Articles.RequestOptions`
@@ -1294,7 +1233,7 @@ await client.companies.listAttachedContacts({
-
client.companies.listAttachedSegments({ ...params }) -> Intercom.CompanyAttachedSegments +
client.articles.delete({ ...params }) -> Intercom.DeletedArticleObject
@@ -1306,7 +1245,7 @@ await client.companies.listAttachedContacts({
-You can fetch a list of all segments that belong to a company. +You can delete a single article by making a DELETE request to `https://api.intercom.io/articles/`.
@@ -1322,8 +1261,8 @@ You can fetch a list of all segments that belong to a company.
```typescript -await client.companies.listAttachedSegments({ - company_id: "5f4d3c1c-7b1b-4d7d-a97e-6095715c6632", +await client.articles.delete({ + article_id: 1, }); ``` @@ -1340,7 +1279,7 @@ await client.companies.listAttachedSegments({
-**request:** `Intercom.ListSegmentsAttachedToCompanyRequest` +**request:** `Intercom.DeleteArticleRequest`
@@ -1348,7 +1287,7 @@ await client.companies.listAttachedSegments({
-**requestOptions:** `Companies.RequestOptions` +**requestOptions:** `Articles.RequestOptions`
@@ -1359,7 +1298,7 @@ await client.companies.listAttachedSegments({
-
client.companies.list({ ...params }) -> core.Page +
client.articles.search({ ...params }) -> Intercom.ArticleSearchResponse
@@ -1371,15 +1310,7 @@ await client.companies.listAttachedSegments({
-You can list companies. The company list is sorted by the `last_request_at` field and by default is ordered descending, most recently requested first. - -Note that the API does not include companies who have no associated users in list responses. - -When using the Companies endpoint and the pages object to iterate through the returned companies, there is a limit of 10,000 Companies that can be returned. If you need to list or iterate on more than 10,000 Companies, please use the [Scroll API](https://developers.intercom.com/reference#iterating-over-all-companies). -{% admonition type="warning" name="Pagination" %} -You can use pagination to limit the number of results returned. The default is `20` results per page. -See the [pagination section](https://developers.intercom.com/docs/build-an-integration/learn-more/rest-apis/pagination/#pagination-for-list-apis) for more details on how to use the `starting_after` param. -{% /admonition %} +You can search for articles by making a GET request to `https://api.intercom.io/articles/search`.
@@ -1395,20 +1326,10 @@ See the [pagination section](https://developers.intercom.com/docs/build-an-integ
```typescript -const response = await client.companies.list({ - order: "desc", -}); -for await (const item of response) { - console.log(item); -} - -// Or you can manually iterate page-by-page -const page = await client.companies.list({ - order: "desc", +await client.articles.search({ + phrase: "Getting started", + state: "published", }); -while (page.hasNextPage()) { - page = page.getNextPage(); -} ```
@@ -1424,7 +1345,7 @@ while (page.hasNextPage()) {
-**request:** `Intercom.ListCompaniesRequest` +**request:** `Intercom.SearchArticlesRequest`
@@ -1432,7 +1353,7 @@ while (page.hasNextPage()) {
-**requestOptions:** `Companies.RequestOptions` +**requestOptions:** `Articles.RequestOptions`
@@ -1443,7 +1364,9 @@ while (page.hasNextPage()) {
-
client.companies.scroll({ ...params }) -> core.Page +## Away Status Reasons + +
client.awayStatusReasons.listAwayStatusReasons() -> Intercom.AwayStatusReason[]
@@ -1455,21 +1378,7 @@ while (page.hasNextPage()) {
- The `list all companies` functionality does not work well for huge datasets, and can result in errors and performance problems when paging deeply. The Scroll API provides an efficient mechanism for iterating over all companies in a dataset. - -- Each app can only have 1 scroll open at a time. You'll get an error message if you try to have more than one open per app. -- If the scroll isn't used for 1 minute, it expires and calls with that scroll param will fail -- If the end of the scroll is reached, "companies" will be empty and the scroll parameter will expire - -{% admonition type="info" name="Scroll Parameter" %} -You can get the first page of companies by simply sending a GET request to the scroll endpoint. -For subsequent requests you will need to use the scroll parameter from the response. -{% /admonition %} -{% admonition type="danger" name="Scroll network timeouts" %} -Since scroll is often used on large datasets network errors such as timeouts can be encountered. When this occurs you will see a HTTP 500 error with the following message: -"Request failed due to an internal network error. Please restart the scroll operation." -If this happens, you will need to restart your scroll query: It is not possible to continue from a specific point when using scroll. -{% /admonition %} +Returns a list of all away status reasons configured for the workspace, including deleted ones.
@@ -1485,16 +1394,7 @@ If this happens, you will need to restart your scroll query: It is not possible
```typescript -const response = await client.companies.scroll(); -for await (const item of response) { - console.log(item); -} - -// Or you can manually iterate page-by-page -const page = await client.companies.scroll(); -while (page.hasNextPage()) { - page = page.getNextPage(); -} +await client.awayStatusReasons.listAwayStatusReasons(); ```
@@ -1510,15 +1410,7 @@ while (page.hasNextPage()) {
-**request:** `Intercom.ScrollCompaniesRequest` - -
-
- -
-
- -**requestOptions:** `Companies.RequestOptions` +**requestOptions:** `AwayStatusReasons.RequestOptions`
@@ -1529,25 +1421,12 @@ while (page.hasNextPage()) {
-
client.companies.attachContact({ ...params }) -> Intercom.Company -
-
- -#### 📝 Description - -
-
+## Export +
client.export.enqueueANewReportingDataExportJob({ ...params }) -> Intercom.PostExportReportingDataEnqueueResponse
-You can attach a company to a single contact. - -
-
-
-
- #### 🔌 Usage
@@ -1557,9 +1436,11 @@ You can attach a company to a single contact.
```typescript -await client.companies.attachContact({ - contact_id: "contact_id", - id: "667d608d8a68186f43bafd70", +await client.export.enqueueANewReportingDataExportJob({ + dataset_id: "conversation", + attribute_ids: ["conversation_id", "conversation_started_at"], + start_time: 1717490000, + end_time: 1717510000, }); ``` @@ -1576,7 +1457,7 @@ await client.companies.attachContact({
-**request:** `Intercom.AttachContactToCompanyRequest` +**request:** `Intercom.PostExportReportingDataEnqueueRequest`
@@ -1584,7 +1465,7 @@ await client.companies.attachContact({
-**requestOptions:** `Companies.RequestOptions` +**requestOptions:** `Export.RequestOptions`
@@ -1595,11 +1476,11 @@ await client.companies.attachContact({
-
client.companies.detachContact({ ...params }) -> Intercom.Company +
client.export.listAvailableDatasetsAndAttributes() -> Intercom.GetExportReportingDataGetDatasetsResponse
-#### 📝 Description +#### 🔌 Usage
@@ -1607,14 +1488,16 @@ await client.companies.attachContact({
-You can detach a company from a single contact. +```typescript +await client.export.listAvailableDatasetsAndAttributes(); +```
-#### 🔌 Usage +#### ⚙️ Parameters
@@ -1622,66 +1505,75 @@ You can detach a company from a single contact.
-```typescript -await client.companies.detachContact({ - contact_id: "58a430d35458202d41b1e65b", - company_id: "58a430d35458202d41b1e65b", -}); -``` +**requestOptions:** `Export.RequestOptions`
-#### ⚙️ Parameters +
+
+
-
-
+## Data Export +
client.dataExport.exportReportingData({ ...params }) -> Intercom.DataExportExportReportingDataResponse
-**request:** `Intercom.DetachContactFromCompanyRequest` +#### 🔌 Usage -
-
+
+
-**requestOptions:** `Companies.RequestOptions` +```typescript +await client.dataExport.exportReportingData({ + job_identifier: "job_identifier", + app_id: "app_id", + client_id: "client_id", +}); +```
-
-
-
- -## Contacts +#### ⚙️ Parameters -
client.contacts.listAttachedCompanies({ ...params }) -> core.Page
-#### 📝 Description -
+**request:** `Intercom.ExportReportingDataRequest` + +
+
+
-You can fetch a list of companies that are associated to a contact. +**requestOptions:** `DataExport.RequestOptions`
+ + +
+ +
client.dataExport.downloadReportingDataExport({ ...params }) -> void +
+
+ #### 🔌 Usage
@@ -1691,20 +1583,10 @@ You can fetch a list of companies that are associated to a contact.
```typescript -const response = await client.contacts.listAttachedCompanies({ - contact_id: "63a07ddf05a32042dffac965", -}); -for await (const item of response) { - console.log(item); -} - -// Or you can manually iterate page-by-page -const page = await client.contacts.listAttachedCompanies({ - contact_id: "63a07ddf05a32042dffac965", +await client.dataExport.downloadReportingDataExport({ + job_identifier: "job_identifier", + app_id: "app_id", }); -while (page.hasNextPage()) { - page = page.getNextPage(); -} ```
@@ -1720,7 +1602,7 @@ while (page.hasNextPage()) {
-**request:** `Intercom.ListAttachedCompaniesRequest` +**request:** `Intercom.DownloadReportingDataExportRequest`
@@ -1728,7 +1610,7 @@ while (page.hasNextPage()) {
-**requestOptions:** `Contacts.RequestOptions` +**requestOptions:** `DataExport.RequestOptions`
@@ -1739,7 +1621,7 @@ while (page.hasNextPage()) {
-
client.contacts.listAttachedSegments({ ...params }) -> Intercom.ContactSegments +
client.dataExport.create({ ...params }) -> Intercom.DataExport
@@ -1751,7 +1633,21 @@ while (page.hasNextPage()) {
-You can fetch a list of segments that are associated to a contact. +To create your export job, you need to send a `POST` request to the export endpoint `https://api.intercom.io/export/content/data`. + +The only parameters you need to provide are the range of dates that you want exported. + +> 🚧 Limit of one active job +> +> You can only have one active job per workspace. You will receive a HTTP status code of 429 with the message Exceeded rate limit of 1 pending message data export jobs if you attempt to create a second concurrent job. + +> ❗️ Updated_at not included +> +> It should be noted that the timeframe only includes messages sent during the time period and not messages that were only updated during this period. For example, if a message was updated yesterday but sent two days ago, you would need to set the created_at_after date before the message was sent to include that in your retrieval job. + +> 📘 Date ranges are inclusive +> +> Requesting data for 2018-06-01 until 2018-06-30 will get all data for those days including those specified - e.g. 2018-06-01 00:00:00 until 2018-06-30 23:59:99.
@@ -1767,8 +1663,9 @@ You can fetch a list of segments that are associated to a contact.
```typescript -await client.contacts.listAttachedSegments({ - contact_id: "63a07ddf05a32042dffac965", +await client.dataExport.create({ + created_at_after: 1734519776, + created_at_before: 1734537776, }); ``` @@ -1785,7 +1682,7 @@ await client.contacts.listAttachedSegments({
-**request:** `Intercom.ListSegmentsAttachedToContactRequest` +**request:** `Intercom.CreateDataExportRequest`
@@ -1793,7 +1690,7 @@ await client.contacts.listAttachedSegments({
-**requestOptions:** `Contacts.RequestOptions` +**requestOptions:** `DataExport.RequestOptions`
@@ -1804,7 +1701,7 @@ await client.contacts.listAttachedSegments({
-
client.contacts.listAttachedSubscriptions({ ...params }) -> Intercom.SubscriptionTypeList +
client.dataExport.find({ ...params }) -> Intercom.DataExport
@@ -1816,13 +1713,11 @@ await client.contacts.listAttachedSegments({
-You can fetch a list of subscription types that are attached to a contact. These can be subscriptions that a user has 'opted-in' to or has 'opted-out' from, depending on the subscription type. -This will return a list of Subscription Type objects that the contact is associated with. - -The data property will show a combined list of: +You can view the status of your job by sending a `GET` request to the URL +`https://api.intercom.io/export/content/data/{job_identifier}` - the `{job_identifier}` is the value returned in the response when you first created the export job. More on it can be seen in the Export Job Model. -1.Opt-out subscription types that the user has opted-out from. -2.Opt-in subscription types that the user has opted-in to receiving. +> 🚧 Jobs expire after two days +> All jobs that have completed processing (and are thus available to download from the provided URL) will have an expiry limit of two days from when the export ob completed. After this, the data will no longer be available.
@@ -1838,8 +1733,8 @@ The data property will show a combined list of:
```typescript -await client.contacts.listAttachedSubscriptions({ - contact_id: "63a07ddf05a32042dffac965", +await client.dataExport.find({ + job_identifier: "job_identifier", }); ``` @@ -1856,7 +1751,7 @@ await client.contacts.listAttachedSubscriptions({
-**request:** `Intercom.ListAttachedSubscriptionsRequest` +**request:** `Intercom.FindDataExportRequest`
@@ -1864,7 +1759,7 @@ await client.contacts.listAttachedSubscriptions({
-**requestOptions:** `Contacts.RequestOptions` +**requestOptions:** `DataExport.RequestOptions`
@@ -1875,7 +1770,7 @@ await client.contacts.listAttachedSubscriptions({
-
client.contacts.attachSubscription({ ...params }) -> Intercom.SubscriptionType +
client.dataExport.cancel({ ...params }) -> Intercom.DataExport
@@ -1887,13 +1782,7 @@ await client.contacts.listAttachedSubscriptions({
-You can add a specific subscription to a contact. In Intercom, we have two different subscription types based on user consent - opt-out and opt-in: - -1.Attaching a contact to an opt-out subscription type will opt that user out from receiving messages related to that subscription type. - -2.Attaching a contact to an opt-in subscription type will opt that user in to receiving messages related to that subscription type. - -This will return a subscription type model for the subscription type that was added to the contact. +You can cancel your job
@@ -1909,10 +1798,8 @@ This will return a subscription type model for the subscription type that was ad
```typescript -await client.contacts.attachSubscription({ - contact_id: "63a07ddf05a32042dffac965", - id: "37846", - consent_type: "opt_in", +await client.dataExport.cancel({ + job_identifier: "job_identifier", }); ``` @@ -1929,7 +1816,7 @@ await client.contacts.attachSubscription({
-**request:** `Intercom.AttachSubscriptionToContactRequest` +**request:** `Intercom.CancelDataExportRequest`
@@ -1937,7 +1824,7 @@ await client.contacts.attachSubscription({
-**requestOptions:** `Contacts.RequestOptions` +**requestOptions:** `DataExport.RequestOptions`
@@ -1948,7 +1835,7 @@ await client.contacts.attachSubscription({
-
client.contacts.detachSubscription({ ...params }) -> Intercom.SubscriptionType +
client.dataExport.download({ ...params }) -> void
@@ -1960,9 +1847,15 @@ await client.contacts.attachSubscription({
-You can remove a specific subscription from a contact. This will return a subscription type model for the subscription type that was removed from the contact. +When a job has a status of complete, and thus a filled download_url, you can download your data by hitting that provided URL, formatted like so: https://api.intercom.io/download/content/data/xyz1234. -
+Your exported message data will be streamed continuously back down to you in a gzipped CSV format. + +> 📘 Octet header required +> +> You will have to specify the header Accept: `application/octet-stream` when hitting this endpoint. + +
@@ -1976,9 +1869,8 @@ You can remove a specific subscription from a contact. This will return a subscr
```typescript -await client.contacts.detachSubscription({ - contact_id: "63a07ddf05a32042dffac965", - subscription_id: "37846", +await client.dataExport.download({ + job_identifier: "job_identifier", }); ``` @@ -1995,7 +1887,7 @@ await client.contacts.detachSubscription({
-**request:** `Intercom.DetachSubscriptionFromContactRequest` +**request:** `Intercom.DownloadDataExportRequest`
@@ -2003,7 +1895,7 @@ await client.contacts.detachSubscription({
-**requestOptions:** `Contacts.RequestOptions` +**requestOptions:** `DataExport.RequestOptions`
@@ -2014,7 +1906,9 @@ await client.contacts.detachSubscription({
-
client.contacts.listAttachedTags({ ...params }) -> Intercom.TagList +## HelpCenters + +
client.helpCenters.find({ ...params }) -> Intercom.HelpCenter
@@ -2026,7 +1920,7 @@ await client.contacts.detachSubscription({
-You can fetch a list of all tags that are attached to a specific contact. +You can fetch the details of a single Help Center by making a GET request to `https://api.intercom.io/help_center/help_center/`.
@@ -2042,8 +1936,8 @@ You can fetch a list of all tags that are attached to a specific contact.
```typescript -await client.contacts.listAttachedTags({ - contact_id: "63a07ddf05a32042dffac965", +await client.helpCenters.find({ + help_center_id: 1, }); ``` @@ -2060,7 +1954,7 @@ await client.contacts.listAttachedTags({
-**request:** `Intercom.ListTagsAttachedToContactRequest` +**request:** `Intercom.FindHelpCenterRequest`
@@ -2068,7 +1962,7 @@ await client.contacts.listAttachedTags({
-**requestOptions:** `Contacts.RequestOptions` +**requestOptions:** `HelpCenters.RequestOptions`
@@ -2079,7 +1973,7 @@ await client.contacts.listAttachedTags({
-
client.contacts.find({ ...params }) -> Intercom.Contact +
client.helpCenters.list({ ...params }) -> core.Page
@@ -2091,7 +1985,7 @@ await client.contacts.listAttachedTags({
-You can fetch the details of a single contact. +You can list all Help Centers by making a GET request to `https://api.intercom.io/help_center/help_centers`.
@@ -2107,9 +2001,16 @@ You can fetch the details of a single contact.
```typescript -await client.contacts.find({ - contact_id: "63a07ddf05a32042dffac965", -}); +const response = await client.helpCenters.list(); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +const page = await client.helpCenters.list(); +while (page.hasNextPage()) { + page = page.getNextPage(); +} ```
@@ -2125,7 +2026,7 @@ await client.contacts.find({
-**request:** `Intercom.FindContactRequest` +**request:** `Intercom.ListHelpCentersRequest`
@@ -2133,7 +2034,7 @@ await client.contacts.find({
-**requestOptions:** `Contacts.RequestOptions` +**requestOptions:** `HelpCenters.RequestOptions`
@@ -2144,7 +2045,9 @@ await client.contacts.find({
-
client.contacts.update({ ...params }) -> Intercom.Contact +## Internal Articles + +
client.internalArticles.listInternalArticles() -> Intercom.InternalArticleList
@@ -2156,7 +2059,7 @@ await client.contacts.find({
-You can update an existing contact (ie. user or lead). +You can fetch a list of all internal articles by making a GET request to `https://api.intercom.io/internal_articles`.
@@ -2172,11 +2075,7 @@ You can update an existing contact (ie. user or lead).
```typescript -await client.contacts.update({ - contact_id: "63a07ddf05a32042dffac965", - email: "joebloggs@intercom.io", - name: "joe bloggs", -}); +await client.internalArticles.listInternalArticles(); ```
@@ -2192,15 +2091,7 @@ await client.contacts.update({
-**request:** `Intercom.UpdateContactRequest` - -
-
- -
-
- -**requestOptions:** `Contacts.RequestOptions` +**requestOptions:** `InternalArticles.RequestOptions`
@@ -2211,7 +2102,7 @@ await client.contacts.update({
-
client.contacts.delete({ ...params }) -> Intercom.ContactDeleted +
client.internalArticles.createInternalArticle({ ...params }) -> Intercom.InternalArticle
@@ -2223,7 +2114,7 @@ await client.contacts.update({
-You can delete a single contact. +You can create a new internal article by making a POST request to `https://api.intercom.io/internal_articles`.
@@ -2239,8 +2130,11 @@ You can delete a single contact.
```typescript -await client.contacts.delete({ - contact_id: "contact_id", +await client.internalArticles.createInternalArticle({ + title: "Thanks for everything", + body: "Body of the Article", + author_id: 991266252, + owner_id: 991266252, }); ``` @@ -2257,7 +2151,7 @@ await client.contacts.delete({
-**request:** `Intercom.DeleteContactRequest` +**request:** `Intercom.CreateInternalArticleRequest`
@@ -2265,7 +2159,7 @@ await client.contacts.delete({
-**requestOptions:** `Contacts.RequestOptions` +**requestOptions:** `InternalArticles.RequestOptions`
@@ -2276,7 +2170,7 @@ await client.contacts.delete({
-
client.contacts.mergeLeadInUser({ ...params }) -> Intercom.Contact +
client.internalArticles.retrieveInternalArticle({ ...params }) -> Intercom.InternalArticle
@@ -2288,7 +2182,7 @@ await client.contacts.delete({
-You can merge a contact with a `role` of `lead` into a contact with a `role` of `user`. +You can fetch the details of a single internal article by making a GET request to `https://api.intercom.io/internal_articles/`.
@@ -2304,9 +2198,8 @@ You can merge a contact with a `role` of `lead` into a contact with a `role` of
```typescript -await client.contacts.mergeLeadInUser({ - from: "667d60ac8a68186f43bafdbb", - into: "667d60ac8a68186f43bafdbc", +await client.internalArticles.retrieveInternalArticle({ + internal_article_id: 1, }); ``` @@ -2323,7 +2216,7 @@ await client.contacts.mergeLeadInUser({
-**request:** `Intercom.MergeContactsRequest` +**request:** `Intercom.RetrieveInternalArticleRequest`
@@ -2331,7 +2224,7 @@ await client.contacts.mergeLeadInUser({
-**requestOptions:** `Contacts.RequestOptions` +**requestOptions:** `InternalArticles.RequestOptions`
@@ -2342,7 +2235,7 @@ await client.contacts.mergeLeadInUser({
-
client.contacts.search({ ...params }) -> core.Page +
client.internalArticles.updateInternalArticle({ ...params }) -> Intercom.InternalArticle
@@ -2354,107 +2247,7 @@ await client.contacts.mergeLeadInUser({
-You can search for multiple contacts by the value of their attributes in order to fetch exactly who you want. - -To search for contacts, you need to send a `POST` request to `https://api.intercom.io/contacts/search`. - -This will accept a query object in the body which will define your filters in order to search for contacts. - -{% admonition type="warning" name="Optimizing search queries" %} -Search queries can be complex, so optimizing them can help the performance of your search. -Use the `AND` and `OR` operators to combine multiple filters to get the exact results you need and utilize -pagination to limit the number of results returned. The default is `50` results per page. -See the [pagination section](https://developers.intercom.com/docs/build-an-integration/learn-more/rest-apis/pagination/#example-search-conversations-request) for more details on how to use the `starting_after` param. -{% /admonition %} - -### Contact Creation Delay - -If a contact has recently been created, there is a possibility that it will not yet be available when searching. This means that it may not appear in the response. This delay can take a few minutes. If you need to be instantly notified it is recommended to use webhooks and iterate to see if they match your search filters. - -### Nesting & Limitations - -You can nest these filters in order to get even more granular insights that pinpoint exactly what you need. Example: (1 OR 2) AND (3 OR 4). -There are some limitations to the amount of multiple's there can be: - -- There's a limit of max 2 nested filters -- There's a limit of max 15 filters for each AND or OR group - -### Searching for Timestamp Fields - -All timestamp fields (created_at, updated_at etc.) are indexed as Dates for Contact Search queries; Datetime queries are not currently supported. This means you can only query for timestamp fields by day - not hour, minute or second. -For example, if you search for all Contacts with a created_at value greater (>) than 1577869200 (the UNIX timestamp for January 1st, 2020 9:00 AM), that will be interpreted as 1577836800 (January 1st, 2020 12:00 AM). The search results will then include Contacts created from January 2nd, 2020 12:00 AM onwards. -If you'd like to get contacts created on January 1st, 2020 you should search with a created_at value equal (=) to 1577836800 (January 1st, 2020 12:00 AM). -This behaviour applies only to timestamps used in search queries. The search results will still contain the full UNIX timestamp and be sorted accordingly. - -### Accepted Fields - -Most key listed as part of the Contacts Model are searchable, whether writeable or not. The value you search for has to match the accepted type, otherwise the query will fail (ie. as `created_at` accepts a date, the `value` cannot be a string such as `"foorbar"`). - -| Field | Type | -| ---------------------------------- | ------------------------------ | -| id | String | -| role | String
Accepts user or lead | -| name | String | -| avatar | String | -| owner_id | Integer | -| email | String | -| email_domain | String | -| phone | String | -| external_id | String | -| created_at | Date (UNIX Timestamp) | -| signed_up_at | Date (UNIX Timestamp) | -| updated_at | Date (UNIX Timestamp) | -| last_seen_at | Date (UNIX Timestamp) | -| last_contacted_at | Date (UNIX Timestamp) | -| last_replied_at | Date (UNIX Timestamp) | -| last_email_opened_at | Date (UNIX Timestamp) | -| last_email_clicked_at | Date (UNIX Timestamp) | -| language_override | String | -| browser | String | -| browser_language | String | -| os | String | -| location.country | String | -| location.region | String | -| location.city | String | -| unsubscribed_from_emails | Boolean | -| marked_email_as_spam | Boolean | -| has_hard_bounced | Boolean | -| ios_last_seen_at | Date (UNIX Timestamp) | -| ios_app_version | String | -| ios_device | String | -| ios_app_device | String | -| ios_os_version | String | -| ios_app_name | String | -| ios_sdk_version | String | -| android_last_seen_at | Date (UNIX Timestamp) | -| android_app_version | String | -| android_device | String | -| android_app_name | String | -| andoid_sdk_version | String | -| segment_id | String | -| tag_id | String | -| custom_attributes.{attribute_name} | String | - -### Accepted Operators - -{% admonition type="warning" name="Searching based on `created_at`" %} -You cannot use the `<=` or `>=` operators to search by `created_at`. -{% /admonition %} - -The table below shows the operators you can use to define how you want to search for the value. The operator should be put in as a string (`"="`). The operator has to be compatible with the field's type (eg. you cannot search with `>` for a given string value as it's only compatible for integer's and dates). - -| Operator | Valid Types | Description | -| :------- | :------------------------------- | :--------------------------------------------------------------- | -| = | All | Equals | -| != | All | Doesn't Equal | -| IN | All | In
Shortcut for `OR` queries
Values must be in Array | -| NIN | All | Not In
Shortcut for `OR !` queries
Values must be in Array | -| > | Integer
Date (UNIX Timestamp) | Greater than | -| < | Integer
Date (UNIX Timestamp) | Lower than | -| ~ | String | Contains | -| !~ | String | Doesn't Contain | -| ^ | String | Starts With | -| $ | String | Ends With | +You can update the details of a single internal article by making a PUT request to `https://api.intercom.io/internal_articles/`.
@@ -2470,44 +2263,11 @@ The table below shows the operators you can use to define how you want to search
```typescript -const response = await client.contacts.search({ - query: { - operator: "AND", - value: [ - { - field: "created_at", - operator: ">", - value: "1306054154", - }, - ], - }, - pagination: { - per_page: 5, - }, -}); -for await (const item of response) { - console.log(item); -} - -// Or you can manually iterate page-by-page -const page = await client.contacts.search({ - query: { - operator: "AND", - value: [ - { - field: "created_at", - operator: ">", - value: "1306054154", - }, - ], - }, - pagination: { - per_page: 5, - }, +await client.internalArticles.updateInternalArticle({ + internal_article_id: 1, + title: "Christmas is here!", + body: "

New gifts in store for the jolly season

", }); -while (page.hasNextPage()) { - page = page.getNextPage(); -} ```
@@ -2523,7 +2283,7 @@ while (page.hasNextPage()) {
-**request:** `Intercom.SearchRequest` +**request:** `Intercom.UpdateInternalArticleRequestBody`
@@ -2531,7 +2291,7 @@ while (page.hasNextPage()) {
-**requestOptions:** `Contacts.RequestOptions` +**requestOptions:** `InternalArticles.RequestOptions`
@@ -2542,7 +2302,7 @@ while (page.hasNextPage()) {
-
client.contacts.list({ ...params }) -> core.Page +
client.internalArticles.deleteInternalArticle({ ...params }) -> Intercom.DeletedInternalArticleObject
@@ -2554,11 +2314,7 @@ while (page.hasNextPage()) {
-You can fetch a list of all contacts (ie. users or leads) in your workspace. -{% admonition type="warning" name="Pagination" %} -You can use pagination to limit the number of results returned. The default is `50` results per page. -See the [pagination section](https://developers.intercom.com/docs/build-an-integration/learn-more/rest-apis/pagination/#pagination-for-list-apis) for more details on how to use the `starting_after` param. -{% /admonition %} +You can delete a single internal article by making a DELETE request to `https://api.intercom.io/internal_articles/`.
@@ -2574,16 +2330,9 @@ See the [pagination section](https://developers.intercom.com/docs/build-an-integ
```typescript -const response = await client.contacts.list(); -for await (const item of response) { - console.log(item); -} - -// Or you can manually iterate page-by-page -const page = await client.contacts.list(); -while (page.hasNextPage()) { - page = page.getNextPage(); -} +await client.internalArticles.deleteInternalArticle({ + internal_article_id: 1, +}); ```
@@ -2599,7 +2348,7 @@ while (page.hasNextPage()) {
-**request:** `Intercom.ListContactsRequest` +**request:** `Intercom.DeleteInternalArticleRequest`
@@ -2607,7 +2356,7 @@ while (page.hasNextPage()) {
-**requestOptions:** `Contacts.RequestOptions` +**requestOptions:** `InternalArticles.RequestOptions`
@@ -2618,7 +2367,7 @@ while (page.hasNextPage()) {
-
client.contacts.create({ ...params }) -> Intercom.Contact +
client.internalArticles.searchInternalArticles({ ...params }) -> Intercom.InternalArticleSearchResponse
@@ -2630,7 +2379,7 @@ while (page.hasNextPage()) {
-You can create a new contact (ie. user or lead). +You can search for internal articles by making a GET request to `https://api.intercom.io/internal_articles/search`.
@@ -2646,9 +2395,7 @@ You can create a new contact (ie. user or lead).
```typescript -await client.contacts.create({ - email: "joebloggs@intercom.io", -}); +await client.internalArticles.searchInternalArticles(); ```
@@ -2664,7 +2411,7 @@ await client.contacts.create({
-**request:** `Intercom.CreateContactRequest` +**request:** `Intercom.SearchInternalArticlesRequest`
@@ -2672,7 +2419,7 @@ await client.contacts.create({
-**requestOptions:** `Contacts.RequestOptions` +**requestOptions:** `InternalArticles.RequestOptions`
@@ -2683,7 +2430,9 @@ await client.contacts.create({
-
client.contacts.archive({ ...params }) -> Intercom.ContactArchived +## Companies + +
client.companies.retrieve({ ...params }) -> Intercom.CompaniesRetrieveResponse
@@ -2695,12 +2444,22 @@ await client.contacts.create({
-You can archive a single contact. +You can fetch a single company by passing in `company_id` or `name`. -
-
-
-
+`https://api.intercom.io/companies?name={name}` + +`https://api.intercom.io/companies?company_id={company_id}` + +You can fetch all companies and filter by `segment_id` or `tag_id` as a query parameter. + +`https://api.intercom.io/companies?tag_id={tag_id}` + +`https://api.intercom.io/companies?segment_id={segment_id}` + + + + + #### 🔌 Usage @@ -2711,8 +2470,11 @@ You can archive a single contact.
```typescript -await client.contacts.archive({ - contact_id: "63a07ddf05a32042dffac965", +await client.companies.retrieve({ + name: "my company", + company_id: "12345", + tag_id: "678910", + segment_id: "98765", }); ``` @@ -2729,7 +2491,7 @@ await client.contacts.archive({
-**request:** `Intercom.ArchiveContactRequest` +**request:** `Intercom.RetrieveCompanyRequest`
@@ -2737,7 +2499,7 @@ await client.contacts.archive({
-**requestOptions:** `Contacts.RequestOptions` +**requestOptions:** `Companies.RequestOptions`
@@ -2748,7 +2510,7 @@ await client.contacts.archive({
-
client.contacts.unarchive({ ...params }) -> Intercom.ContactUnarchived +
client.companies.createOrUpdate({ ...params }) -> Intercom.Company
@@ -2760,7 +2522,15 @@ await client.contacts.archive({
-You can unarchive a single contact. +You can create or update a company. + +Companies will be only visible in Intercom when there is at least one associated user. + +Companies are looked up via `company_id` in a `POST` request, if not found via `company_id`, the new company will be created, if found, that company will be updated. + +{% admonition type="warning" name="Using `company_id`" %} +You can set a unique `company_id` value when creating a company. However, it is not possible to update `company_id`. Be sure to set a unique value once upon creation of the company. +{% /admonition %}
@@ -2776,8 +2546,10 @@ You can unarchive a single contact.
```typescript -await client.contacts.unarchive({ - contact_id: "63a07ddf05a32042dffac965", +await client.companies.createOrUpdate({ + name: "my company", + company_id: "company_remote_id", + remote_created_at: 1374138000, }); ``` @@ -2794,7 +2566,7 @@ await client.contacts.unarchive({
-**request:** `Intercom.UnarchiveContactRequest` +**request:** `Intercom.CreateOrUpdateCompanyRequest`
@@ -2802,7 +2574,7 @@ await client.contacts.unarchive({
-**requestOptions:** `Contacts.RequestOptions` +**requestOptions:** `Companies.RequestOptions`
@@ -2813,9 +2585,7 @@ await client.contacts.unarchive({
-## Notes - -
client.notes.list({ ...params }) -> core.Page +
client.companies.find({ ...params }) -> Intercom.Company
@@ -2827,7 +2597,7 @@ await client.contacts.unarchive({
-You can fetch a list of notes that are associated to a contact. +You can fetch a single company.
@@ -2843,20 +2613,9 @@ You can fetch a list of notes that are associated to a contact.
```typescript -const response = await client.notes.list({ - contact_id: "contact_id", -}); -for await (const item of response) { - console.log(item); -} - -// Or you can manually iterate page-by-page -const page = await client.notes.list({ - contact_id: "contact_id", +await client.companies.find({ + company_id: "5f4d3c1c-7b1b-4d7d-a97e-6095715c6632", }); -while (page.hasNextPage()) { - page = page.getNextPage(); -} ```
@@ -2872,7 +2631,7 @@ while (page.hasNextPage()) {
-**request:** `Intercom.ListContactNotesRequest` +**request:** `Intercom.FindCompanyRequest`
@@ -2880,7 +2639,7 @@ while (page.hasNextPage()) {
-**requestOptions:** `Notes.RequestOptions` +**requestOptions:** `Companies.RequestOptions`
@@ -2891,7 +2650,7 @@ while (page.hasNextPage()) {
-
client.notes.create({ ...params }) -> Intercom.Note +
client.companies.update({ ...params }) -> Intercom.Company
@@ -2903,7 +2662,11 @@ while (page.hasNextPage()) {
-You can add a note to a single contact. +You can update a single company using the Intercom provisioned `id`. + +{% admonition type="warning" name="Using `company_id`" %} +When updating a company it is not possible to update `company_id`. This can only be set once upon creation of the company. +{% /admonition %}
@@ -2919,10 +2682,8 @@ You can add a note to a single contact.
```typescript -await client.notes.create({ - contact_id: "123", - body: "Hello", - admin_id: "123", +await client.companies.update({ + company_id: "5f4d3c1c-7b1b-4d7d-a97e-6095715c6632", }); ``` @@ -2939,7 +2700,7 @@ await client.notes.create({
-**request:** `Intercom.CreateContactNoteRequest` +**request:** `Intercom.UpdateCompanyRequest`
@@ -2947,7 +2708,7 @@ await client.notes.create({
-**requestOptions:** `Notes.RequestOptions` +**requestOptions:** `Companies.RequestOptions`
@@ -2958,7 +2719,7 @@ await client.notes.create({
-
client.notes.find({ ...params }) -> Intercom.Note +
client.companies.delete({ ...params }) -> Intercom.DeletedCompanyObject
@@ -2970,7 +2731,7 @@ await client.notes.create({
-You can fetch the details of a single note. +You can delete a single company.
@@ -2986,8 +2747,8 @@ You can fetch the details of a single note.
```typescript -await client.notes.find({ - note_id: "1", +await client.companies.delete({ + company_id: "5f4d3c1c-7b1b-4d7d-a97e-6095715c6632", }); ``` @@ -3004,7 +2765,7 @@ await client.notes.find({
-**request:** `Intercom.FindNoteRequest` +**request:** `Intercom.DeleteCompanyRequest`
@@ -3012,7 +2773,7 @@ await client.notes.find({
-**requestOptions:** `Notes.RequestOptions` +**requestOptions:** `Companies.RequestOptions`
@@ -3023,9 +2784,7 @@ await client.notes.find({
-## Tags - -
client.tags.tagContact({ ...params }) -> Intercom.Tag +
client.companies.listAttachedContacts({ ...params }) -> Intercom.CompanyAttachedContacts
@@ -3037,7 +2796,7 @@ await client.notes.find({
-You can tag a specific contact. This will return a tag object for the tag that was added to the contact. +You can fetch a list of all contacts that belong to a company.
@@ -3053,9 +2812,8 @@ You can tag a specific contact. This will return a tag object for the tag that w
```typescript -await client.tags.tagContact({ - contact_id: "63a07ddf05a32042dffac965", - id: "7522907", +await client.companies.listAttachedContacts({ + company_id: "5f4d3c1c-7b1b-4d7d-a97e-6095715c6632", }); ``` @@ -3072,7 +2830,7 @@ await client.tags.tagContact({
-**request:** `Intercom.TagContactRequest` +**request:** `Intercom.ListAttachedContactsRequest`
@@ -3080,7 +2838,7 @@ await client.tags.tagContact({
-**requestOptions:** `Tags.RequestOptions` +**requestOptions:** `Companies.RequestOptions`
@@ -3091,7 +2849,7 @@ await client.tags.tagContact({
-
client.tags.untagContact({ ...params }) -> Intercom.Tag +
client.companies.listAttachedSegments({ ...params }) -> Intercom.CompanyAttachedSegments
@@ -3103,7 +2861,7 @@ await client.tags.tagContact({
-You can remove tag from a specific contact. This will return a tag object for the tag that was removed from the contact. +You can fetch a list of all segments that belong to a company.
@@ -3119,9 +2877,8 @@ You can remove tag from a specific contact. This will return a tag object for th
```typescript -await client.tags.untagContact({ - contact_id: "63a07ddf05a32042dffac965", - tag_id: "7522907", +await client.companies.listAttachedSegments({ + company_id: "5f4d3c1c-7b1b-4d7d-a97e-6095715c6632", }); ``` @@ -3138,7 +2895,7 @@ await client.tags.untagContact({
-**request:** `Intercom.UntagContactRequest` +**request:** `Intercom.ListSegmentsAttachedToCompanyRequest`
@@ -3146,7 +2903,7 @@ await client.tags.untagContact({
-**requestOptions:** `Tags.RequestOptions` +**requestOptions:** `Companies.RequestOptions`
@@ -3157,7 +2914,7 @@ await client.tags.untagContact({
-
client.tags.tagConversation({ ...params }) -> Intercom.Tag +
client.companies.list({ ...params }) -> core.Page
@@ -3169,7 +2926,15 @@ await client.tags.untagContact({
-You can tag a specific conversation. This will return a tag object for the tag that was added to the conversation. +You can list companies. The company list is sorted by the `last_request_at` field and by default is ordered descending, most recently requested first. + +Note that the API does not include companies who have no associated users in list responses. + +When using the Companies endpoint and the pages object to iterate through the returned companies, there is a limit of 10,000 Companies that can be returned. If you need to list or iterate on more than 10,000 Companies, please use the [Scroll API](https://developers.intercom.com/reference#iterating-over-all-companies). +{% admonition type="warning" name="Pagination" %} +You can use pagination to limit the number of results returned. The default is `20` results per page. +See the [pagination section](https://developers.intercom.com/docs/build-an-integration/learn-more/rest-apis/pagination/#pagination-for-list-apis) for more details on how to use the `starting_after` param. +{% /admonition %}
@@ -3185,11 +2950,20 @@ You can tag a specific conversation. This will return a tag object for the tag t
```typescript -await client.tags.tagConversation({ - conversation_id: "64619700005694", - id: "7522907", - admin_id: "780", +const response = await client.companies.list({ + order: "desc", +}); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +const page = await client.companies.list({ + order: "desc", }); +while (page.hasNextPage()) { + page = page.getNextPage(); +} ```
@@ -3205,7 +2979,7 @@ await client.tags.tagConversation({
-**request:** `Intercom.TagConversationRequest` +**request:** `Intercom.ListCompaniesRequest`
@@ -3213,7 +2987,7 @@ await client.tags.tagConversation({
-**requestOptions:** `Tags.RequestOptions` +**requestOptions:** `Companies.RequestOptions`
@@ -3224,7 +2998,7 @@ await client.tags.tagConversation({
-
client.tags.untagConversation({ ...params }) -> Intercom.Tag +
client.companies.scroll({ ...params }) -> core.Page
@@ -3236,7 +3010,21 @@ await client.tags.tagConversation({
-You can remove tag from a specific conversation. This will return a tag object for the tag that was removed from the conversation. + The `list all companies` functionality does not work well for huge datasets, and can result in errors and performance problems when paging deeply. The Scroll API provides an efficient mechanism for iterating over all companies in a dataset. + +- Each app can only have 1 scroll open at a time. You'll get an error message if you try to have more than one open per app. +- If the scroll isn't used for 1 minute, it expires and calls with that scroll param will fail +- If the end of the scroll is reached, "companies" will be empty and the scroll parameter will expire + +{% admonition type="info" name="Scroll Parameter" %} +You can get the first page of companies by simply sending a GET request to the scroll endpoint. +For subsequent requests you will need to use the scroll parameter from the response. +{% /admonition %} +{% admonition type="danger" name="Scroll network timeouts" %} +Since scroll is often used on large datasets network errors such as timeouts can be encountered. When this occurs you will see a HTTP 500 error with the following message: +"Request failed due to an internal network error. Please restart the scroll operation." +If this happens, you will need to restart your scroll query: It is not possible to continue from a specific point when using scroll. +{% /admonition %}
@@ -3252,11 +3040,16 @@ You can remove tag from a specific conversation. This will return a tag object f
```typescript -await client.tags.untagConversation({ - conversation_id: "64619700005694", - tag_id: "7522907", - admin_id: "123", -}); +const response = await client.companies.scroll(); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +const page = await client.companies.scroll(); +while (page.hasNextPage()) { + page = page.getNextPage(); +} ```
@@ -3272,7 +3065,7 @@ await client.tags.untagConversation({
-**request:** `Intercom.UntagConversationRequest` +**request:** `Intercom.ScrollCompaniesRequest`
@@ -3280,7 +3073,7 @@ await client.tags.untagConversation({
-**requestOptions:** `Tags.RequestOptions` +**requestOptions:** `Companies.RequestOptions`
@@ -3291,7 +3084,7 @@ await client.tags.untagConversation({
-
client.tags.list() -> Intercom.TagList +
client.companies.attachContact({ ...params }) -> Intercom.Company
@@ -3303,7 +3096,7 @@ await client.tags.untagConversation({
-You can fetch a list of all tags for a given workspace. +You can attach a company to a single contact.
@@ -3319,7 +3112,10 @@ You can fetch a list of all tags for a given workspace.
```typescript -await client.tags.list(); +await client.companies.attachContact({ + contact_id: 1, + id: "6762f09a1bb69f9f2193bb34", +}); ```
@@ -3335,7 +3131,15 @@ await client.tags.list();
-**requestOptions:** `Tags.RequestOptions` +**request:** `Intercom.AttachContactToCompanyRequest` + +
+
+ +
+
+ +**requestOptions:** `Companies.RequestOptions`
@@ -3346,7 +3150,7 @@ await client.tags.list();
-
client.tags.create({ ...params }) -> Intercom.Tag +
client.companies.detachContact({ ...params }) -> Intercom.Company
@@ -3358,19 +3162,7 @@ await client.tags.list();
-You can use this endpoint to perform the following operations: - -**1. Create a new tag:** You can create a new tag by passing in the tag name as specified in "Create or Update Tag Request Payload" described below. - -**2. Update an existing tag:** You can update an existing tag by passing the id of the tag as specified in "Create or Update Tag Request Payload" described below. - -**3. Tag Companies:** You can tag single company or a list of companies. You can tag a company by passing in the tag name and the company details as specified in "Tag Company Request Payload" described below. Also, if the tag doesn't exist then a new one will be created automatically. - -**4. Untag Companies:** You can untag a single company or a list of companies. You can untag a company by passing in the tag id and the company details as specified in "Untag Company Request Payload" described below. - -**5. Tag Multiple Users:** You can tag a list of users. You can tag the users by passing in the tag name and the user details as specified in "Tag Users Request Payload" described below. - -Each operation will return a tag object. +You can detach a company from a single contact.
@@ -3386,8 +3178,9 @@ Each operation will return a tag object.
```typescript -await client.tags.create({ - name: "test", +await client.companies.detachContact({ + contact_id: "58a430d35458202d41b1e65b", + company_id: "58a430d35458202d41b1e65b", }); ``` @@ -3404,7 +3197,7 @@ await client.tags.create({
-**request:** `Intercom.TagsCreateRequestBody` +**request:** `Intercom.DetachContactFromCompanyRequest`
@@ -3412,7 +3205,7 @@ await client.tags.create({
-**requestOptions:** `Tags.RequestOptions` +**requestOptions:** `Companies.RequestOptions`
@@ -3423,7 +3216,9 @@ await client.tags.create({
-
client.tags.find({ ...params }) -> Intercom.Tag +## Contacts + +
client.contacts.listAttachedCompanies({ ...params }) -> core.Page
@@ -3435,8 +3230,7 @@ await client.tags.create({
-You can fetch the details of tags that are on the workspace by their id. -This will return a tag object. +You can fetch a list of companies that are associated to a contact.
@@ -3452,12 +3246,23 @@ This will return a tag object.
```typescript -await client.tags.find({ - tag_id: "123", +const response = await client.contacts.listAttachedCompanies({ + contact_id: "63a07ddf05a32042dffac965", }); -``` +for await (const item of response) { + console.log(item); +} -
+// Or you can manually iterate page-by-page +const page = await client.contacts.listAttachedCompanies({ + contact_id: "63a07ddf05a32042dffac965", +}); +while (page.hasNextPage()) { + page = page.getNextPage(); +} +``` + +
@@ -3470,7 +3275,7 @@ await client.tags.find({
-**request:** `Intercom.FindTagRequest` +**request:** `Intercom.ListAttachedCompaniesRequest`
@@ -3478,7 +3283,7 @@ await client.tags.find({
-**requestOptions:** `Tags.RequestOptions` +**requestOptions:** `Contacts.RequestOptions`
@@ -3489,7 +3294,7 @@ await client.tags.find({
-
client.tags.delete({ ...params }) -> void +
client.contacts.listAttachedSegments({ ...params }) -> Intercom.ContactSegments
@@ -3501,7 +3306,7 @@ await client.tags.find({
-You can delete the details of tags that are on the workspace by passing in the id. +You can fetch a list of segments that are associated to a contact.
@@ -3517,8 +3322,8 @@ You can delete the details of tags that are on the workspace by passing in the i
```typescript -await client.tags.delete({ - tag_id: "123", +await client.contacts.listAttachedSegments({ + contact_id: "63a07ddf05a32042dffac965", }); ``` @@ -3535,7 +3340,7 @@ await client.tags.delete({
-**request:** `Intercom.DeleteTagRequest` +**request:** `Intercom.ListSegmentsAttachedToContactRequest`
@@ -3543,7 +3348,7 @@ await client.tags.delete({
-**requestOptions:** `Tags.RequestOptions` +**requestOptions:** `Contacts.RequestOptions`
@@ -3554,7 +3359,7 @@ await client.tags.delete({
-
client.tags.tagTicket({ ...params }) -> Intercom.Tag +
client.contacts.listAttachedSubscriptions({ ...params }) -> Intercom.SubscriptionTypeList
@@ -3566,7 +3371,13 @@ await client.tags.delete({
-You can tag a specific ticket. This will return a tag object for the tag that was added to the ticket. +You can fetch a list of subscription types that are attached to a contact. These can be subscriptions that a user has 'opted-in' to or has 'opted-out' from, depending on the subscription type. +This will return a list of Subscription Type objects that the contact is associated with. + +The data property will show a combined list of: + +1.Opt-out subscription types that the user has opted-out from. +2.Opt-in subscription types that the user has opted-in to receiving.
@@ -3582,10 +3393,8 @@ You can tag a specific ticket. This will return a tag object for the tag that wa
```typescript -await client.tags.tagTicket({ - ticket_id: "64619700005694", - id: "7522907", - admin_id: "780", +await client.contacts.listAttachedSubscriptions({ + contact_id: "63a07ddf05a32042dffac965", }); ``` @@ -3602,7 +3411,7 @@ await client.tags.tagTicket({
-**request:** `Intercom.TagTicketRequest` +**request:** `Intercom.ListAttachedSubscriptionsRequest`
@@ -3610,7 +3419,7 @@ await client.tags.tagTicket({
-**requestOptions:** `Tags.RequestOptions` +**requestOptions:** `Contacts.RequestOptions`
@@ -3621,7 +3430,7 @@ await client.tags.tagTicket({
-
client.tags.untagTicket({ ...params }) -> Intercom.Tag +
client.contacts.attachSubscription({ ...params }) -> Intercom.SubscriptionType
@@ -3633,7 +3442,13 @@ await client.tags.tagTicket({
-You can remove tag from a specific ticket. This will return a tag object for the tag that was removed from the ticket. +You can add a specific subscription to a contact. In Intercom, we have two different subscription types based on user consent - opt-out and opt-in: + +1.Attaching a contact to an opt-out subscription type will opt that user out from receiving messages related to that subscription type. + +2.Attaching a contact to an opt-in subscription type will opt that user in to receiving messages related to that subscription type. + +This will return a subscription type model for the subscription type that was added to the contact.
@@ -3649,10 +3464,10 @@ You can remove tag from a specific ticket. This will return a tag object for the
```typescript -await client.tags.untagTicket({ - ticket_id: "64619700005694", - tag_id: "7522907", - admin_id: "123", +await client.contacts.attachSubscription({ + contact_id: "63a07ddf05a32042dffac965", + id: "37846", + consent_type: "opt_in", }); ``` @@ -3669,7 +3484,7 @@ await client.tags.untagTicket({
-**request:** `Intercom.UntagTicketRequest` +**request:** `Intercom.AttachSubscriptionToContactRequest`
@@ -3677,7 +3492,7 @@ await client.tags.untagTicket({
-**requestOptions:** `Tags.RequestOptions` +**requestOptions:** `Contacts.RequestOptions`
@@ -3688,9 +3503,7 @@ await client.tags.untagTicket({
-## Conversations - -
client.conversations.list({ ...params }) -> core.Page +
client.contacts.detachSubscription({ ...params }) -> Intercom.SubscriptionType
@@ -3702,13 +3515,7 @@ await client.tags.untagTicket({
-You can fetch a list of all conversations. - -You can optionally request the result page size and the cursor to start after to fetch the result. -{% admonition type="warning" name="Pagination" %} -You can use pagination to limit the number of results returned. The default is `20` results per page. -See the [pagination section](https://developers.intercom.com/docs/build-an-integration/learn-more/rest-apis/pagination/#pagination-for-list-apis) for more details on how to use the `starting_after` param. -{% /admonition %} +You can remove a specific subscription from a contact. This will return a subscription type model for the subscription type that was removed from the contact.
@@ -3724,16 +3531,10 @@ See the [pagination section](https://developers.intercom.com/docs/build-an-integ
```typescript -const response = await client.conversations.list(); -for await (const item of response) { - console.log(item); -} - -// Or you can manually iterate page-by-page -const page = await client.conversations.list(); -while (page.hasNextPage()) { - page = page.getNextPage(); -} +await client.contacts.detachSubscription({ + contact_id: "63a07ddf05a32042dffac965", + subscription_id: "37846", +}); ```
@@ -3749,7 +3550,7 @@ while (page.hasNextPage()) {
-**request:** `Intercom.ListConversationsRequest` +**request:** `Intercom.DetachSubscriptionFromContactRequest`
@@ -3757,7 +3558,7 @@ while (page.hasNextPage()) {
-**requestOptions:** `Conversations.RequestOptions` +**requestOptions:** `Contacts.RequestOptions`
@@ -3768,7 +3569,7 @@ while (page.hasNextPage()) {
-
client.conversations.create({ ...params }) -> Intercom.Message +
client.contacts.listAttachedTags({ ...params }) -> Intercom.TagList
@@ -3780,15 +3581,72 @@ while (page.hasNextPage()) {
-You can create a conversation that has been initiated by a contact (ie. user or lead). -The conversation can be an in-app message only. +You can fetch a list of all tags that are attached to a specific contact. -{% admonition type="info" name="Sending for visitors" %} -You can also send a message from a visitor by specifying their `user_id` or `id` value in the `from` field, along with a `type` field value of `contact`. -This visitor will be automatically converted to a contact with a lead role once the conversation is created. -{% /admonition %} +
+
+
+
-This will return the Message model that has been created. +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.contacts.listAttachedTags({ + contact_id: "63a07ddf05a32042dffac965", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Intercom.ListTagsAttachedToContactRequest` + +
+
+ +
+
+ +**requestOptions:** `Contacts.RequestOptions` + +
+
+
+
+ + + +
+ +
client.contacts.find({ ...params }) -> Intercom.ContactsFindResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +You can fetch the details of a single contact.
@@ -3804,12 +3662,8 @@ This will return the Message model that has been created.
```typescript -await client.conversations.create({ - from: { - type: "user", - id: "667d60d18a68186f43bafddd", - }, - body: "Hello there", +await client.contacts.find({ + contact_id: "63a07ddf05a32042dffac965", }); ``` @@ -3826,7 +3680,7 @@ await client.conversations.create({
-**request:** `Intercom.CreateConversationRequest` +**request:** `Intercom.FindContactRequest`
@@ -3834,7 +3688,7 @@ await client.conversations.create({
-**requestOptions:** `Conversations.RequestOptions` +**requestOptions:** `Contacts.RequestOptions`
@@ -3845,7 +3699,7 @@ await client.conversations.create({
-
client.conversations.find({ ...params }) -> Intercom.Conversation +
client.contacts.update({ ...params }) -> Intercom.ContactsUpdateResponse
@@ -3857,16 +3711,14 @@ await client.conversations.create({
-You can fetch the details of a single conversation. +You can update an existing contact (ie. user or lead). -This will return a single Conversation model with all its conversation parts. +{% admonition type="info" %} +This endpoint handles both **contact updates** and **custom object associations**. -{% admonition type="warning" name="Hard limit of 500 parts" %} -The maximum number of conversation parts that can be returned via the API is 500. If you have more than that we will return the 500 most recent conversation parts. +See _`update a contact with an association to a custom object instance`_ in the request/response examples to see the custom object association format. {% /admonition %} -For AI agent conversation metadata, please note that you need to have the agent enabled in your workspace, which is a [paid feature](https://www.intercom.com/help/en/articles/8205718-fin-resolutions#h_97f8c2e671). -
@@ -3881,9 +3733,10 @@ For AI agent conversation metadata, please note that you need to have the agent
```typescript -await client.conversations.find({ - conversation_id: "123", - display_as: "plaintext", +await client.contacts.update({ + contact_id: "63a07ddf05a32042dffac965", + email: "joebloggs@intercom.io", + name: "joe bloggs", }); ``` @@ -3900,7 +3753,7 @@ await client.conversations.find({
-**request:** `Intercom.FindConversationRequest` +**request:** `Intercom.UpdateContactRequest`
@@ -3908,7 +3761,7 @@ await client.conversations.find({
-**requestOptions:** `Conversations.RequestOptions` +**requestOptions:** `Contacts.RequestOptions`
@@ -3919,7 +3772,7 @@ await client.conversations.find({
-
client.conversations.update({ ...params }) -> Intercom.Conversation +
client.contacts.delete({ ...params }) -> Intercom.ContactDeleted
@@ -3931,11 +3784,7 @@ await client.conversations.find({
-You can update an existing conversation. - -{% admonition type="info" name="Replying and other actions" %} -If you want to reply to a coveration or take an action such as assign, unassign, open, close or snooze, take a look at the reply and manage endpoints. -{% /admonition %} +You can delete a single contact.
@@ -3951,14 +3800,8 @@ If you want to reply to a coveration or take an action such as assign, unassign,
```typescript -await client.conversations.update({ - conversation_id: "123", - display_as: "plaintext", - read: true, - custom_attributes: { - issue_type: "Billing", - priority: "High", - }, +await client.contacts.delete({ + contact_id: "contact_id", }); ``` @@ -3975,7 +3818,7 @@ await client.conversations.update({
-**request:** `Intercom.UpdateConversationRequest` +**request:** `Intercom.DeleteContactRequest`
@@ -3983,7 +3826,7 @@ await client.conversations.update({
-**requestOptions:** `Conversations.RequestOptions` +**requestOptions:** `Contacts.RequestOptions`
@@ -3994,7 +3837,7 @@ await client.conversations.update({
-
client.conversations.search({ ...params }) -> core.Page +
client.contacts.mergeLeadInUser({ ...params }) -> Intercom.ContactsMergeLeadInUserResponse
@@ -4006,106 +3849,3920 @@ await client.conversations.update({
-You can search for multiple conversations by the value of their attributes in order to fetch exactly which ones you want. +You can merge a contact with a `role` of `lead` into a contact with a `role` of `user`. -To search for conversations, you need to send a `POST` request to `https://api.intercom.io/conversations/search`. +
+
+
+
-This will accept a query object in the body which will define your filters in order to search for conversations. -{% admonition type="warning" name="Optimizing search queries" %} -Search queries can be complex, so optimizing them can help the performance of your search. -Use the `AND` and `OR` operators to combine multiple filters to get the exact results you need and utilize -pagination to limit the number of results returned. The default is `20` results per page and maximum is `150`. -See the [pagination section](https://developers.intercom.com/docs/build-an-integration/learn-more/rest-apis/pagination/#example-search-conversations-request) for more details on how to use the `starting_after` param. -{% /admonition %} +#### 🔌 Usage -### Nesting & Limitations +
+
-You can nest these filters in order to get even more granular insights that pinpoint exactly what you need. Example: (1 OR 2) AND (3 OR 4). -There are some limitations to the amount of multiple's there can be: +
+
-- There's a limit of max 2 nested filters -- There's a limit of max 15 filters for each AND or OR group +```typescript +await client.contacts.mergeLeadInUser({ + from: "6762f0d51bb69f9f2193bb7f", + into: "6762f0d51bb69f9f2193bb80", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Intercom.MergeContactsRequest` + +
+
+ +
+
+ +**requestOptions:** `Contacts.RequestOptions` + +
+
+
+
+ + + +
+ +
client.contacts.search({ ...params }) -> core.Page +
+
+ +#### 📝 Description + +
+
+ +
+
+ +You can search for multiple contacts by the value of their attributes in order to fetch exactly who you want. + +To search for contacts, you need to send a `POST` request to `https://api.intercom.io/contacts/search`. + +This will accept a query object in the body which will define your filters in order to search for contacts. + +{% admonition type="warning" name="Optimizing search queries" %} +Search queries can be complex, so optimizing them can help the performance of your search. +Use the `AND` and `OR` operators to combine multiple filters to get the exact results you need and utilize +pagination to limit the number of results returned. The default is `50` results per page. +See the [pagination section](https://developers.intercom.com/docs/build-an-integration/learn-more/rest-apis/pagination/#example-search-conversations-request) for more details on how to use the `starting_after` param. +{% /admonition %} + +### Contact Creation Delay + +If a contact has recently been created, there is a possibility that it will not yet be available when searching. This means that it may not appear in the response. This delay can take a few minutes. If you need to be instantly notified it is recommended to use webhooks and iterate to see if they match your search filters. + +### Nesting & Limitations + +You can nest these filters in order to get even more granular insights that pinpoint exactly what you need. Example: (1 OR 2) AND (3 OR 4). +There are some limitations to the amount of multiple's there can be: + +- There's a limit of max 2 nested filters +- There's a limit of max 15 filters for each AND or OR group + +### Searching for Timestamp Fields + +All timestamp fields (created_at, updated_at etc.) are indexed as Dates for Contact Search queries; Datetime queries are not currently supported. This means you can only query for timestamp fields by day - not hour, minute or second. +For example, if you search for all Contacts with a created_at value greater (>) than 1577869200 (the UNIX timestamp for January 1st, 2020 9:00 AM), that will be interpreted as 1577836800 (January 1st, 2020 12:00 AM). The search results will then include Contacts created from January 2nd, 2020 12:00 AM onwards. +If you'd like to get contacts created on January 1st, 2020 you should search with a created_at value equal (=) to 1577836800 (January 1st, 2020 12:00 AM). +This behaviour applies only to timestamps used in search queries. The search results will still contain the full UNIX timestamp and be sorted accordingly. ### Accepted Fields -Most keys listed as part of the The conversation model is searchable, whether writeable or not. The value you search for has to match the accepted type, otherwise the query will fail (ie. as `created_at` accepts a date, the `value` cannot be a string such as `"foorbar"`). -The `source.body` field is unique as the search will not be performed against the entire value, but instead against every element of the value separately. For example, when searching for a conversation with a `"I need support"` body - the query should contain a `=` operator with the value `"support"` for such conversation to be returned. A query with a `=` operator and a `"need support"` value will not yield a result. +Most key listed as part of the Contacts Model are searchable, whether writeable or not. The value you search for has to match the accepted type, otherwise the query will fail (ie. as `created_at` accepts a date, the `value` cannot be a string such as `"foorbar"`). -| Field | Type | -| :---------------------------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------- | -| id | String | -| created_at | Date (UNIX timestamp) | -| updated_at | Date (UNIX timestamp) | -| source.type | String
Accepted fields are `conversation`, `email`, `facebook`, `instagram`, `phone_call`, `phone_switch`, `push`, `sms`, `twitter` and `whatsapp`. | -| source.id | String | -| source.delivered_as | String | -| source.subject | String | -| source.body | String | -| source.author.id | String | -| source.author.type | String | -| source.author.name | String | -| source.author.email | String | -| source.url | String | -| contact_ids | String | -| teammate_ids | String | -| admin_assignee_id | String | -| team_assignee_id | String | -| channel_initiated | String | -| open | Boolean | -| read | Boolean | -| state | String | -| waiting_since | Date (UNIX timestamp) | -| snoozed_until | Date (UNIX timestamp) | -| tag_ids | String | -| priority | String | -| statistics.time_to_assignment | Integer | -| statistics.time_to_admin_reply | Integer | -| statistics.time_to_first_close | Integer | -| statistics.time_to_last_close | Integer | -| statistics.median_time_to_reply | Integer | -| statistics.first_contact_reply_at | Date (UNIX timestamp) | -| statistics.first_assignment_at | Date (UNIX timestamp) | -| statistics.first_admin_reply_at | Date (UNIX timestamp) | -| statistics.first_close_at | Date (UNIX timestamp) | -| statistics.last_assignment_at | Date (UNIX timestamp) | -| statistics.last_assignment_admin_reply_at | Date (UNIX timestamp) | -| statistics.last_contact_reply_at | Date (UNIX timestamp) | -| statistics.last_admin_reply_at | Date (UNIX timestamp) | -| statistics.last_close_at | Date (UNIX timestamp) | -| statistics.last_closed_by_id | String | -| statistics.count_reopens | Integer | -| statistics.count_assignments | Integer | -| statistics.count_conversation_parts | Integer | -| conversation_rating.requested_at | Date (UNIX timestamp) | -| conversation_rating.replied_at | Date (UNIX timestamp) | -| conversation_rating.score | Integer | -| conversation_rating.remark | String | -| conversation_rating.contact_id | String | -| conversation_rating.admin_d | String | -| ai_agent_participated | Boolean | -| ai_agent.resolution_state | String | -| ai_agent.last_answer_type | String | -| ai_agent.rating | Integer | -| ai_agent.rating_remark | String | -| ai_agent.source_type | String | -| ai_agent.source_title | String | +| Field | Type | +| ---------------------------------- | ------------------------------ | +| id | String | +| role | String
Accepts user or lead | +| name | String | +| avatar | String | +| owner_id | Integer | +| email | String | +| email_domain | String | +| phone | String | +| external_id | String | +| created_at | Date (UNIX Timestamp) | +| signed_up_at | Date (UNIX Timestamp) | +| updated_at | Date (UNIX Timestamp) | +| last_seen_at | Date (UNIX Timestamp) | +| last_contacted_at | Date (UNIX Timestamp) | +| last_replied_at | Date (UNIX Timestamp) | +| last_email_opened_at | Date (UNIX Timestamp) | +| last_email_clicked_at | Date (UNIX Timestamp) | +| language_override | String | +| browser | String | +| browser_language | String | +| os | String | +| location.country | String | +| location.region | String | +| location.city | String | +| unsubscribed_from_emails | Boolean | +| marked_email_as_spam | Boolean | +| has_hard_bounced | Boolean | +| ios_last_seen_at | Date (UNIX Timestamp) | +| ios_app_version | String | +| ios_device | String | +| ios_app_device | String | +| ios_os_version | String | +| ios_app_name | String | +| ios_sdk_version | String | +| android_last_seen_at | Date (UNIX Timestamp) | +| android_app_version | String | +| android_device | String | +| android_app_name | String | +| andoid_sdk_version | String | +| segment_id | String | +| tag_id | String | +| custom_attributes.{attribute_name} | String | ### Accepted Operators +{% admonition type="warning" name="Searching based on `created_at`" %} +You cannot use the `<=` or `>=` operators to search by `created_at`. +{% /admonition %} + The table below shows the operators you can use to define how you want to search for the value. The operator should be put in as a string (`"="`). The operator has to be compatible with the field's type (eg. you cannot search with `>` for a given string value as it's only compatible for integer's and dates). -| Operator | Valid Types | Description | -| :------- | :---------------------------- | :--------------------------------------------------------- | -| = | All | Equals | -| != | All | Doesn't Equal | -| IN | All | In Shortcut for `OR` queries Values most be in Array | -| NIN | All | Not In Shortcut for `OR !` queries Values must be in Array | -| > | Integer Date (UNIX Timestamp) | Greater (or equal) than | -| < | Integer Date (UNIX Timestamp) | Lower (or equal) than | -| ~ | String | Contains | -| !~ | String | Doesn't Contain | -| ^ | String | Starts With | -| $ | String | Ends With | +| Operator | Valid Types | Description | +| :------- | :------------------------------- | :--------------------------------------------------------------- | +| = | All | Equals | +| != | All | Doesn't Equal | +| IN | All | In
Shortcut for `OR` queries
Values must be in Array | +| NIN | All | Not In
Shortcut for `OR !` queries
Values must be in Array | +| > | Integer
Date (UNIX Timestamp) | Greater than | +| < | Integer
Date (UNIX Timestamp) | Lower than | +| ~ | String | Contains | +| !~ | String | Doesn't Contain | +| ^ | String | Starts With | +| $ | String | Ends With | + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +const response = await client.contacts.search({ + query: { + operator: "AND", + value: [ + { + field: "created_at", + operator: ">", + value: "1306054154", + }, + ], + }, + pagination: { + per_page: 5, + }, +}); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +const page = await client.contacts.search({ + query: { + operator: "AND", + value: [ + { + field: "created_at", + operator: ">", + value: "1306054154", + }, + ], + }, + pagination: { + per_page: 5, + }, +}); +while (page.hasNextPage()) { + page = page.getNextPage(); +} +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Intercom.SearchRequest` + +
+
+ +
+
+ +**requestOptions:** `Contacts.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.contacts.list({ ...params }) -> core.Page +
+
+ +#### 📝 Description + +
+
+ +
+
+ +You can fetch a list of all contacts (ie. users or leads) in your workspace. +{% admonition type="warning" name="Pagination" %} +You can use pagination to limit the number of results returned. The default is `50` results per page. +See the [pagination section](https://developers.intercom.com/docs/build-an-integration/learn-more/rest-apis/pagination/#pagination-for-list-apis) for more details on how to use the `starting_after` param. +{% /admonition %} + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +const response = await client.contacts.list(); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +const page = await client.contacts.list(); +while (page.hasNextPage()) { + page = page.getNextPage(); +} +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Intercom.ListContactsRequest` + +
+
+ +
+
+ +**requestOptions:** `Contacts.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.contacts.create({ ...params }) -> Intercom.ContactsCreateResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +You can create a new contact (ie. user or lead). + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.contacts.create({ + email: "joebloggs@intercom.io", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Intercom.CreateContactRequest` + +
+
+ +
+
+ +**requestOptions:** `Contacts.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.contacts.showContactByExternalId({ ...params }) -> Intercom.ShowContactByExternalIdResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +You can fetch the details of a single contact by external ID. Note that this endpoint only supports users and not leads. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.contacts.showContactByExternalId({ + external_id: "cdd29344-5e0c-4ef0-ac56-f9ba2979bc27", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Intercom.ShowContactByExternalIdRequest` + +
+
+ +
+
+ +**requestOptions:** `Contacts.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.contacts.archive({ ...params }) -> Intercom.ContactArchived +
+
+ +#### 📝 Description + +
+
+ +
+
+ +You can archive a single contact. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.contacts.archive({ + contact_id: "63a07ddf05a32042dffac965", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Intercom.ArchiveContactRequest` + +
+
+ +
+
+ +**requestOptions:** `Contacts.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.contacts.unarchive({ ...params }) -> Intercom.ContactUnarchived +
+
+ +#### 📝 Description + +
+
+ +
+
+ +You can unarchive a single contact. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.contacts.unarchive({ + contact_id: "63a07ddf05a32042dffac965", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Intercom.UnarchiveContactRequest` + +
+
+ +
+
+ +**requestOptions:** `Contacts.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.contacts.blockContact({ ...params }) -> Intercom.ContactBlocked +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Block a single contact.
**Note:** conversations of the contact will also be archived during the process.
More details in [FAQ How do I block Inbox spam?](https://www.intercom.com/help/en/articles/8838656-inbox-faqs) + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.contacts.blockContact({ + contact_id: "63a07ddf05a32042dffac965", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Intercom.BlockContactRequest` + +
+
+ +
+
+ +**requestOptions:** `Contacts.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Notes + +
client.notes.list({ ...params }) -> core.Page +
+
+ +#### 📝 Description + +
+
+ +
+
+ +You can fetch a list of notes that are associated to a contact. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +const response = await client.notes.list({ + contact_id: "contact_id", +}); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +const page = await client.notes.list({ + contact_id: "contact_id", +}); +while (page.hasNextPage()) { + page = page.getNextPage(); +} +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Intercom.ListContactNotesRequest` + +
+
+ +
+
+ +**requestOptions:** `Notes.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.notes.create({ ...params }) -> Intercom.Note +
+
+ +#### 📝 Description + +
+
+ +
+
+ +You can add a note to a single contact. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.notes.create({ + contact_id: "123", + body: "Hello", + admin_id: "123", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Intercom.CreateContactNoteRequest` + +
+
+ +
+
+ +**requestOptions:** `Notes.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.notes.find({ ...params }) -> Intercom.Note +
+
+ +#### 📝 Description + +
+
+ +
+
+ +You can fetch the details of a single note. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.notes.find({ + note_id: 1, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Intercom.FindNoteRequest` + +
+
+ +
+
+ +**requestOptions:** `Notes.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Tags + +
client.tags.tagContact({ ...params }) -> Intercom.Tag +
+
+ +#### 📝 Description + +
+
+ +
+
+ +You can tag a specific contact. This will return a tag object for the tag that was added to the contact. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.tags.tagContact({ + contact_id: "63a07ddf05a32042dffac965", + id: "7522907", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Intercom.TagContactRequest` + +
+
+ +
+
+ +**requestOptions:** `Tags.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.tags.untagContact({ ...params }) -> Intercom.Tag +
+
+ +#### 📝 Description + +
+
+ +
+
+ +You can remove tag from a specific contact. This will return a tag object for the tag that was removed from the contact. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.tags.untagContact({ + contact_id: "63a07ddf05a32042dffac965", + tag_id: "7522907", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Intercom.UntagContactRequest` + +
+
+ +
+
+ +**requestOptions:** `Tags.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.tags.tagConversation({ ...params }) -> Intercom.Tag +
+
+ +#### 📝 Description + +
+
+ +
+
+ +You can tag a specific conversation. This will return a tag object for the tag that was added to the conversation. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.tags.tagConversation({ + conversation_id: "64619700005694", + id: "7522907", + admin_id: "780", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Intercom.TagConversationRequest` + +
+
+ +
+
+ +**requestOptions:** `Tags.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.tags.untagConversation({ ...params }) -> Intercom.Tag +
+
+ +#### 📝 Description + +
+
+ +
+
+ +You can remove tag from a specific conversation. This will return a tag object for the tag that was removed from the conversation. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.tags.untagConversation({ + conversation_id: "64619700005694", + tag_id: "7522907", + admin_id: "123", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Intercom.UntagConversationRequest` + +
+
+ +
+
+ +**requestOptions:** `Tags.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.tags.list() -> Intercom.TagList +
+
+ +#### 📝 Description + +
+
+ +
+
+ +You can fetch a list of all tags for a given workspace. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.tags.list(); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**requestOptions:** `Tags.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.tags.create({ ...params }) -> Intercom.Tag +
+
+ +#### 📝 Description + +
+
+ +
+
+ +You can use this endpoint to perform the following operations: + +**1. Create a new tag:** You can create a new tag by passing in the tag name as specified in "Create or Update Tag Request Payload" described below. + +**2. Update an existing tag:** You can update an existing tag by passing the id of the tag as specified in "Create or Update Tag Request Payload" described below. + +**3. Tag Companies:** You can tag single company or a list of companies. You can tag a company by passing in the tag name and the company details as specified in "Tag Company Request Payload" described below. Also, if the tag doesn't exist then a new one will be created automatically. + +**4. Untag Companies:** You can untag a single company or a list of companies. You can untag a company by passing in the tag id and the company details as specified in "Untag Company Request Payload" described below. + +**5. Tag Multiple Users:** You can tag a list of users. You can tag the users by passing in the tag name and the user details as specified in "Tag Users Request Payload" described below. + +Each operation will return a tag object. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.tags.create({ + name: "test", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Intercom.TagsCreateRequestBody` + +
+
+ +
+
+ +**requestOptions:** `Tags.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.tags.find({ ...params }) -> Intercom.Tag +
+
+ +#### 📝 Description + +
+
+ +
+
+ +You can fetch the details of tags that are on the workspace by their id. +This will return a tag object. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.tags.find({ + tag_id: "123", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Intercom.FindTagRequest` + +
+
+ +
+
+ +**requestOptions:** `Tags.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.tags.delete({ ...params }) -> void +
+
+ +#### 📝 Description + +
+
+ +
+
+ +You can delete the details of tags that are on the workspace by passing in the id. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.tags.delete({ + tag_id: "123", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Intercom.DeleteTagRequest` + +
+
+ +
+
+ +**requestOptions:** `Tags.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.tags.tagTicket({ ...params }) -> Intercom.Tag +
+
+ +#### 📝 Description + +
+
+ +
+
+ +You can tag a specific ticket. This will return a tag object for the tag that was added to the ticket. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.tags.tagTicket({ + ticket_id: "64619700005694", + id: "7522907", + admin_id: "780", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Intercom.TagTicketRequest` + +
+
+ +
+
+ +**requestOptions:** `Tags.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.tags.untagTicket({ ...params }) -> Intercom.Tag +
+
+ +#### 📝 Description + +
+
+ +
+
+ +You can remove tag from a specific ticket. This will return a tag object for the tag that was removed from the ticket. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.tags.untagTicket({ + ticket_id: "64619700005694", + tag_id: "7522907", + admin_id: "123", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Intercom.UntagTicketRequest` + +
+
+ +
+
+ +**requestOptions:** `Tags.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Conversations + +
client.conversations.list({ ...params }) -> core.Page +
+
+ +#### 📝 Description + +
+
+ +
+
+ +You can fetch a list of all conversations. + +You can optionally request the result page size and the cursor to start after to fetch the result. +{% admonition type="warning" name="Pagination" %} +You can use pagination to limit the number of results returned. The default is `20` results per page. +See the [pagination section](https://developers.intercom.com/docs/build-an-integration/learn-more/rest-apis/pagination/#pagination-for-list-apis) for more details on how to use the `starting_after` param. +{% /admonition %} + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +const response = await client.conversations.list(); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +const page = await client.conversations.list(); +while (page.hasNextPage()) { + page = page.getNextPage(); +} +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Intercom.ListConversationsRequest` + +
+
+ +
+
+ +**requestOptions:** `Conversations.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.conversations.create({ ...params }) -> Intercom.Message +
+
+ +#### 📝 Description + +
+
+ +
+
+ +You can create a conversation that has been initiated by a contact (ie. user or lead). +The conversation can be an in-app message only. + +{% admonition type="info" name="Sending for visitors" %} +You can also send a message from a visitor by specifying their `user_id` or `id` value in the `from` field, along with a `type` field value of `contact`. +This visitor will be automatically converted to a contact with a lead role once the conversation is created. +{% /admonition %} + +This will return the Message model that has been created. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.conversations.create({ + from: { + type: "user", + id: "6762f11b1bb69f9f2193bba3", + }, + body: "Hello there", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Intercom.CreateConversationRequest` + +
+
+ +
+
+ +**requestOptions:** `Conversations.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.conversations.find({ ...params }) -> Intercom.Conversation +
+
+ +#### 📝 Description + +
+
+ +
+
+ +You can fetch the details of a single conversation. + +This will return a single Conversation model with all its conversation parts. + +{% admonition type="warning" name="Hard limit of 500 parts" %} +The maximum number of conversation parts that can be returned via the API is 500. If you have more than that we will return the 500 most recent conversation parts. +{% /admonition %} + +For AI agent conversation metadata, please note that you need to have the agent enabled in your workspace, which is a [paid feature](https://www.intercom.com/help/en/articles/8205718-fin-resolutions#h_97f8c2e671). + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.conversations.find({ + conversation_id: 1, + display_as: "plaintext", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Intercom.FindConversationRequest` + +
+
+ +
+
+ +**requestOptions:** `Conversations.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.conversations.update({ ...params }) -> Intercom.Conversation +
+
+ +#### 📝 Description + +
+
+ +
+
+ +You can update an existing conversation. + +{% admonition type="info" name="Replying and other actions" %} +If you want to reply to a coveration or take an action such as assign, unassign, open, close or snooze, take a look at the reply and manage endpoints. +{% /admonition %} + +{% admonition type="info" %} +This endpoint handles both **conversation updates** and **custom object associations**. + +See _`update a conversation with an association to a custom object instance`_ in the request/response examples to see the custom object association format. +{% /admonition %} + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.conversations.update({ + conversation_id: 1, + display_as: "plaintext", + read: true, + title: "new conversation title", + custom_attributes: { + issue_type: "Billing", + priority: "High", + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Intercom.UpdateConversationRequest` + +
+
+ +
+
+ +**requestOptions:** `Conversations.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.conversations.deleteConversation({ ...params }) -> Intercom.ConversationDeleted +
+
+ +#### 📝 Description + +
+
+ +
+
+ +You can delete a single conversation. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.conversations.deleteConversation({ + conversation_id: 1, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Intercom.DeleteConversationRequest` + +
+
+ +
+
+ +**requestOptions:** `Conversations.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.conversations.search({ ...params }) -> core.Page +
+
+ +#### 📝 Description + +
+
+ +
+
+ +You can search for multiple conversations by the value of their attributes in order to fetch exactly which ones you want. + +To search for conversations, you need to send a `POST` request to `https://api.intercom.io/conversations/search`. + +This will accept a query object in the body which will define your filters in order to search for conversations. +{% admonition type="warning" name="Optimizing search queries" %} +Search queries can be complex, so optimizing them can help the performance of your search. +Use the `AND` and `OR` operators to combine multiple filters to get the exact results you need and utilize +pagination to limit the number of results returned. The default is `20` results per page and maximum is `150`. +See the [pagination section](https://developers.intercom.com/docs/build-an-integration/learn-more/rest-apis/pagination/#example-search-conversations-request) for more details on how to use the `starting_after` param. +{% /admonition %} + +### Nesting & Limitations + +You can nest these filters in order to get even more granular insights that pinpoint exactly what you need. Example: (1 OR 2) AND (3 OR 4). +There are some limitations to the amount of multiple's there can be: + +- There's a limit of max 2 nested filters +- There's a limit of max 15 filters for each AND or OR group + +### Accepted Fields + +Most keys listed in the conversation model are searchable, whether writeable or not. The value you search for has to match the accepted type, otherwise the query will fail (ie. as `created_at` accepts a date, the `value` cannot be a string such as `"foorbar"`). +The `source.body` field is unique as the search will not be performed against the entire value, but instead against every element of the value separately. For example, when searching for a conversation with a `"I need support"` body - the query should contain a `=` operator with the value `"support"` for such conversation to be returned. A query with a `=` operator and a `"need support"` value will not yield a result. + +| Field | Type | +| :---------------------------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------- | +| id | String | +| created_at | Date (UNIX timestamp) | +| updated_at | Date (UNIX timestamp) | +| source.type | String
Accepted fields are `conversation`, `email`, `facebook`, `instagram`, `phone_call`, `phone_switch`, `push`, `sms`, `twitter` and `whatsapp`. | +| source.id | String | +| source.delivered_as | String | +| source.subject | String | +| source.body | String | +| source.author.id | String | +| source.author.type | String | +| source.author.name | String | +| source.author.email | String | +| source.url | String | +| contact_ids | String | +| teammate_ids | String | +| admin_assignee_id | String | +| team_assignee_id | String | +| channel_initiated | String | +| open | Boolean | +| read | Boolean | +| state | String | +| waiting_since | Date (UNIX timestamp) | +| snoozed_until | Date (UNIX timestamp) | +| tag_ids | String | +| priority | String | +| statistics.time_to_assignment | Integer | +| statistics.time_to_admin_reply | Integer | +| statistics.time_to_first_close | Integer | +| statistics.time_to_last_close | Integer | +| statistics.median_time_to_reply | Integer | +| statistics.first_contact_reply_at | Date (UNIX timestamp) | +| statistics.first_assignment_at | Date (UNIX timestamp) | +| statistics.first_admin_reply_at | Date (UNIX timestamp) | +| statistics.first_close_at | Date (UNIX timestamp) | +| statistics.last_assignment_at | Date (UNIX timestamp) | +| statistics.last_assignment_admin_reply_at | Date (UNIX timestamp) | +| statistics.last_contact_reply_at | Date (UNIX timestamp) | +| statistics.last_admin_reply_at | Date (UNIX timestamp) | +| statistics.last_close_at | Date (UNIX timestamp) | +| statistics.last_closed_by_id | String | +| statistics.count_reopens | Integer | +| statistics.count_assignments | Integer | +| statistics.count_conversation_parts | Integer | +| conversation_rating.requested_at | Date (UNIX timestamp) | +| conversation_rating.replied_at | Date (UNIX timestamp) | +| conversation_rating.score | Integer | +| conversation_rating.remark | String | +| conversation_rating.contact_id | String | +| conversation_rating.admin_d | String | +| ai_agent_participated | Boolean | +| ai_agent.resolution_state | String | +| ai_agent.last_answer_type | String | +| ai_agent.rating | Integer | +| ai_agent.rating_remark | String | +| ai_agent.source_type | String | +| ai_agent.source_title | String | + +### Accepted Operators + +The table below shows the operators you can use to define how you want to search for the value. The operator should be put in as a string (`"="`). The operator has to be compatible with the field's type (eg. you cannot search with `>` for a given string value as it's only compatible for integer's and dates). + +| Operator | Valid Types | Description | +| :------- | :---------------------------- | :--------------------------------------------------------- | +| = | All | Equals | +| != | All | Doesn't Equal | +| IN | All | In Shortcut for `OR` queries Values most be in Array | +| NIN | All | Not In Shortcut for `OR !` queries Values must be in Array | +| > | Integer Date (UNIX Timestamp) | Greater (or equal) than | +| < | Integer Date (UNIX Timestamp) | Lower (or equal) than | +| ~ | String | Contains | +| !~ | String | Doesn't Contain | +| ^ | String | Starts With | +| $ | String | Ends With | + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +const response = await client.conversations.search({ + query: { + operator: "AND", + value: [ + { + field: "created_at", + operator: ">", + value: "1306054154", + }, + ], + }, + pagination: { + per_page: 5, + }, +}); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +const page = await client.conversations.search({ + query: { + operator: "AND", + value: [ + { + field: "created_at", + operator: ">", + value: "1306054154", + }, + ], + }, + pagination: { + per_page: 5, + }, +}); +while (page.hasNextPage()) { + page = page.getNextPage(); +} +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Intercom.SearchRequest` + +
+
+ +
+
+ +**requestOptions:** `Conversations.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.conversations.reply({ ...params }) -> Intercom.Conversation +
+
+ +#### 📝 Description + +
+
+ +
+
+ +You can reply to a conversation with a message from an admin or on behalf of a contact, or with a note for admins. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.conversations.reply({ + conversation_id: '123 or "last"', + body: { + message_type: "comment", + type: "user", + body: "Thanks again :)", + intercom_user_id: "6762f1571bb69f9f2193bbbb", + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Intercom.ReplyToConversationRequest` + +
+
+ +
+
+ +**requestOptions:** `Conversations.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.conversations.manage({ ...params }) -> Intercom.Conversation +
+
+ +#### 📝 Description + +
+
+ +
+
+ +For managing conversations you can: + +- Close a conversation +- Snooze a conversation to reopen on a future date +- Open a conversation which is `snoozed` or `closed` +- Assign a conversation to an admin and/or team. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.conversations.manage({ + conversation_id: "123", + body: { + message_type: "close", + type: "admin", + admin_id: "12345", + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Intercom.ManageConversationPartsRequest` + +
+
+ +
+
+ +**requestOptions:** `Conversations.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.conversations.attachContactAsAdmin({ ...params }) -> Intercom.Conversation +
+
+ +#### 📝 Description + +
+
+ +
+
+ +You can add participants who are contacts to a conversation, on behalf of either another contact or an admin. + +{% admonition type="warning" name="Contacts without an email" %} +If you add a contact via the email parameter and there is no user/lead found on that workspace with he given email, then we will create a new contact with `role` set to `lead`. +{% /admonition %} + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.conversations.attachContactAsAdmin({ + conversation_id: "123", + admin_id: "12345", + customer: { + intercom_user_id: "6762f19b1bb69f9f2193bbd4", + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Intercom.AttachContactToConversationRequest` + +
+
+ +
+
+ +**requestOptions:** `Conversations.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.conversations.detachContactAsAdmin({ ...params }) -> Intercom.Conversation +
+
+ +#### 📝 Description + +
+
+ +
+
+ +You can add participants who are contacts to a conversation, on behalf of either another contact or an admin. + +{% admonition type="warning" name="Contacts without an email" %} +If you add a contact via the email parameter and there is no user/lead found on that workspace with he given email, then we will create a new contact with `role` set to `lead`. +{% /admonition %} + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.conversations.detachContactAsAdmin({ + conversation_id: "123", + contact_id: "123", + admin_id: "5017690", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Intercom.DetachContactFromConversationRequest` + +
+
+ +
+
+ +**requestOptions:** `Conversations.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.conversations.redactConversationPart({ ...params }) -> Intercom.Conversation +
+
+ +#### 📝 Description + +
+
+ +
+
+ +You can redact a conversation part or the source message of a conversation (as seen in the source object). + +{% admonition type="info" name="Redacting parts and messages" %} +If you are redacting a conversation part, it must have a `body`. If you are redacting a source message, it must have been created by a contact. We will return a `conversation_part_not_redactable` error if these criteria are not met. +{% /admonition %} + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.conversations.redactConversationPart({ + type: "conversation_part", + conversation_id: "19894788788", + conversation_part_id: "19381789428", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Intercom.RedactConversationRequest` + +
+
+ +
+
+ +**requestOptions:** `Conversations.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.conversations.convertToTicket({ ...params }) -> Intercom.Ticket | undefined +
+
+ +#### 📝 Description + +
+
+ +
+
+ +You can convert a conversation to a ticket. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.conversations.convertToTicket({ + conversation_id: 1, + ticket_type_id: "53", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Intercom.ConvertConversationToTicketRequest` + +
+
+ +
+
+ +**requestOptions:** `Conversations.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.conversations.runAssignmentRules({ ...params }) -> void +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.conversations.runAssignmentRules({ + conversation_id: "conversation_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Intercom.AutoAssignConversationRequest` + +
+
+ +
+
+ +**requestOptions:** `Conversations.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Custom Channel Events + +
client.customChannelEvents.notifyNewConversation({ ...params }) -> Intercom.CustomChannelNotificationResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Notifies Intercom that a new conversation was created in your custom channel/platform. This triggers conversation creation and workflow automations within Intercom for your custom channel integration. + +> **Note:** This endpoint is currently under managed availability. Please reach out to your accounts team to discuss access and tailored, hands-on support. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.customChannelEvents.notifyNewConversation({ + event_id: "event_id", + external_conversation_id: "external_conversation_id", + contact: { + type: "user", + external_id: "external_id", + name: undefined, + email: undefined, + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Intercom.CustomChannelBaseEvent` + +
+
+ +
+
+ +**requestOptions:** `CustomChannelEvents.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.customChannelEvents.notifyNewMessage({ ...params }) -> Intercom.CustomChannelNotificationResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Notifies Intercom that a new message was sent in a conversation on your custom channel/platform. This allows Intercom to process the message and trigger any relevant workflow automations. + +> **Note:** This endpoint is currently under managed availability. Please reach out to your accounts team to discuss access and tailored, hands-on support. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.customChannelEvents.notifyNewMessage({ + body: "body", + event_id: "event_id", + external_conversation_id: "external_conversation_id", + contact: { + type: "user", + external_id: "external_id", + name: undefined, + email: undefined, + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Intercom.NotifyNewMessageRequest` + +
+
+ +
+
+ +**requestOptions:** `CustomChannelEvents.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.customChannelEvents.notifyQuickReplySelected({ ...params }) -> Intercom.CustomChannelNotificationResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Notifies Intercom that a user selected a quick reply option in your custom channel/platform. This allows Intercom to process the response and trigger any relevant workflow automations. + +> **Note:** This endpoint is currently under managed availability. Please reach out to your accounts team to discuss access and tailored, hands-on support. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.customChannelEvents.notifyQuickReplySelected({ + event_id: "evt_67890", + external_conversation_id: "conv_13579", + contact: { + type: "user", + external_id: "user_003", + name: "Alice Example", + email: "alice@example.com", + }, + quick_reply_option_id: "1234", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Intercom.NotifyQuickReplySelectedRequest` + +
+
+ +
+
+ +**requestOptions:** `CustomChannelEvents.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.customChannelEvents.notifyAttributeCollected({ ...params }) -> Intercom.CustomChannelNotificationResponse +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Notifies Intercom that a user provided a response to an attribute collector in your custom channel/platform. This allows Intercom to process the attribute and trigger any relevant workflow automations. + +> **Note:** This endpoint is currently under managed availability. Please reach out to your accounts team to discuss access and tailored, hands-on support. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.customChannelEvents.notifyAttributeCollected({ + attribute: { + id: "id", + value: "value", + }, + event_id: "event_id", + external_conversation_id: "external_conversation_id", + contact: { + type: "user", + external_id: "external_id", + name: undefined, + email: undefined, + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Intercom.NotifyAttributeCollectedRequest` + +
+
+ +
+
+ +**requestOptions:** `CustomChannelEvents.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Custom Object Instances + +
client.customObjectInstances.getCustomObjectInstancesByExternalId({ ...params }) -> Intercom.CustomObjectInstance | undefined +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Fetch a Custom Object Instance by external_id. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.customObjectInstances.getCustomObjectInstancesByExternalId({ + custom_object_type_identifier: "Order", + external_id: "external_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Intercom.GetCustomObjectInstancesByExternalIdRequest` + +
+
+ +
+
+ +**requestOptions:** `CustomObjectInstances.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.customObjectInstances.createCustomObjectInstances({ ...params }) -> Intercom.CustomObjectInstance | undefined +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Create or update a custom object instance + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.customObjectInstances.createCustomObjectInstances({ + custom_object_type_identifier: "Order", + external_id: "123", + external_created_at: 1392036272, + external_updated_at: 1392036272, + custom_attributes: { + order_number: "ORDER-12345", + total_amount: "custom_attributes", + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Intercom.CreateOrUpdateCustomObjectInstanceRequest` + +
+
+ +
+
+ +**requestOptions:** `CustomObjectInstances.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.customObjectInstances.deleteCustomObjectInstancesById({ ...params }) -> Intercom.CustomObjectInstanceDeleted +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Delete a single Custom Object instance by external_id. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.customObjectInstances.deleteCustomObjectInstancesById({ + custom_object_type_identifier: "Order", + external_id: "external_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Intercom.DeleteCustomObjectInstancesByIdRequest` + +
+
+ +
+
+ +**requestOptions:** `CustomObjectInstances.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.customObjectInstances.getCustomObjectInstancesById({ ...params }) -> Intercom.CustomObjectInstance | undefined +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Fetch a Custom Object Instance by id. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.customObjectInstances.getCustomObjectInstancesById({ + custom_object_type_identifier: "Order", + custom_object_instance_id: "custom_object_instance_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Intercom.GetCustomObjectInstancesByIdRequest` + +
+
+ +
+
+ +**requestOptions:** `CustomObjectInstances.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.customObjectInstances.deleteCustomObjectInstancesByExternalId({ ...params }) -> Intercom.CustomObjectInstanceDeleted +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Delete a single Custom Object instance using the Intercom defined id. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.customObjectInstances.deleteCustomObjectInstancesByExternalId({ + custom_object_type_identifier: "Order", + custom_object_instance_id: "custom_object_instance_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Intercom.DeleteCustomObjectInstancesByExternalIdRequest` + +
+
+ +
+
+ +**requestOptions:** `CustomObjectInstances.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Data Attributes + +
client.dataAttributes.list({ ...params }) -> Intercom.DataAttributeList +
+
+ +#### 📝 Description + +
+
+ +
+
+ +You can fetch a list of all data attributes belonging to a workspace for contacts, companies or conversations. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.dataAttributes.list(); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Intercom.ListDataAttributesRequest` + +
+
+ +
+
+ +**requestOptions:** `DataAttributes.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.dataAttributes.create({ ...params }) -> Intercom.DataAttribute +
+
+ +#### 📝 Description + +
+
+ +
+
+ +You can create a data attributes for a `contact` or a `company`. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.dataAttributes.create({ + data_type: "string", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Intercom.CreateDataAttributeRequest` + +
+
+ +
+
+ +**requestOptions:** `DataAttributes.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.dataAttributes.update({ ...params }) -> Intercom.DataAttribute +
+
+ +#### 📝 Description + +
+
+ +
+
+ +You can update a data attribute. + +> 🚧 Updating the data type is not possible +> +> It is currently a dangerous action to execute changing a data attribute's type via the API. You will need to update the type via the UI instead. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.dataAttributes.update({ + data_attribute_id: 1, + body: { + options: [ + { + value: "1-10", + }, + { + value: "11-20", + }, + ], + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Intercom.UpdateDataAttributeRequest` + +
+
+ +
+
+ +**requestOptions:** `DataAttributes.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Events + +
client.events.list({ ...params }) -> Intercom.DataEventSummary +
+
+ +#### 📝 Description + +
+
+ +
+
+ +> 🚧 +> +> Please note that you can only 'list' events that are less than 90 days old. Event counts and summaries will still include your events older than 90 days but you cannot 'list' these events individually if they are older than 90 days + +The events belonging to a customer can be listed by sending a GET request to `https://api.intercom.io/events` with a user or lead identifier along with a `type` parameter. The identifier parameter can be one of `user_id`, `email` or `intercom_user_id`. The `type` parameter value must be `user`. + +- `https://api.intercom.io/events?type=user&user_id={user_id}` +- `https://api.intercom.io/events?type=user&email={email}` +- `https://api.intercom.io/events?type=user&intercom_user_id={id}` (this call can be used to list leads) + +The `email` parameter value should be [url encoded](http://en.wikipedia.org/wiki/Percent-encoding) when sending. + +You can optionally define the result page size as well with the `per_page` parameter. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.events.list({ + type: "type", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Intercom.ListEventsRequest` + +
+
+ +
+
+ +**requestOptions:** `Events.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.events.create({ ...params }) -> void +
+
+ +#### 📝 Description + +
+
+ +
+
+ +You will need an Access Token that has write permissions to send Events. Once you have a key you can submit events via POST to the Events resource, which is located at https://api.intercom.io/events, or you can send events using one of the client libraries. When working with the HTTP API directly a client should send the event with a `Content-Type` of `application/json`. + +When using the JavaScript API, [adding the code to your app](http://docs.intercom.io/configuring-Intercom/tracking-user-events-in-your-app) makes the Events API available. Once added, you can submit an event using the `trackEvent` method. This will associate the event with the Lead or currently logged-in user or logged-out visitor/lead and send it to Intercom. The final parameter is a map that can be used to send optional metadata about the event. + +With the Ruby client you pass a hash describing the event to `Intercom::Event.create`, or call the `track_user` method directly on the current user object (e.g. `user.track_event`). + +**NB: For the JSON object types, please note that we do not currently support nested JSON structure.** + +| Type | Description | Example | +| :-------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------------- | +| String | The value is a JSON String | `"source":"desktop"` | +| Number | The value is a JSON Number | `"load": 3.67` | +| Date | The key ends with the String `_date` and the value is a [Unix timestamp](http://en.wikipedia.org/wiki/Unix_time), assumed to be in the [UTC](http://en.wikipedia.org/wiki/Coordinated_Universal_Time) timezone. | `"contact_date": 1392036272` | +| Link | The value is a HTTP or HTTPS URI. | `"article": "https://example.org/ab1de.html"` | +| Rich Link | The value is a JSON object that contains `url` and `value` keys. | `"article": {"url": "https://example.org/ab1de.html", "value":"the dude abides"}` | +| Monetary Amount | The value is a JSON object that contains `amount` and `currency` keys. The `amount` key is a positive integer representing the amount in cents. The price in the example to the right denotes €349.99. | `"price": {"amount": 34999, "currency": "eur"}` | + +**Lead Events** + +When submitting events for Leads, you will need to specify the Lead's `id`. + +**Metadata behaviour** + +- We currently limit the number of tracked metadata keys to 10 per event. Once the quota is reached, we ignore any further keys we receive. The first 10 metadata keys are determined by the order in which they are sent in with the event. +- It is not possible to change the metadata keys once the event has been sent. A new event will need to be created with the new keys and you can archive the old one. +- There might be up to 24 hrs delay when you send a new metadata for an existing event. + +**Event de-duplication** + +The API may detect and ignore duplicate events. Each event is uniquely identified as a combination of the following data - the Workspace identifier, the Contact external identifier, the Data Event name and the Data Event created time. As a result, it is **strongly recommended** to send a second granularity Unix timestamp in the `created_at` field. + +Duplicated events are responded to using the normal `202 Accepted` code - an error is not thrown, however repeat requests will be counted against any rate limit that is in place. + +### HTTP API Responses + +- Successful responses to submitted events return `202 Accepted` with an empty body. +- Unauthorised access will be rejected with a `401 Unauthorized` or `403 Forbidden` response code. +- Events sent about users that cannot be found will return a `404 Not Found`. +- Event lists containing duplicate events will have those duplicates ignored. +- Server errors will return a `500` response code and may contain an error message in the body. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.events.create({ + id: "8a88a590-e1c3-41e2-a502-e0649dbf721c", + event_name: "invited-friend", + created_at: 1671028894, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Intercom.CreateDataEventRequest` + +
+
+ +
+
+ +**requestOptions:** `Events.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.events.summaries({ ...params }) -> void +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Create event summaries for a user. Event summaries are used to track the number of times an event has occurred, the first time it occurred and the last time it occurred. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.events.summaries(); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Intercom.ListEventSummariesRequest` + +
+
+ +
+
+ +**requestOptions:** `Events.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Jobs + +
client.jobs.status({ ...params }) -> Intercom.Jobs +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieve the status of job execution. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.jobs.status({ + job_id: "job_id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Intercom.JobsStatusRequest` + +
+
+ +
+
+ +**requestOptions:** `Jobs.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Messages + +
client.messages.create({ ...params }) -> Intercom.Message +
+
+ +#### 📝 Description + +
+
+ +
+
+ +You can create a message that has been initiated by an admin. The conversation can be either an in-app message or an email. + +> 🚧 Sending for visitors +> +> There can be a short delay between when a contact is created and when a contact becomes available to be messaged through the API. A 404 Not Found error will be returned in this case. + +This will return the Message model that has been created. + +> 🚧 Retrieving Associated Conversations +> +> As this is a message, there will be no conversation present until the contact responds. Once they do, you will have to search for a contact's conversations with the id of the message. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.messages.create({ + message_type: "email", + subject: "Thanks for everything", + body: "Hello there", + template: "plain", + from: { + type: "admin", + id: 394051, + }, + to: { + type: "user", + id: "536e564f316c83104c000020", + }, +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Intercom.CreateMessageRequest` + +
+
+ +
+
+ +**requestOptions:** `Messages.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Segments + +
client.segments.list({ ...params }) -> Intercom.SegmentList +
+
+ +#### 📝 Description + +
+
+ +
+
+ +You can fetch a list of all segments. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.segments.list(); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Intercom.ListSegmentsRequest` + +
+
+ +
+
+ +**requestOptions:** `Segments.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.segments.find({ ...params }) -> Intercom.Segment +
+
+ +#### 📝 Description + +
+
+ +
+
+ +You can fetch the details of a single segment.
@@ -4121,44 +7778,9 @@ The table below shows the operators you can use to define how you want to search
```typescript -const response = await client.conversations.search({ - query: { - operator: "AND", - value: [ - { - field: "created_at", - operator: ">", - value: "1306054154", - }, - ], - }, - pagination: { - per_page: 5, - }, -}); -for await (const item of response) { - console.log(item); -} - -// Or you can manually iterate page-by-page -const page = await client.conversations.search({ - query: { - operator: "AND", - value: [ - { - field: "created_at", - operator: ">", - value: "1306054154", - }, - ], - }, - pagination: { - per_page: 5, - }, +await client.segments.find({ + segment_id: "123", }); -while (page.hasNextPage()) { - page = page.getNextPage(); -} ```
@@ -4174,7 +7796,7 @@ while (page.hasNextPage()) {
-**request:** `Intercom.SearchRequest` +**request:** `Intercom.FindSegmentRequest`
@@ -4182,7 +7804,7 @@ while (page.hasNextPage()) {
-**requestOptions:** `Conversations.RequestOptions` +**requestOptions:** `Segments.RequestOptions`
@@ -4193,7 +7815,9 @@ while (page.hasNextPage()) {
-
client.conversations.reply({ ...params }) -> Intercom.Conversation +## Subscription Types + +
client.subscriptionTypes.list() -> Intercom.SubscriptionTypeList
@@ -4205,7 +7829,7 @@ while (page.hasNextPage()) {
-You can reply to a conversation with a message from an admin or on behalf of a contact, or with a note for admins. +You can list all subscription types. A list of subscription type objects will be returned.
@@ -4221,13 +7845,71 @@ You can reply to a conversation with a message from an admin or on behalf of a c
```typescript -await client.conversations.reply({ - conversation_id: '123 or "last"', - body: { - message_type: "comment", - type: "user", - body: "Thanks again :)", - intercom_user_id: "667d60f18a68186f43bafdf4", +await client.subscriptionTypes.list(); +``` + +
+
+ + + +#### ⚙️ Parameters + +
+
+ +
+
+ +**requestOptions:** `SubscriptionTypes.RequestOptions` + +
+
+
+
+ + + +
+ +## PhoneCallRedirects + +
client.phoneCallRedirects.create({ ...params }) -> Intercom.PhoneSwitch | undefined +
+
+ +#### 📝 Description + +
+
+ +
+
+ +You can use the API to deflect phone calls to the Intercom Messenger. +Calling this endpoint will send an SMS with a link to the Messenger to the phone number specified. + +If custom attributes are specified, they will be added to the user or lead's custom data attributes. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.phoneCallRedirects.create({ + phone: "+353832345678", + custom_attributes: { + issue_type: "Billing", + priority: "High", }, }); ``` @@ -4245,7 +7927,7 @@ await client.conversations.reply({
-**request:** `Intercom.ReplyToConversationRequest` +**request:** `Intercom.CreatePhoneSwitchRequest`
@@ -4253,7 +7935,7 @@ await client.conversations.reply({
-**requestOptions:** `Conversations.RequestOptions` +**requestOptions:** `PhoneCallRedirects.RequestOptions`
@@ -4264,7 +7946,9 @@ await client.conversations.reply({
-
client.conversations.manage({ ...params }) -> Intercom.Conversation +## Calls + +
client.calls.listCalls({ ...params }) -> Intercom.CallList
@@ -4276,16 +7960,12 @@ await client.conversations.reply({
-For managing conversations you can: +Retrieve a paginated list of calls. -- Close a conversation -- Snooze a conversation to reopen on a future date -- Open a conversation which is `snoozed` or `closed` -- Assign a conversation to an admin and/or team. -
-
-
-
+ + + + #### 🔌 Usage @@ -4296,14 +7976,7 @@ For managing conversations you can:
```typescript -await client.conversations.manage({ - conversation_id: "123", - body: { - message_type: "close", - type: "admin", - admin_id: "12345", - }, -}); +await client.calls.listCalls(); ```
@@ -4319,7 +7992,7 @@ await client.conversations.manage({
-**request:** `Intercom.ManageConversationPartsRequest` +**request:** `Intercom.ListCallsRequest`
@@ -4327,7 +8000,7 @@ await client.conversations.manage({
-**requestOptions:** `Conversations.RequestOptions` +**requestOptions:** `Calls.RequestOptions`
@@ -4338,7 +8011,7 @@ await client.conversations.manage({
-
client.conversations.runAssignmentRules({ ...params }) -> Intercom.Conversation +
client.calls.showCall({ ...params }) -> Intercom.Call
@@ -4350,13 +8023,7 @@ await client.conversations.manage({
-{% admonition type="danger" name="Deprecation of Run Assignment Rules" %} -Run assignment rules is now deprecated in version 2.12 and future versions and will be permanently removed on December 31, 2026. After this date, any requests made to this endpoint will fail. -{% /admonition %} -You can let a conversation be automatically assigned following assignment rules. -{% admonition type="warning" name="When using workflows" %} -It is not possible to use this endpoint with Workflows. -{% /admonition %} +Retrieve a single call by id.
@@ -4372,8 +8039,8 @@ It is not possible to use this endpoint with Workflows.
```typescript -await client.conversations.runAssignmentRules({ - conversation_id: "123", +await client.calls.showCall({ + call_id: "call_id", }); ``` @@ -4390,7 +8057,7 @@ await client.conversations.runAssignmentRules({
-**request:** `Intercom.AutoAssignConversationRequest` +**request:** `Intercom.ShowCallRequest`
@@ -4398,7 +8065,7 @@ await client.conversations.runAssignmentRules({
-**requestOptions:** `Conversations.RequestOptions` +**requestOptions:** `Calls.RequestOptions`
@@ -4409,7 +8076,7 @@ await client.conversations.runAssignmentRules({
-
client.conversations.attachContactAsAdmin({ ...params }) -> Intercom.Conversation +
client.calls.showCallRecording({ ...params }) -> void
@@ -4421,11 +8088,7 @@ await client.conversations.runAssignmentRules({
-You can add participants who are contacts to a conversation, on behalf of either another contact or an admin. - -{% admonition type="warning" name="Contacts without an email" %} -If you add a contact via the email parameter and there is no user/lead found on that workspace with he given email, then we will create a new contact with `role` set to `lead`. -{% /admonition %} +Redirects to a signed URL for the call's recording if it exists.
@@ -4441,12 +8104,8 @@ If you add a contact via the email parameter and there is no user/lead found on
```typescript -await client.conversations.attachContactAsAdmin({ - conversation_id: "123", - admin_id: "12345", - customer: { - intercom_user_id: "667d61168a68186f43bafe0d", - }, +await client.calls.showCallRecording({ + call_id: "call_id", }); ``` @@ -4463,7 +8122,7 @@ await client.conversations.attachContactAsAdmin({
-**request:** `Intercom.AttachContactToConversationRequest` +**request:** `Intercom.ShowCallRecordingRequest`
@@ -4471,7 +8130,7 @@ await client.conversations.attachContactAsAdmin({
-**requestOptions:** `Conversations.RequestOptions` +**requestOptions:** `Calls.RequestOptions`
@@ -4482,7 +8141,7 @@ await client.conversations.attachContactAsAdmin({
-
client.conversations.detachContactAsAdmin({ ...params }) -> Intercom.Conversation +
client.calls.showCallTranscript({ ...params }) -> string
@@ -4494,11 +8153,7 @@ await client.conversations.attachContactAsAdmin({
-You can add participants who are contacts to a conversation, on behalf of either another contact or an admin. - -{% admonition type="warning" name="Contacts without an email" %} -If you add a contact via the email parameter and there is no user/lead found on that workspace with he given email, then we will create a new contact with `role` set to `lead`. -{% /admonition %} +Returns the transcript for the specified call as a downloadable text file.
@@ -4514,10 +8169,8 @@ If you add a contact via the email parameter and there is no user/lead found on
```typescript -await client.conversations.detachContactAsAdmin({ - conversation_id: "123", - contact_id: "123", - admin_id: "5017690", +await client.calls.showCallTranscript({ + call_id: "call_id", }); ``` @@ -4534,7 +8187,7 @@ await client.conversations.detachContactAsAdmin({
-**request:** `Intercom.DetachContactFromConversationRequest` +**request:** `Intercom.ShowCallTranscriptRequest`
@@ -4542,7 +8195,7 @@ await client.conversations.detachContactAsAdmin({
-**requestOptions:** `Conversations.RequestOptions` +**requestOptions:** `Calls.RequestOptions`
@@ -4553,7 +8206,7 @@ await client.conversations.detachContactAsAdmin({
-
client.conversations.redactConversationPart({ ...params }) -> Intercom.Conversation +
client.calls.listCallsWithTranscripts({ ...params }) -> Intercom.ListCallsWithTranscriptsResponse
@@ -4565,11 +8218,8 @@ await client.conversations.detachContactAsAdmin({
-You can redact a conversation part or the source message of a conversation (as seen in the source object). - -{% admonition type="info" name="Redacting parts and messages" %} -If you are redacting a conversation part, it must have a `body`. If you are redacting a source message, it must have been created by a contact. We will return a `conversation_part_not_redactable` error if these criteria are not met. -{% /admonition %} +Retrieve calls by a list of conversation ids and include transcripts when available. +A maximum of 20 `conversation_ids` can be provided. If none are provided or more than 20 are provided, a 400 error is returned.
@@ -4585,10 +8235,8 @@ If you are redacting a conversation part, it must have a `body`. If you are reda
```typescript -await client.conversations.redactConversationPart({ - type: "conversation_part", - conversation_id: "19894788788", - conversation_part_id: "19381789428", +await client.calls.listCallsWithTranscripts({ + conversation_ids: ["64619700005694", "64619700005695"], }); ``` @@ -4605,15 +8253,72 @@ await client.conversations.redactConversationPart({
-**request:** `Intercom.RedactConversationRequest` +**request:** `Intercom.ListCallsWithTranscriptsRequest` + +
+
+ +
+
+ +**requestOptions:** `Calls.RequestOptions` + +
+
+
+
+ + + +
+ +## Teams + +
client.teams.list() -> Intercom.TeamList +
+
+ +#### 📝 Description +
+
+ +
+
+ +This will return a list of team objects for the App. + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.teams.list(); +``` + +
+
+#### ⚙️ Parameters + +
+
+
-**requestOptions:** `Conversations.RequestOptions` +**requestOptions:** `Teams.RequestOptions`
@@ -4624,7 +8329,7 @@ await client.conversations.redactConversationPart({
-
client.conversations.convertToTicket({ ...params }) -> Intercom.Ticket +
client.teams.find({ ...params }) -> Intercom.Team
@@ -4636,7 +8341,7 @@ await client.conversations.redactConversationPart({
-You can convert a conversation to a ticket. +You can fetch the details of a single team, containing an array of admins that belong to this team.
@@ -4652,9 +8357,8 @@ You can convert a conversation to a ticket.
```typescript -await client.conversations.convertToTicket({ - conversation_id: "123", - ticket_type_id: "79", +await client.teams.find({ + team_id: "123", }); ``` @@ -4671,7 +8375,7 @@ await client.conversations.convertToTicket({
-**request:** `Intercom.ConvertConversationToTicketRequest` +**request:** `Intercom.FindTeamRequest`
@@ -4679,7 +8383,7 @@ await client.conversations.convertToTicket({
-**requestOptions:** `Conversations.RequestOptions` +**requestOptions:** `Teams.RequestOptions`
@@ -4690,9 +8394,9 @@ await client.conversations.convertToTicket({
-## Data Attributes +## Ticket States -
client.dataAttributes.list({ ...params }) -> Intercom.DataAttributeList +
client.ticketStates.listTicketStates() -> Intercom.TicketStateList
@@ -4704,7 +8408,7 @@ await client.conversations.convertToTicket({
-You can fetch a list of all data attributes belonging to a workspace for contacts, companies or conversations. +You can get a list of all ticket states for a workspace.
@@ -4720,7 +8424,7 @@ You can fetch a list of all data attributes belonging to a workspace for contact
```typescript -await client.dataAttributes.list(); +await client.ticketStates.listTicketStates(); ```
@@ -4736,15 +8440,7 @@ await client.dataAttributes.list();
-**request:** `Intercom.ListDataAttributesRequest` - -
-
- -
-
- -**requestOptions:** `DataAttributes.RequestOptions` +**requestOptions:** `TicketStates.RequestOptions`
@@ -4755,7 +8451,9 @@ await client.dataAttributes.list();
-
client.dataAttributes.create({ ...params }) -> Intercom.DataAttribute +## Ticket Types + +
client.ticketTypes.list() -> Intercom.TicketTypeList
@@ -4767,7 +8465,7 @@ await client.dataAttributes.list();
-You can create a data attributes for a `contact` or a `company`. +You can get a list of all ticket types for a workspace.
@@ -4783,11 +8481,7 @@ You can create a data attributes for a `contact` or a `company`.
```typescript -await client.dataAttributes.create({ - name: "Mithril Shirt", - model: "company", - data_type: "string", -}); +await client.ticketTypes.list(); ```
@@ -4803,15 +8497,7 @@ await client.dataAttributes.create({
-**request:** `Intercom.CreateDataAttributeRequest` - -
-
- -
-
- -**requestOptions:** `DataAttributes.RequestOptions` +**requestOptions:** `TicketTypes.RequestOptions`
@@ -4822,7 +8508,7 @@ await client.dataAttributes.create({
-
client.dataAttributes.update({ ...params }) -> Intercom.DataAttribute +
client.ticketTypes.create({ ...params }) -> Intercom.TicketType | undefined
@@ -4834,11 +8520,12 @@ await client.dataAttributes.create({
-You can update a data attribute. +You can create a new ticket type. -> 🚧 Updating the data type is not possible +> 📘 Creating ticket types. > -> It is currently a dangerous action to execute changing a data attribute's type via the API. You will need to update the type via the UI instead. +> Every ticket type will be created with two default attributes: _default_title_ and _default_description_. +> For the `icon` propery, use an emoji from [Twemoji Cheatsheet](https://twemoji-cheatsheet.vercel.app/)
@@ -4854,18 +8541,11 @@ You can update a data attribute.
```typescript -await client.dataAttributes.update({ - data_attribute_id: "1", - archived: false, - description: "Just a plain old ring", - options: [ - { - value: "1-10", - }, - { - value: "11-20", - }, - ], +await client.ticketTypes.create({ + name: "Customer Issue", + description: "Customer Report Template", + category: "Customer", + icon: "\uD83C\uDF9F\uFE0F", }); ``` @@ -4882,7 +8562,7 @@ await client.dataAttributes.update({
-**request:** `Intercom.UpdateDataAttributeRequest` +**request:** `Intercom.CreateTicketTypeRequest`
@@ -4890,7 +8570,7 @@ await client.dataAttributes.update({
-**requestOptions:** `DataAttributes.RequestOptions` +**requestOptions:** `TicketTypes.RequestOptions`
@@ -4901,9 +8581,7 @@ await client.dataAttributes.update({
-## Events - -
client.events.list({ ...params }) -> Intercom.DataEventSummary +
client.ticketTypes.get({ ...params }) -> Intercom.TicketType | undefined
@@ -4915,19 +8593,7 @@ await client.dataAttributes.update({
-> 🚧 -> -> Please note that you can only 'list' events that are less than 90 days old. Event counts and summaries will still include your events older than 90 days but you cannot 'list' these events individually if they are older than 90 days - -The events belonging to a customer can be listed by sending a GET request to `https://api.intercom.io/events` with a user or lead identifier along with a `type` parameter. The identifier parameter can be one of `user_id`, `email` or `intercom_user_id`. The `type` parameter value must be `user`. - -- `https://api.intercom.io/events?type=user&user_id={user_id}` -- `https://api.intercom.io/events?type=user&email={email}` -- `https://api.intercom.io/events?type=user&intercom_user_id={id}` (this call can be used to list leads) - -The `email` parameter value should be [url encoded](http://en.wikipedia.org/wiki/Percent-encoding) when sending. - -You can optionally define the result page size as well with the `per_page` parameter. +You can fetch the details of a single ticket type.
@@ -4943,8 +8609,8 @@ You can optionally define the result page size as well with the `per_page` param
```typescript -await client.events.list({ - type: "type", +await client.ticketTypes.get({ + ticket_type_id: "ticket_type_id", }); ``` @@ -4961,7 +8627,7 @@ await client.events.list({
-**request:** `Intercom.ListEventsRequest` +**request:** `Intercom.FindTicketTypeRequest`
@@ -4969,7 +8635,7 @@ await client.events.list({
-**requestOptions:** `Events.RequestOptions` +**requestOptions:** `TicketTypes.RequestOptions`
@@ -4980,7 +8646,7 @@ await client.events.list({
-
client.events.create({ ...params }) -> void +
client.ticketTypes.update({ ...params }) -> Intercom.TicketType | undefined
@@ -4992,50 +8658,16 @@ await client.events.list({
-You will need an Access Token that has write permissions to send Events. Once you have a key you can submit events via POST to the Events resource, which is located at https://api.intercom.io/events, or you can send events using one of the client libraries. When working with the HTTP API directly a client should send the event with a `Content-Type` of `application/json`. - -When using the JavaScript API, [adding the code to your app](http://docs.intercom.io/configuring-Intercom/tracking-user-events-in-your-app) makes the Events API available. Once added, you can submit an event using the `trackEvent` method. This will associate the event with the Lead or currently logged-in user or logged-out visitor/lead and send it to Intercom. The final parameter is a map that can be used to send optional metadata about the event. - -With the Ruby client you pass a hash describing the event to `Intercom::Event.create`, or call the `track_user` method directly on the current user object (e.g. `user.track_event`). - -**NB: For the JSON object types, please note that we do not currently support nested JSON structure.** - -| Type | Description | Example | -| :-------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------------- | -| String | The value is a JSON String | `"source":"desktop"` | -| Number | The value is a JSON Number | `"load": 3.67` | -| Date | The key ends with the String `_date` and the value is a [Unix timestamp](http://en.wikipedia.org/wiki/Unix_time), assumed to be in the [UTC](http://en.wikipedia.org/wiki/Coordinated_Universal_Time) timezone. | `"contact_date": 1392036272` | -| Link | The value is a HTTP or HTTPS URI. | `"article": "https://example.org/ab1de.html"` | -| Rich Link | The value is a JSON object that contains `url` and `value` keys. | `"article": {"url": "https://example.org/ab1de.html", "value":"the dude abides"}` | -| Monetary Amount | The value is a JSON object that contains `amount` and `currency` keys. The `amount` key is a positive integer representing the amount in cents. The price in the example to the right denotes €349.99. | `"price": {"amount": 34999, "currency": "eur"}` | - -**Lead Events** - -When submitting events for Leads, you will need to specify the Lead's `id`. - -**Metadata behaviour** - -- We currently limit the number of tracked metadata keys to 10 per event. Once the quota is reached, we ignore any further keys we receive. The first 10 metadata keys are determined by the order in which they are sent in with the event. -- It is not possible to change the metadata keys once the event has been sent. A new event will need to be created with the new keys and you can archive the old one. -- There might be up to 24 hrs delay when you send a new metadata for an existing event. - -**Event de-duplication** - -The API may detect and ignore duplicate events. Each event is uniquely identified as a combination of the following data - the Workspace identifier, the Contact external identifier, the Data Event name and the Data Event created time. As a result, it is **strongly recommended** to send a second granularity Unix timestamp in the `created_at` field. - -Duplicated events are responded to using the normal `202 Accepted` code - an error is not thrown, however repeat requests will be counted against any rate limit that is in place. +You can update a ticket type. -### HTTP API Responses +> 📘 Updating a ticket type. +> +> For the `icon` propery, use an emoji from [Twemoji Cheatsheet](https://twemoji-cheatsheet.vercel.app/) -- Successful responses to submitted events return `202 Accepted` with an empty body. -- Unauthorised access will be rejected with a `401 Unauthorized` or `403 Forbidden` response code. -- Events sent about users that cannot be found will return a `404 Not Found`. -- Event lists containing duplicate events will have those duplicates ignored. -- Server errors will return a `500` response code and may contain an error message in the body. -
-
-
-
+ + + + #### 🔌 Usage @@ -5046,10 +8678,9 @@ Duplicated events are responded to using the normal `202 Accepted` code - an err
```typescript -await client.events.create({ - id: "8a88a590-e1c3-41e2-a502-e0649dbf721c", - event_name: "invited-friend", - created_at: 1671028894, +await client.ticketTypes.update({ + ticket_type_id: "ticket_type_id", + name: "Bug Report 2", }); ``` @@ -5066,7 +8697,7 @@ await client.events.create({
-**request:** `Intercom.CreateDataEventRequest` +**request:** `Intercom.UpdateTicketTypeRequest`
@@ -5074,7 +8705,7 @@ await client.events.create({
-**requestOptions:** `Events.RequestOptions` +**requestOptions:** `TicketTypes.RequestOptions`
@@ -5085,7 +8716,9 @@ await client.events.create({
-
client.events.summaries({ ...params }) -> void +## Tickets + +
client.tickets.reply({ ...params }) -> Intercom.TicketReply
@@ -5097,7 +8730,7 @@ await client.events.create({
-Create event summaries for a user. Event summaries are used to track the number of times an event has occurred, the first time it occurred and the last time it occurred. +You can reply to a ticket with a message from an admin or on behalf of a contact, or with a note for admins.
@@ -5113,7 +8746,15 @@ Create event summaries for a user. Event summaries are used to track the number
```typescript -await client.events.summaries(); +await client.tickets.reply({ + ticket_id: "123", + body: { + message_type: "comment", + type: "user", + body: "Thanks again :)", + intercom_user_id: "6762f2971bb69f9f2193bc49", + }, +}); ```
@@ -5129,7 +8770,7 @@ await client.events.summaries();
-**request:** `Intercom.ListEventSummariesRequest` +**request:** `Intercom.ReplyToTicketRequest`
@@ -5137,7 +8778,7 @@ await client.events.summaries();
-**requestOptions:** `Events.RequestOptions` +**requestOptions:** `Tickets.RequestOptions`
@@ -5148,9 +8789,7 @@ await client.events.summaries();
-## Data Export - -
client.dataExport.create({ ...params }) -> Intercom.DataExport +
client.tickets.create({ ...params }) -> Intercom.Ticket | undefined
@@ -5162,21 +8801,7 @@ await client.events.summaries();
-To create your export job, you need to send a `POST` request to the export endpoint `https://api.intercom.io/export/content/data`. - -The only parameters you need to provide are the range of dates that you want exported. - -> 🚧 Limit of one active job -> -> You can only have one active job per workspace. You will receive a HTTP status code of 429 with the message Exceeded rate limit of 1 pending message data export jobs if you attempt to create a second concurrent job. - -> ❗️ Updated_at not included -> -> It should be noted that the timeframe only includes messages sent during the time period and not messages that were only updated during this period. For example, if a message was updated yesterday but sent two days ago, you would need to set the created_at_after date before the message was sent to include that in your retrieval job. - -> 📘 Date ranges are inclusive -> -> Requesting data for 2018-06-01 until 2018-06-30 will get all data for those days including those specified - e.g. 2018-06-01 00:00:00 until 2018-06-30 23:59:99. +You can create a new ticket.
@@ -5192,9 +8817,13 @@ The only parameters you need to provide are the range of dates that you want exp
```typescript -await client.dataExport.create({ - created_at_after: 1719474967, - created_at_before: 1719492967, +await client.tickets.create({ + ticket_type_id: "1234", + contacts: [ + { + id: "6762f2d81bb69f9f2193bc54", + }, + ], }); ``` @@ -5211,7 +8840,7 @@ await client.dataExport.create({
-**request:** `Intercom.CreateDataExportRequest` +**request:** `Intercom.CreateTicketRequest`
@@ -5219,7 +8848,7 @@ await client.dataExport.create({
-**requestOptions:** `DataExport.RequestOptions` +**requestOptions:** `Tickets.RequestOptions`
@@ -5230,7 +8859,7 @@ await client.dataExport.create({
-
client.dataExport.find({ ...params }) -> Intercom.DataExport +
client.tickets.enqueueCreateTicket({ ...params }) -> Intercom.Jobs
@@ -5242,11 +8871,7 @@ await client.dataExport.create({
-You can view the status of your job by sending a `GET` request to the URL -`https://api.intercom.io/export/content/data/{job_identifier}` - the `{job_identifier}` is the value returned in the response when you first created the export job. More on it can be seen in the Export Job Model. - -> 🚧 Jobs expire after two days -> All jobs that have completed processing (and are thus available to download from the provided URL) will have an expiry limit of two days from when the export ob completed. After this, the data will no longer be available. +Enqueues ticket creation for asynchronous processing, returning if the job was enqueued successfully to be processed. We attempt to perform a best-effort validation on inputs before tasks are enqueued. If the given parameters are incorrect, we won't enqueue the job.
@@ -5262,8 +8887,13 @@ You can view the status of your job by sending a `GET` request to the URL
```typescript -await client.dataExport.find({ - job_identifier: "job_identifier", +await client.tickets.enqueueCreateTicket({ + ticket_type_id: "1234", + contacts: [ + { + id: "6762f2d81bb69f9f2193bc54", + }, + ], }); ``` @@ -5280,7 +8910,7 @@ await client.dataExport.find({
-**request:** `Intercom.FindDataExportRequest` +**request:** `Intercom.EnqueueCreateTicketRequest`
@@ -5288,7 +8918,7 @@ await client.dataExport.find({
-**requestOptions:** `DataExport.RequestOptions` +**requestOptions:** `Tickets.RequestOptions`
@@ -5299,7 +8929,7 @@ await client.dataExport.find({
-
client.dataExport.cancel({ ...params }) -> Intercom.DataExport +
client.tickets.get({ ...params }) -> Intercom.Ticket | undefined
@@ -5311,7 +8941,7 @@ await client.dataExport.find({
-You can cancel your job +You can fetch the details of a single ticket.
@@ -5327,8 +8957,8 @@ You can cancel your job
```typescript -await client.dataExport.cancel({ - job_identifier: "job_identifier", +await client.tickets.get({ + ticket_id: "ticket_id", }); ``` @@ -5345,7 +8975,7 @@ await client.dataExport.cancel({
-**request:** `Intercom.CancelDataExportRequest` +**request:** `Intercom.FindTicketRequest`
@@ -5353,7 +8983,7 @@ await client.dataExport.cancel({
-**requestOptions:** `DataExport.RequestOptions` +**requestOptions:** `Tickets.RequestOptions`
@@ -5364,7 +8994,7 @@ await client.dataExport.cancel({
-
client.dataExport.download({ ...params }) -> void +
client.tickets.update({ ...params }) -> Intercom.Ticket | undefined
@@ -5376,13 +9006,7 @@ await client.dataExport.cancel({
-When a job has a status of complete, and thus a filled download_url, you can download your data by hitting that provided URL, formatted like so: https://api.intercom.io/download/content/data/xyz1234. - -Your exported message data will be streamed continuously back down to you in a gzipped CSV format. - -> 📘 Octet header required -> -> You will have to specify the header Accept: `application/octet-stream` when hitting this endpoint. +You can update a ticket.
@@ -5398,8 +9022,17 @@ Your exported message data will be streamed continuously back down to you in a g
```typescript -await client.dataExport.download({ - job_identifier: "job_identifier", +await client.tickets.update({ + ticket_id: "ticket_id", + ticket_attributes: { + _default_title_: "example", + _default_description_: "there is a problem", + }, + ticket_state_id: "123", + open: true, + snoozed_until: 1673609604, + admin_id: 991268011, + assignee_id: "123", }); ``` @@ -5416,7 +9049,7 @@ await client.dataExport.download({
-**request:** `Intercom.DownloadDataExportRequest` +**request:** `Intercom.UpdateTicketRequest`
@@ -5424,7 +9057,7 @@ await client.dataExport.download({
-**requestOptions:** `DataExport.RequestOptions` +**requestOptions:** `Tickets.RequestOptions`
@@ -5435,9 +9068,7 @@ await client.dataExport.download({
-## Messages - -
client.messages.create({ ...params }) -> Intercom.Message +
client.tickets.deleteTicket({ ...params }) -> Intercom.DeleteTicketResponse
@@ -5449,17 +9080,7 @@ await client.dataExport.download({
-You can create a message that has been initiated by an admin. The conversation can be either an in-app message or an email. - -> 🚧 Sending for visitors -> -> There can be a short delay between when a contact is created and when a contact becomes available to be messaged through the API. A 404 Not Found error will be returned in this case. - -This will return the Message model that has been created. - -> 🚧 Retrieving Associated Conversations -> -> As this is a message, there will be no conversation present until the contact responds. Once they do, you will have to search for a contact's conversations with the id of the message. +You can delete a ticket using the Intercom provided ID.
@@ -5475,19 +9096,8 @@ This will return the Message model that has been created.
```typescript -await client.messages.create({ - message_type: "email", - subject: "Thanks for everything", - body: "Hello there", - template: "plain", - from: { - type: "admin", - id: 394051, - }, - to: { - type: "user", - id: "536e564f316c83104c000020", - }, +await client.tickets.deleteTicket({ + ticket_id: "ticket_id", }); ``` @@ -5504,7 +9114,7 @@ await client.messages.create({
-**request:** `Intercom.CreateMessageRequest` +**request:** `Intercom.DeleteTicketRequest`
@@ -5512,7 +9122,7 @@ await client.messages.create({
-**requestOptions:** `Messages.RequestOptions` +**requestOptions:** `Tickets.RequestOptions`
@@ -5523,9 +9133,7 @@ await client.messages.create({
-## Segments - -
client.segments.list({ ...params }) -> Intercom.SegmentList +
client.tickets.search({ ...params }) -> core.Page
@@ -5537,7 +9145,77 @@ await client.messages.create({
-You can fetch a list of all segments. +You can search for multiple tickets by the value of their attributes in order to fetch exactly which ones you want. + +To search for tickets, you send a `POST` request to `https://api.intercom.io/tickets/search`. + +This will accept a query object in the body which will define your filters. +{% admonition type="warning" name="Optimizing search queries" %} +Search queries can be complex, so optimizing them can help the performance of your search. +Use the `AND` and `OR` operators to combine multiple filters to get the exact results you need and utilize +pagination to limit the number of results returned. The default is `20` results per page. +See the [pagination section](https://developers.intercom.com/docs/build-an-integration/learn-more/rest-apis/pagination/#example-search-conversations-request) for more details on how to use the `starting_after` param. +{% /admonition %} + +### Nesting & Limitations + +You can nest these filters in order to get even more granular insights that pinpoint exactly what you need. Example: (1 OR 2) AND (3 OR 4). +There are some limitations to the amount of multiples there can be: + +- There's a limit of max 2 nested filters +- There's a limit of max 15 filters for each AND or OR group + +### Accepted Fields + +Most keys listed as part of the Ticket model are searchable, whether writeable or not. The value you search for has to match the accepted type, otherwise the query will fail (ie. as `created_at` accepts a date, the `value` cannot be a string such as `"foobar"`). +The `source.body` field is unique as the search will not be performed against the entire value, but instead against every element of the value separately. For example, when searching for a conversation with a `"I need support"` body - the query should contain a `=` operator with the value `"support"` for such conversation to be returned. A query with a `=` operator and a `"need support"` value will not yield a result. + +| Field | Type | +| :-------------------- | :------------------------------------------------------------- | +| id | String | +| created_at | Date (UNIX timestamp) | +| updated_at | Date (UNIX timestamp) | +| _default_title_ | String | +| _default_description_ | String | +| category | String | +| ticket_type_id | String | +| contact_ids | String | +| teammate_ids | String | +| admin_assignee_id | String | +| team_assignee_id | String | +| open | Boolean | +| state | String | +| snoozed_until | Date (UNIX timestamp) | +| ticket_attribute.{id} | String or Boolean or Date (UNIX timestamp) or Float or Integer | + +{% admonition type="info" name="Searching by Category" %} +When searching for tickets by the **`category`** field, specific terms must be used instead of the category names: + +- For **Customer** category tickets, use the term `request`. +- For **Back-office** category tickets, use the term `task`. +- For **Tracker** category tickets, use the term `tracker`. + {% /admonition %} + +### Accepted Operators + +{% admonition type="info" name="Searching based on `created_at`" %} +You may use the `<=` or `>=` operators to search by `created_at`. +{% /admonition %} + +The table below shows the operators you can use to define how you want to search for the value. The operator should be put in as a string (`"="`). The operator has to be compatible with the field's type (eg. you cannot search with `>` for a given string value as it's only compatible for integer's and dates). + +| Operator | Valid Types | Description | +| :------- | :---------------------------- | :--------------------------------------------------------- | +| = | All | Equals | +| != | All | Doesn't Equal | +| IN | All | In Shortcut for `OR` queries Values most be in Array | +| NIN | All | Not In Shortcut for `OR !` queries Values must be in Array | +| > | Integer Date (UNIX Timestamp) | Greater (or equal) than | +| < | Integer Date (UNIX Timestamp) | Lower (or equal) than | +| ~ | String | Contains | +| !~ | String | Doesn't Contain | +| ^ | String | Starts With | +| $ | String | Ends With |
@@ -5553,7 +9231,44 @@ You can fetch a list of all segments.
```typescript -await client.segments.list(); +const response = await client.tickets.search({ + query: { + operator: "AND", + value: [ + { + field: "created_at", + operator: ">", + value: "1306054154", + }, + ], + }, + pagination: { + per_page: 5, + }, +}); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +const page = await client.tickets.search({ + query: { + operator: "AND", + value: [ + { + field: "created_at", + operator: ">", + value: "1306054154", + }, + ], + }, + pagination: { + per_page: 5, + }, +}); +while (page.hasNextPage()) { + page = page.getNextPage(); +} ```
@@ -5569,7 +9284,7 @@ await client.segments.list();
-**request:** `Intercom.ListSegmentsRequest` +**request:** `Intercom.SearchRequest`
@@ -5577,7 +9292,7 @@ await client.segments.list();
-**requestOptions:** `Segments.RequestOptions` +**requestOptions:** `Tickets.RequestOptions`
@@ -5588,7 +9303,9 @@ await client.segments.list();
-
client.segments.find({ ...params }) -> Intercom.Segment +## Visitors + +
client.visitors.find({ ...params }) -> Intercom.Visitor | undefined
@@ -5600,7 +9317,7 @@ await client.segments.list();
-You can fetch the details of a single segment. +You can fetch the details of a single visitor.
@@ -5616,8 +9333,8 @@ You can fetch the details of a single segment.
```typescript -await client.segments.find({ - segment_id: "123", +await client.visitors.find({ + user_id: "user_id", }); ``` @@ -5634,7 +9351,7 @@ await client.segments.find({
-**request:** `Intercom.FindSegmentRequest` +**request:** `Intercom.FindVisitorRequest`
@@ -5642,7 +9359,7 @@ await client.segments.find({
-**requestOptions:** `Segments.RequestOptions` +**requestOptions:** `Visitors.RequestOptions`
@@ -5653,9 +9370,7 @@ await client.segments.find({
-## Subscription Types - -
client.subscriptionTypes.list() -> Intercom.SubscriptionTypeList +
client.visitors.update({ ...params }) -> Intercom.Visitor | undefined
@@ -5667,7 +9382,11 @@ await client.segments.find({
-You can list all subscription types. A list of subscription type objects will be returned. +Sending a PUT request to `/visitors` will result in an update of an existing Visitor. + +**Option 1.** You can update a visitor by passing in the `user_id` of the visitor in the Request body. + +**Option 2.** You can update a visitor by passing in the `id` of the visitor in the Request body.
@@ -5683,7 +9402,10 @@ You can list all subscription types. A list of subscription type objects will be
```typescript -await client.subscriptionTypes.list(); +await client.visitors.update({ + id: "6762f30c1bb69f9f2193bc5e", + name: "Gareth Bale", +}); ```
@@ -5699,7 +9421,15 @@ await client.subscriptionTypes.list();
-**requestOptions:** `SubscriptionTypes.RequestOptions` +**request:** `Intercom.UpdateVisitorRequest` + +
+
+ +
+
+ +**requestOptions:** `Visitors.RequestOptions`
@@ -5710,9 +9440,7 @@ await client.subscriptionTypes.list();
-## PhoneCallRedirects - -
client.phoneCallRedirects.create({ ...params }) -> Intercom.PhoneSwitch +
client.visitors.mergeToContact({ ...params }) -> Intercom.Contact
@@ -5724,10 +9452,11 @@ await client.subscriptionTypes.list();
-You can use the API to deflect phone calls to the Intercom Messenger. -Calling this endpoint will send an SMS with a link to the Messenger to the phone number specified. +You can merge a Visitor to a Contact of role type `lead` or `user`. -If custom attributes are specified, they will be added to the user or lead's custom data attributes. +> 📘 What happens upon a visitor being converted? +> +> If the User exists, then the Visitor will be merged into it, the Visitor deleted and the User returned. If the User does not exist, the Visitor will be converted to a User, with the User identifiers replacing it's Visitor identifiers.
@@ -5743,11 +9472,14 @@ If custom attributes are specified, they will be added to the user or lead's cus
```typescript -await client.phoneCallRedirects.create({ - phone: "+353832345678", - custom_attributes: { - issue_type: "Billing", - priority: "High", +await client.visitors.mergeToContact({ + type: "user", + user: { + id: "8a88a590-e1c3-41e2-a502-e0649dbf721c", + email: "foo@bar.com", + }, + visitor: { + user_id: "3ecf64d0-9ed1-4e9f-88e1-da7d6e6782f3", }, }); ``` @@ -5765,7 +9497,7 @@ await client.phoneCallRedirects.create({
-**request:** `Intercom.CreatePhoneCallRedirectRequest` +**request:** `Intercom.MergeVisitorToContactRequest`
@@ -5773,7 +9505,7 @@ await client.phoneCallRedirects.create({
-**requestOptions:** `PhoneCallRedirects.RequestOptions` +**requestOptions:** `Visitors.RequestOptions`
@@ -5784,9 +9516,9 @@ await client.phoneCallRedirects.create({
-## Teams +## HelpCenters Collections -
client.teams.list() -> Intercom.TeamList +
client.helpCenters.collections.list({ ...params }) -> core.Page
@@ -5798,7 +9530,9 @@ await client.phoneCallRedirects.create({
-This will return a list of team objects for the App. +You can fetch a list of all collections by making a GET request to `https://api.intercom.io/help_center/collections`. + +Collections will be returned in descending order on the `updated_at` attribute. This means if you need to iterate through results then we'll show the most recently updated collections first.
@@ -5814,7 +9548,16 @@ This will return a list of team objects for the App.
```typescript -await client.teams.list(); +const response = await client.helpCenters.collections.list(); +for await (const item of response) { + console.log(item); +} + +// Or you can manually iterate page-by-page +const page = await client.helpCenters.collections.list(); +while (page.hasNextPage()) { + page = page.getNextPage(); +} ```
@@ -5830,7 +9573,15 @@ await client.teams.list();
-**requestOptions:** `Teams.RequestOptions` +**request:** `Intercom.helpCenters.ListCollectionsRequest` + +
+
+ +
+
+ +**requestOptions:** `Collections.RequestOptions`
@@ -5841,7 +9592,7 @@ await client.teams.list();
-
client.teams.find({ ...params }) -> Intercom.Team +
client.helpCenters.collections.create({ ...params }) -> Intercom.Collection
@@ -5853,7 +9604,7 @@ await client.teams.list();
-You can fetch the details of a single team, containing an array of admins that belong to this team. +You can create a new collection by making a POST request to `https://api.intercom.io/help_center/collections.`
@@ -5869,8 +9620,8 @@ You can fetch the details of a single team, containing an array of admins that b
```typescript -await client.teams.find({ - team_id: "123", +await client.helpCenters.collections.create({ + name: "Thanks for everything", }); ``` @@ -5887,7 +9638,7 @@ await client.teams.find({
-**request:** `Intercom.FindTeamRequest` +**request:** `Intercom.helpCenters.CreateCollectionRequest`
@@ -5895,7 +9646,7 @@ await client.teams.find({
-**requestOptions:** `Teams.RequestOptions` +**requestOptions:** `Collections.RequestOptions`
@@ -5906,9 +9657,7 @@ await client.teams.find({
-## Ticket Types - -
client.ticketTypes.list() -> Intercom.TicketTypeList +
client.helpCenters.collections.find({ ...params }) -> Intercom.Collection
@@ -5920,7 +9669,7 @@ await client.teams.find({
-You can get a list of all ticket types for a workspace. +You can fetch the details of a single collection by making a GET request to `https://api.intercom.io/help_center/collections/`.
@@ -5936,7 +9685,9 @@ You can get a list of all ticket types for a workspace.
```typescript -await client.ticketTypes.list(); +await client.helpCenters.collections.find({ + collection_id: 1, +}); ```
@@ -5952,7 +9703,15 @@ await client.ticketTypes.list();
-**requestOptions:** `TicketTypes.RequestOptions` +**request:** `Intercom.helpCenters.FindCollectionRequest` + +
+
+ +
+
+ +**requestOptions:** `Collections.RequestOptions`
@@ -5963,7 +9722,7 @@ await client.ticketTypes.list();
-
client.ticketTypes.create({ ...params }) -> Intercom.TicketType +
client.helpCenters.collections.update({ ...params }) -> Intercom.Collection
@@ -5975,12 +9734,7 @@ await client.ticketTypes.list();
-You can create a new ticket type. - -> 📘 Creating ticket types. -> -> Every ticket type will be created with two default attributes: _default_title_ and _default_description_. -> For the `icon` propery, use an emoji from [Twemoji Cheatsheet](https://twemoji-cheatsheet.vercel.app/) +You can update the details of a single collection by making a PUT request to `https://api.intercom.io/collections/`.
@@ -5996,11 +9750,9 @@ You can create a new ticket type.
```typescript -await client.ticketTypes.create({ - name: "Customer Issue", - description: "Customer Report Template", - category: "Customer", - icon: "\uD83C\uDF9F\uFE0F", +await client.helpCenters.collections.update({ + collection_id: 1, + name: "Update collection name", }); ``` @@ -6017,7 +9769,7 @@ await client.ticketTypes.create({
-**request:** `Intercom.CreateTicketTypeRequest` +**request:** `Intercom.helpCenters.UpdateCollectionRequest`
@@ -6025,7 +9777,7 @@ await client.ticketTypes.create({
-**requestOptions:** `TicketTypes.RequestOptions` +**requestOptions:** `Collections.RequestOptions`
@@ -6036,7 +9788,7 @@ await client.ticketTypes.create({
-
client.ticketTypes.get({ ...params }) -> Intercom.TicketType +
client.helpCenters.collections.delete({ ...params }) -> Intercom.DeletedCollectionObject
@@ -6048,7 +9800,7 @@ await client.ticketTypes.create({
-You can fetch the details of a single ticket type. +You can delete a single collection by making a DELETE request to `https://api.intercom.io/collections/`.
@@ -6064,8 +9816,8 @@ You can fetch the details of a single ticket type.
```typescript -await client.ticketTypes.get({ - ticket_type_id: "ticket_type_id", +await client.helpCenters.collections.delete({ + collection_id: 1, }); ``` @@ -6082,7 +9834,7 @@ await client.ticketTypes.get({
-**request:** `Intercom.FindTicketTypeRequest` +**request:** `Intercom.helpCenters.DeleteCollectionRequest`
@@ -6090,7 +9842,7 @@ await client.ticketTypes.get({
-**requestOptions:** `TicketTypes.RequestOptions` +**requestOptions:** `Collections.RequestOptions`
@@ -6101,7 +9853,9 @@ await client.ticketTypes.get({
-
client.ticketTypes.update({ ...params }) -> Intercom.TicketType +## News Items + +
client.news.items.list() -> Intercom.PaginatedResponse
@@ -6113,11 +9867,7 @@ await client.ticketTypes.get({
-You can update a ticket type. - -> 📘 Updating a ticket type. -> -> For the `icon` propery, use an emoji from [Twemoji Cheatsheet](https://twemoji-cheatsheet.vercel.app/) +You can fetch a list of all news items
@@ -6133,10 +9883,7 @@ You can update a ticket type.
```typescript -await client.ticketTypes.update({ - ticket_type_id: "ticket_type_id", - name: "Bug Report 2", -}); +await client.news.items.list(); ```
@@ -6152,15 +9899,7 @@ await client.ticketTypes.update({
-**request:** `Intercom.UpdateTicketTypeRequest` - -
-
- -
-
- -**requestOptions:** `TicketTypes.RequestOptions` +**requestOptions:** `Items.RequestOptions`
@@ -6171,9 +9910,7 @@ await client.ticketTypes.update({
-## Tickets - -
client.tickets.reply({ ...params }) -> Intercom.TicketReply +
client.news.items.create({ ...params }) -> Intercom.NewsItem
@@ -6185,7 +9922,7 @@ await client.ticketTypes.update({
-You can reply to a ticket with a message from an admin or on behalf of a contact, or with a note for admins. +You can create a news item
@@ -6201,14 +9938,20 @@ You can reply to a ticket with a message from an admin or on behalf of a contact
```typescript -await client.tickets.reply({ - ticket_id: "123", - body: { - message_type: "comment", - type: "user", - body: "Thanks again :)", - intercom_user_id: "667d619d8a68186f43bafe82", - }, +await client.news.items.create({ + title: "Halloween is here!", + body: "

New costumes in store for this spooky season

", + sender_id: 991267834, + state: "live", + deliver_silently: true, + labels: ["Product", "Update", "New"], + reactions: ["\uD83D\uDE06", "\uD83D\uDE05"], + newsfeed_assignments: [ + { + newsfeed_id: 53, + published_at: 1664638214, + }, + ], }); ``` @@ -6225,7 +9968,7 @@ await client.tickets.reply({
-**request:** `Intercom.ReplyToTicketRequest` +**request:** `Intercom.NewsItemRequest`
@@ -6233,7 +9976,7 @@ await client.tickets.reply({
-**requestOptions:** `Tickets.RequestOptions` +**requestOptions:** `Items.RequestOptions`
@@ -6244,7 +9987,7 @@ await client.tickets.reply({
-
client.tickets.create({ ...params }) -> Intercom.Ticket +
client.news.items.find({ ...params }) -> Intercom.NewsItem
@@ -6256,7 +9999,7 @@ await client.tickets.reply({
-You can create a new ticket. +You can fetch the details of a single news item.
@@ -6272,17 +10015,8 @@ You can create a new ticket.
```typescript -await client.tickets.create({ - ticket_type_id: "1234", - contacts: [ - { - id: "667d61b78a68186f43bafe8d", - }, - ], - ticket_attributes: { - _default_title_: "example", - _default_description_: "there is a problem", - }, +await client.news.items.find({ + news_item_id: 1, }); ``` @@ -6299,7 +10033,7 @@ await client.tickets.create({
-**request:** `Intercom.CreateTicketRequest` +**request:** `Intercom.news.FindNewsItemRequest`
@@ -6307,7 +10041,7 @@ await client.tickets.create({
-**requestOptions:** `Tickets.RequestOptions` +**requestOptions:** `Items.RequestOptions`
@@ -6318,25 +10052,10 @@ await client.tickets.create({
-
client.tickets.get({ ...params }) -> Intercom.Ticket -
-
- -#### 📝 Description - -
-
- +
client.news.items.update({ ...params }) -> Intercom.NewsItem
-You can fetch the details of a single ticket. - -
-
-
-
- #### 🔌 Usage
@@ -6346,8 +10065,14 @@ You can fetch the details of a single ticket.
```typescript -await client.tickets.get({ - ticket_id: "ticket_id", +await client.news.items.update({ + news_item_id: 1, + body: { + title: "Christmas is here!", + body: "

New gifts in store for the jolly season

", + sender_id: 991267845, + reactions: ["\uD83D\uDE1D", "\uD83D\uDE02"], + }, }); ``` @@ -6364,7 +10089,7 @@ await client.tickets.get({
-**request:** `Intercom.FindTicketRequest` +**request:** `Intercom.news.UpdateNewsItemRequest`
@@ -6372,7 +10097,7 @@ await client.tickets.get({
-**requestOptions:** `Tickets.RequestOptions` +**requestOptions:** `Items.RequestOptions`
@@ -6383,7 +10108,7 @@ await client.tickets.get({
-
client.tickets.update({ ...params }) -> Intercom.Ticket +
client.news.items.delete({ ...params }) -> Intercom.DeletedObject
@@ -6395,7 +10120,7 @@ await client.tickets.get({
-You can update a ticket. +You can delete a single news item.
@@ -6411,19 +10136,8 @@ You can update a ticket.
```typescript -await client.tickets.update({ - ticket_id: "ticket_id", - ticket_attributes: { - _default_title_: "example", - _default_description_: "there is a problem", - }, - state: "in_progress", - open: true, - snoozed_until: 1673609604, - assignment: { - admin_id: "991267883", - assignee_id: "991267885", - }, +await client.news.items.delete({ + news_item_id: 1, }); ``` @@ -6440,7 +10154,7 @@ await client.tickets.update({
-**request:** `Intercom.UpdateTicketRequest` +**request:** `Intercom.news.DeleteNewsItemRequest`
@@ -6448,7 +10162,7 @@ await client.tickets.update({
-**requestOptions:** `Tickets.RequestOptions` +**requestOptions:** `Items.RequestOptions`
@@ -6459,7 +10173,9 @@ await client.tickets.update({
-
client.tickets.search({ ...params }) -> core.Page +## News Feeds + +
client.news.feeds.listItems({ ...params }) -> Intercom.PaginatedResponse
@@ -6471,68 +10187,7 @@ await client.tickets.update({
-You can search for multiple tickets by the value of their attributes in order to fetch exactly which ones you want. - -To search for tickets, you send a `POST` request to `https://api.intercom.io/tickets/search`. - -This will accept a query object in the body which will define your filters. -{% admonition type="warning" name="Optimizing search queries" %} -Search queries can be complex, so optimizing them can help the performance of your search. -Use the `AND` and `OR` operators to combine multiple filters to get the exact results you need and utilize -pagination to limit the number of results returned. The default is `20` results per page. -See the [pagination section](https://developers.intercom.com/docs/build-an-integration/learn-more/rest-apis/pagination/#example-search-conversations-request) for more details on how to use the `starting_after` param. -{% /admonition %} - -### Nesting & Limitations - -You can nest these filters in order to get even more granular insights that pinpoint exactly what you need. Example: (1 OR 2) AND (3 OR 4). -There are some limitations to the amount of multiples there can be: - -- There's a limit of max 2 nested filters -- There's a limit of max 15 filters for each AND or OR group - -### Accepted Fields - -Most keys listed as part of the Ticket model are searchable, whether writeable or not. The value you search for has to match the accepted type, otherwise the query will fail (ie. as `created_at` accepts a date, the `value` cannot be a string such as `"foobar"`). - -| Field | Type | -| :-------------------- | :------------------------------------------------------------- | -| id | String | -| created_at | Date (UNIX timestamp) | -| updated_at | Date (UNIX timestamp) | -| _default_title_ | String | -| _default_description_ | String | -| category | String | -| ticket_type_id | String | -| contact_ids | String | -| teammate_ids | String | -| admin_assignee_id | String | -| team_assignee_id | String | -| open | Boolean | -| state | String | -| snoozed_until | Date (UNIX timestamp) | -| ticket_attribute.{id} | String or Boolean or Date (UNIX timestamp) or Float or Integer | - -### Accepted Operators - -{% admonition type="info" name="Searching based on `created_at`" %} -You may use the `<=` or `>=` operators to search by `created_at`. -{% /admonition %} - -The table below shows the operators you can use to define how you want to search for the value. The operator should be put in as a string (`"="`). The operator has to be compatible with the field's type (eg. you cannot search with `>` for a given string value as it's only compatible for integer's and dates). - -| Operator | Valid Types | Description | -| :------- | :---------------------------- | :--------------------------------------------------------- | -| = | All | Equals | -| != | All | Doesn't Equal | -| IN | All | In Shortcut for `OR` queries Values most be in Array | -| NIN | All | Not In Shortcut for `OR !` queries Values must be in Array | -| > | Integer Date (UNIX Timestamp) | Greater (or equal) than | -| < | Integer Date (UNIX Timestamp) | Lower (or equal) than | -| ~ | String | Contains | -| !~ | String | Doesn't Contain | -| ^ | String | Starts With | -| $ | String | Ends With | +You can fetch a list of all news items that are live on a given newsfeed
@@ -6542,50 +10197,15 @@ The table below shows the operators you can use to define how you want to search #### 🔌 Usage
-
- -
-
- -```typescript -const response = await client.tickets.search({ - query: { - operator: "AND", - value: [ - { - field: "created_at", - operator: ">", - value: "1306054154", - }, - ], - }, - pagination: { - per_page: 5, - }, -}); -for await (const item of response) { - console.log(item); -} +
-// Or you can manually iterate page-by-page -const page = await client.tickets.search({ - query: { - operator: "AND", - value: [ - { - field: "created_at", - operator: ">", - value: "1306054154", - }, - ], - }, - pagination: { - per_page: 5, - }, +
+
+ +```typescript +await client.news.feeds.listItems({ + newsfeed_id: "123", }); -while (page.hasNextPage()) { - page = page.getNextPage(); -} ```
@@ -6601,7 +10221,7 @@ while (page.hasNextPage()) {
-**request:** `Intercom.SearchRequest` +**request:** `Intercom.news.ListNewsFeedItemsRequest`
@@ -6609,7 +10229,7 @@ while (page.hasNextPage()) {
-**requestOptions:** `Tickets.RequestOptions` +**requestOptions:** `Feeds.RequestOptions`
@@ -6620,9 +10240,7 @@ while (page.hasNextPage()) {
-## Visitors - -
client.visitors.find({ ...params }) -> Intercom.Visitor +
client.news.feeds.list() -> Intercom.PaginatedResponse
@@ -6634,7 +10252,7 @@ while (page.hasNextPage()) {
-You can fetch the details of a single visitor. +You can fetch a list of all newsfeeds
@@ -6650,9 +10268,7 @@ You can fetch the details of a single visitor.
```typescript -await client.visitors.find({ - user_id: "user_id", -}); +await client.news.feeds.list(); ```
@@ -6668,15 +10284,7 @@ await client.visitors.find({
-**request:** `Intercom.FindVisitorRequest` - -
-
- -
-
- -**requestOptions:** `Visitors.RequestOptions` +**requestOptions:** `Feeds.RequestOptions`
@@ -6687,7 +10295,7 @@ await client.visitors.find({
-
client.visitors.update({ ...params }) -> Intercom.Visitor +
client.news.feeds.find({ ...params }) -> Intercom.Newsfeed
@@ -6699,11 +10307,7 @@ await client.visitors.find({
-Sending a PUT request to `/visitors` will result in an update of an existing Visitor. - -**Option 1.** You can update a visitor by passing in the `user_id` of the visitor in the Request body. - -**Option 2.** You can update a visitor by passing in the `id` of the visitor in the Request body. +You can fetch the details of a single newsfeed
@@ -6719,9 +10323,8 @@ Sending a PUT request to `/visitors` will result in an update of an existing Vis
```typescript -await client.visitors.update({ - id: "667d61cc8a68186f43bafe95", - name: "Gareth Bale", +await client.news.feeds.find({ + newsfeed_id: "123", }); ``` @@ -6738,7 +10341,7 @@ await client.visitors.update({
-**request:** `Intercom.UpdateVisitorRequest` +**request:** `Intercom.news.FindNewsFeedRequest`
@@ -6746,7 +10349,7 @@ await client.visitors.update({
-**requestOptions:** `Visitors.RequestOptions` +**requestOptions:** `Feeds.RequestOptions`
@@ -6757,7 +10360,9 @@ await client.visitors.update({
-
client.visitors.mergeToContact({ ...params }) -> Intercom.Contact +## TicketTypes Attributes + +
client.ticketTypes.attributes.create({ ...params }) -> Intercom.TicketTypeAttribute | undefined
@@ -6769,11 +10374,7 @@ await client.visitors.update({
-You can merge a Visitor to a Contact of role type `lead` or `user`. - -> 📘 What happens upon a visitor being converted? -> -> If the User exists, then the Visitor will be merged into it, the Visitor deleted and the User returned. If the User does not exist, the Visitor will be converted to a User, with the User identifiers replacing it's Visitor identifiers. +You can create a new attribute for a ticket type.
@@ -6789,15 +10390,12 @@ You can merge a Visitor to a Contact of role type `lead` or `user`.
```typescript -await client.visitors.mergeToContact({ - type: "user", - user: { - id: "8a88a590-e1c3-41e2-a502-e0649dbf721c", - email: "foo@bar.com", - }, - visitor: { - user_id: "3ecf64d0-9ed1-4e9f-88e1-da7d6e6782f3", - }, +await client.ticketTypes.attributes.create({ + ticket_type_id: "ticket_type_id", + name: "Attribute Title", + description: "Attribute Description", + data_type: "string", + required_to_create: false, }); ``` @@ -6814,7 +10412,7 @@ await client.visitors.mergeToContact({
-**request:** `Intercom.MergeVisitorToContactRequest` +**request:** `Intercom.ticketTypes.CreateTicketTypeAttributeRequest`
@@ -6822,7 +10420,7 @@ await client.visitors.mergeToContact({
-**requestOptions:** `Visitors.RequestOptions` +**requestOptions:** `Attributes.RequestOptions`
@@ -6833,9 +10431,7 @@ await client.visitors.mergeToContact({
-## HelpCenters Collections - -
client.helpCenters.collections.list({ ...params }) -> core.Page +
client.ticketTypes.attributes.update({ ...params }) -> Intercom.TicketTypeAttribute | undefined
@@ -6847,9 +10443,7 @@ await client.visitors.mergeToContact({
-You can fetch a list of all collections by making a GET request to `https://api.intercom.io/help_center/collections`. - -Collections will be returned in descending order on the `updated_at` attribute. This means if you need to iterate through results then we'll show the most recently updated collections first. +You can update an existing attribute for a ticket type.
@@ -6865,16 +10459,11 @@ Collections will be returned in descending order on the `updated_at` attribute.
```typescript -const response = await client.helpCenters.collections.list(); -for await (const item of response) { - console.log(item); -} - -// Or you can manually iterate page-by-page -const page = await client.helpCenters.collections.list(); -while (page.hasNextPage()) { - page = page.getNextPage(); -} +await client.ticketTypes.attributes.update({ + ticket_type_id: "ticket_type_id", + attribute_id: "attribute_id", + description: "New Attribute Description", +}); ```
@@ -6890,7 +10479,7 @@ while (page.hasNextPage()) {
-**request:** `Intercom.helpCenters.ListCollectionsRequest` +**request:** `Intercom.ticketTypes.UpdateTicketTypeAttributeRequest`
@@ -6898,7 +10487,7 @@ while (page.hasNextPage()) {
-**requestOptions:** `Collections.RequestOptions` +**requestOptions:** `Attributes.RequestOptions`
@@ -6909,7 +10498,9 @@ while (page.hasNextPage()) {
-
client.helpCenters.collections.create({ ...params }) -> Intercom.Collection +## Admins + +
client.unstable.admins.identifyAdmin() -> Intercom.AdminWithApp | undefined
@@ -6921,7 +10512,11 @@ while (page.hasNextPage()) {
-You can create a new collection by making a POST request to `https://api.intercom.io/help_center/collections.` +You can view the currently authorised admin along with the embedded app object (a "workspace" in legacy terminology). + +> 🚧 Single Sign On +> +> If you are building a custom "Log in with Intercom" flow for your site, and you call the `/me` endpoint to identify the logged-in user, you should not accept any sign-ins from users with unverified email addresses as it poses a potential impersonation security risk.
@@ -6937,9 +10532,7 @@ You can create a new collection by making a POST request to `https://api.interco
```typescript -await client.helpCenters.collections.create({ - name: "Thanks for everything", -}); +await client.unstable.admins.identifyAdmin(); ```
@@ -6955,15 +10548,7 @@ await client.helpCenters.collections.create({
-**request:** `Intercom.helpCenters.CreateCollectionRequest` - -
-
- -
-
- -**requestOptions:** `Collections.RequestOptions` +**requestOptions:** `Admins.RequestOptions`
@@ -6974,7 +10559,7 @@ await client.helpCenters.collections.create({
-
client.helpCenters.collections.find({ ...params }) -> Intercom.Collection +
client.unstable.admins.setAwayAdmin({ ...params }) -> Intercom.Admin | undefined
@@ -6986,7 +10571,7 @@ await client.helpCenters.collections.create({
-You can fetch the details of a single collection by making a GET request to `https://api.intercom.io/help_center/collections/`. +You can set an Admin as away for the Inbox.
@@ -7002,8 +10587,11 @@ You can fetch the details of a single collection by making a GET request to `htt
```typescript -await client.helpCenters.collections.find({ - collection_id: "123", +await client.unstable.admins.setAwayAdmin({ + id: 1, + away_mode_enabled: true, + away_mode_reassign: true, + away_status_reason_id: 12345, }); ``` @@ -7020,7 +10608,7 @@ await client.helpCenters.collections.find({
-**request:** `Intercom.helpCenters.FindCollectionRequest` +**request:** `Intercom.unstable.SetAwayAdminRequest`
@@ -7028,7 +10616,7 @@ await client.helpCenters.collections.find({
-**requestOptions:** `Collections.RequestOptions` +**requestOptions:** `Admins.RequestOptions`
@@ -7039,7 +10627,7 @@ await client.helpCenters.collections.find({
-
client.helpCenters.collections.update({ ...params }) -> Intercom.Collection +
client.unstable.admins.listActivityLogs({ ...params }) -> Intercom.ActivityLogList
@@ -7051,7 +10639,7 @@ await client.helpCenters.collections.find({
-You can update the details of a single collection by making a PUT request to `https://api.intercom.io/collections/`. +You can get a log of activities by all admins in an app.
@@ -7067,9 +10655,9 @@ You can update the details of a single collection by making a PUT request to `ht
```typescript -await client.helpCenters.collections.update({ - collection_id: "123", - name: "Update collection name", +await client.unstable.admins.listActivityLogs({ + created_at_after: "1677253093", + created_at_before: "1677861493", }); ``` @@ -7086,7 +10674,7 @@ await client.helpCenters.collections.update({
-**request:** `Intercom.helpCenters.UpdateCollectionRequest` +**request:** `Intercom.unstable.ListActivityLogsRequest`
@@ -7094,7 +10682,7 @@ await client.helpCenters.collections.update({
-**requestOptions:** `Collections.RequestOptions` +**requestOptions:** `Admins.RequestOptions`
@@ -7105,7 +10693,7 @@ await client.helpCenters.collections.update({
-
client.helpCenters.collections.delete({ ...params }) -> Intercom.DeletedCollectionObject +
client.unstable.admins.listAdmins() -> Intercom.AdminList
@@ -7117,7 +10705,7 @@ await client.helpCenters.collections.update({
-You can delete a single collection by making a DELETE request to `https://api.intercom.io/collections/`. +You can fetch a list of admins for a given workspace.
@@ -7133,9 +10721,7 @@ You can delete a single collection by making a DELETE request to `https://api.in
```typescript -await client.helpCenters.collections.delete({ - collection_id: "123", -}); +await client.unstable.admins.listAdmins(); ```
@@ -7151,15 +10737,7 @@ await client.helpCenters.collections.delete({
-**request:** `Intercom.helpCenters.DeleteCollectionRequest` - -
-
- -
-
- -**requestOptions:** `Collections.RequestOptions` +**requestOptions:** `Admins.RequestOptions`
@@ -7170,9 +10748,7 @@ await client.helpCenters.collections.delete({
-## News Items - -
client.news.items.list() -> Intercom.PaginatedNewsItemResponse +
client.unstable.admins.retrieveAdmin({ ...params }) -> Intercom.Admin | undefined
@@ -7184,7 +10760,7 @@ await client.helpCenters.collections.delete({
-You can fetch a list of all news items +You can retrieve the details of a single admin.
@@ -7200,7 +10776,9 @@ You can fetch a list of all news items
```typescript -await client.news.items.list(); +await client.unstable.admins.retrieveAdmin({ + id: 1, +}); ```
@@ -7216,7 +10794,15 @@ await client.news.items.list();
-**requestOptions:** `Items.RequestOptions` +**request:** `Intercom.unstable.RetrieveAdminRequest` + +
+
+ +
+
+ +**requestOptions:** `Admins.RequestOptions`
@@ -7227,7 +10813,9 @@ await client.news.items.list();
-
client.news.items.create({ ...params }) -> Intercom.NewsItem +## AI Content + +
client.unstable.aiContent.listContentImportSources() -> Intercom.ContentImportSourcesList
@@ -7239,7 +10827,7 @@ await client.news.items.list();
-You can create a news item +You can retrieve a list of all content import sources for a workspace.
@@ -7255,21 +10843,7 @@ You can create a news item
```typescript -await client.news.items.create({ - title: "Halloween is here!", - body: "

New costumes in store for this spooky season

", - sender_id: 991267734, - state: "live", - deliver_silently: true, - labels: ["Product", "Update", "New"], - reactions: ["\uD83D\uDE06", "\uD83D\uDE05"], - newsfeed_assignments: [ - { - newsfeed_id: 53, - published_at: 1664638214, - }, - ], -}); +await client.unstable.aiContent.listContentImportSources(); ```
@@ -7285,15 +10859,7 @@ await client.news.items.create({
-**request:** `Intercom.NewsItemRequest` - -
-
- -
-
- -**requestOptions:** `Items.RequestOptions` +**requestOptions:** `AiContent.RequestOptions`
@@ -7304,7 +10870,7 @@ await client.news.items.create({
-
client.news.items.find({ ...params }) -> Intercom.NewsItem +
client.unstable.aiContent.createContentImportSource({ ...params }) -> Intercom.ContentImportSource
@@ -7316,7 +10882,7 @@ await client.news.items.create({
-You can fetch the details of a single news item. +You can create a new content import source by sending a POST request to this endpoint.
@@ -7332,8 +10898,8 @@ You can fetch the details of a single news item.
```typescript -await client.news.items.find({ - news_item_id: "123", +await client.unstable.aiContent.createContentImportSource({ + url: "https://www.example.com", }); ``` @@ -7350,7 +10916,7 @@ await client.news.items.find({
-**request:** `Intercom.news.FindNewsItemRequest` +**request:** `Intercom.unstable.CreateContentImportSourceRequest`
@@ -7358,7 +10924,7 @@ await client.news.items.find({
-**requestOptions:** `Items.RequestOptions` +**requestOptions:** `AiContent.RequestOptions`
@@ -7369,7 +10935,7 @@ await client.news.items.find({
-
client.news.items.update({ ...params }) -> Intercom.NewsItem +
client.unstable.aiContent.getContentImportSource({ ...params }) -> Intercom.ContentImportSource
@@ -7382,14 +10948,8 @@ await client.news.items.find({
```typescript -await client.news.items.update({ - news_item_id: "123", - body: { - title: "Christmas is here!", - body: "

New gifts in store for the jolly season

", - sender_id: 991267745, - reactions: ["\uD83D\uDE1D", "\uD83D\uDE02"], - }, +await client.unstable.aiContent.getContentImportSource({ + id: "id", }); ``` @@ -7406,7 +10966,7 @@ await client.news.items.update({
-**request:** `Intercom.news.UpdateNewsItemRequest` +**request:** `Intercom.unstable.GetContentImportSourceRequest`
@@ -7414,7 +10974,7 @@ await client.news.items.update({
-**requestOptions:** `Items.RequestOptions` +**requestOptions:** `AiContent.RequestOptions`
@@ -7425,7 +10985,7 @@ await client.news.items.update({
-
client.news.items.delete({ ...params }) -> Intercom.DeletedObject +
client.unstable.aiContent.updateContentImportSource({ ...params }) -> Intercom.ContentImportSource
@@ -7437,7 +10997,7 @@ await client.news.items.update({
-You can delete a single news item. +You can update an existing content import source.
@@ -7453,8 +11013,10 @@ You can delete a single news item.
```typescript -await client.news.items.delete({ - news_item_id: "123", +await client.unstable.aiContent.updateContentImportSource({ + id: "id", + sync_behavior: "api", + url: "https://www.example.com", }); ``` @@ -7471,7 +11033,7 @@ await client.news.items.delete({
-**request:** `Intercom.news.DeleteNewsItemRequest` +**request:** `Intercom.unstable.UpdateContentImportSourceRequest`
@@ -7479,7 +11041,7 @@ await client.news.items.delete({
-**requestOptions:** `Items.RequestOptions` +**requestOptions:** `AiContent.RequestOptions`
@@ -7490,9 +11052,7 @@ await client.news.items.delete({
-## News Feeds - -
client.news.feeds.listItems({ ...params }) -> Intercom.PaginatedNewsItemResponse +
client.unstable.aiContent.deleteContentImportSource({ ...params }) -> void
@@ -7504,7 +11064,7 @@ await client.news.items.delete({
-You can fetch a list of all news items that are live on a given newsfeed +You can delete a content import source by making a DELETE request this endpoint. This will also delete all external pages that were imported from this source.
@@ -7520,8 +11080,8 @@ You can fetch a list of all news items that are live on a given newsfeed
```typescript -await client.news.feeds.listItems({ - newsfeed_id: "123", +await client.unstable.aiContent.deleteContentImportSource({ + id: "id", }); ``` @@ -7538,7 +11098,7 @@ await client.news.feeds.listItems({
-**request:** `Intercom.news.ListNewsFeedItemsRequest` +**request:** `Intercom.unstable.DeleteContentImportSourceRequest`
@@ -7546,7 +11106,7 @@ await client.news.feeds.listItems({
-**requestOptions:** `Feeds.RequestOptions` +**requestOptions:** `AiContent.RequestOptions`
@@ -7557,7 +11117,7 @@ await client.news.feeds.listItems({
-
client.news.feeds.list() -> Intercom.PaginatedNewsfeedResponse +
client.unstable.aiContent.listExternalPages() -> Intercom.ExternalPagesList
@@ -7569,7 +11129,7 @@ await client.news.feeds.listItems({
-You can fetch a list of all newsfeeds +You can retrieve a list of all external pages for a workspace.
@@ -7585,7 +11145,7 @@ You can fetch a list of all newsfeeds
```typescript -await client.news.feeds.list(); +await client.unstable.aiContent.listExternalPages(); ```
@@ -7601,7 +11161,7 @@ await client.news.feeds.list();
-**requestOptions:** `Feeds.RequestOptions` +**requestOptions:** `AiContent.RequestOptions`
@@ -7612,7 +11172,7 @@ await client.news.feeds.list();
-
client.news.feeds.find({ ...params }) -> Intercom.Newsfeed +
client.unstable.aiContent.createExternalPage({ ...params }) -> Intercom.ExternalPage
@@ -7624,7 +11184,7 @@ await client.news.feeds.list();
-You can fetch the details of a single newsfeed +You can create a new external page by sending a POST request to this endpoint. If an external page already exists with the specified source_id and external_id, it will be updated instead.
@@ -7640,8 +11200,12 @@ You can fetch the details of a single newsfeed
```typescript -await client.news.feeds.find({ - newsfeed_id: "123", +await client.unstable.aiContent.createExternalPage({ + title: "Test", + html: "

Test

", + url: "https://www.example.com", + source_id: 44, + external_id: "abc1234", }); ``` @@ -7658,7 +11222,7 @@ await client.news.feeds.find({
-**request:** `Intercom.news.FindNewsFeedRequest` +**request:** `Intercom.unstable.CreateExternalPageRequest`
@@ -7666,7 +11230,7 @@ await client.news.feeds.find({
-**requestOptions:** `Feeds.RequestOptions` +**requestOptions:** `AiContent.RequestOptions`
@@ -7677,9 +11241,7 @@ await client.news.feeds.find({
-## TicketTypes Attributes - -
client.ticketTypes.attributes.create({ ...params }) -> Intercom.TicketTypeAttribute +
client.unstable.aiContent.getExternalPage({ ...params }) -> Intercom.ExternalPage
@@ -7691,7 +11253,7 @@ await client.news.feeds.find({
-You can create a new attribute for a ticket type. +You can retrieve an external page.
@@ -7707,12 +11269,8 @@ You can create a new attribute for a ticket type.
```typescript -await client.ticketTypes.attributes.create({ - ticket_type_id: "ticket_type_id", - name: "Attribute Title", - description: "Attribute Description", - data_type: "string", - required_to_create: false, +await client.unstable.aiContent.getExternalPage({ + id: "id", }); ``` @@ -7729,7 +11287,7 @@ await client.ticketTypes.attributes.create({
-**request:** `Intercom.ticketTypes.CreateTicketTypeAttributeRequest` +**request:** `Intercom.unstable.GetExternalPageRequest`
@@ -7737,7 +11295,7 @@ await client.ticketTypes.attributes.create({
-**requestOptions:** `Attributes.RequestOptions` +**requestOptions:** `AiContent.RequestOptions`
@@ -7748,7 +11306,7 @@ await client.ticketTypes.attributes.create({
-
client.ticketTypes.attributes.update({ ...params }) -> Intercom.TicketTypeAttribute +
client.unstable.aiContent.updateExternalPage({ ...params }) -> Intercom.ExternalPage
@@ -7760,7 +11318,7 @@ await client.ticketTypes.attributes.create({
-You can update an existing attribute for a ticket type. +You can update an existing external page (if it was created via the API).
@@ -7776,10 +11334,13 @@ You can update an existing attribute for a ticket type.
```typescript -await client.ticketTypes.attributes.update({ - ticket_type_id: "ticket_type_id", - attribute_id: "attribute_id", - description: "New Attribute Description", +await client.unstable.aiContent.updateExternalPage({ + id: "id", + title: "Test", + html: "

Test

", + url: "https://www.example.com", + source_id: 47, + external_id: "5678", }); ``` @@ -7796,7 +11357,7 @@ await client.ticketTypes.attributes.update({
-**request:** `Intercom.ticketTypes.UpdateTicketTypeAttributeRequest` +**request:** `Intercom.unstable.UpdateExternalPageRequest`
@@ -7804,7 +11365,7 @@ await client.ticketTypes.attributes.update({
-**requestOptions:** `Attributes.RequestOptions` +**requestOptions:** `AiContent.RequestOptions`
@@ -7815,9 +11376,7 @@ await client.ticketTypes.attributes.update({
-## Admins - -
client.unstable.admins.identifyAdmin() -> Intercom.AdminWithApp | undefined +
client.unstable.aiContent.deleteExternalPage({ ...params }) -> Intercom.ExternalPage
@@ -7829,11 +11388,7 @@ await client.ticketTypes.attributes.update({
-You can view the currently authorised admin along with the embedded app object (a "workspace" in legacy terminology). - -> 🚧 Single Sign On -> -> If you are building a custom "Log in with Intercom" flow for your site, and you call the `/me` endpoint to identify the logged-in user, you should not accept any sign-ins from users with unverified email addresses as it poses a potential impersonation security risk. +Sending a DELETE request for an external page will remove it from the content library UI and from being used for AI answers.
@@ -7849,7 +11404,9 @@ You can view the currently authorised admin along with the embedded app object (
```typescript -await client.unstable.admins.identifyAdmin(); +await client.unstable.aiContent.deleteExternalPage({ + id: "id", +}); ```
@@ -7865,7 +11422,15 @@ await client.unstable.admins.identifyAdmin();
-**requestOptions:** `Admins.RequestOptions` +**request:** `Intercom.unstable.DeleteExternalPageRequest` + +
+
+ +
+
+ +**requestOptions:** `AiContent.RequestOptions`
@@ -7876,7 +11441,9 @@ await client.unstable.admins.identifyAdmin();
-
client.unstable.admins.setAwayAdmin({ ...params }) -> Intercom.Admin | undefined +## Articles + +
client.unstable.articles.listArticles() -> Intercom.ArticleList
@@ -7888,7 +11455,11 @@ await client.unstable.admins.identifyAdmin();
-You can set an Admin as away for the Inbox. +You can fetch a list of all articles by making a GET request to `https://api.intercom.io/articles`. + +> 📘 How are the articles sorted and ordered? +> +> Articles will be returned in descending order on the `updated_at` attribute. This means if you need to iterate through results then we'll show the most recently updated articles first.
@@ -7904,12 +11475,7 @@ You can set an Admin as away for the Inbox.
```typescript -await client.unstable.admins.setAwayAdmin({ - id: 1, - away_mode_enabled: true, - away_mode_reassign: true, - away_status_reason_id: 12345, -}); +await client.unstable.articles.listArticles(); ```
@@ -7925,15 +11491,7 @@ await client.unstable.admins.setAwayAdmin({
-**request:** `Intercom.unstable.SetAwayAdminRequest` - -
-
- -
-
- -**requestOptions:** `Admins.RequestOptions` +**requestOptions:** `Articles.RequestOptions`
@@ -7944,7 +11502,7 @@ await client.unstable.admins.setAwayAdmin({
-
client.unstable.admins.listActivityLogs({ ...params }) -> Intercom.ActivityLogList +
client.unstable.articles.createArticle({ ...params }) -> Intercom.Article
@@ -7956,7 +11514,7 @@ await client.unstable.admins.setAwayAdmin({
-You can get a log of activities by all admins in an app. +You can create a new article by making a POST request to `https://api.intercom.io/articles`.
@@ -7972,9 +11530,8 @@ You can get a log of activities by all admins in an app.
```typescript -await client.unstable.admins.listActivityLogs({ - created_at_after: "1677253093", - created_at_before: "1677861493", +await client.unstable.articles.createArticle({ + key: "value", }); ``` @@ -7991,7 +11548,7 @@ await client.unstable.admins.listActivityLogs({
-**request:** `Intercom.unstable.ListActivityLogsRequest` +**request:** `unknown`
@@ -7999,7 +11556,7 @@ await client.unstable.admins.listActivityLogs({
-**requestOptions:** `Admins.RequestOptions` +**requestOptions:** `Articles.RequestOptions`
@@ -8010,7 +11567,7 @@ await client.unstable.admins.listActivityLogs({
-
client.unstable.admins.listAdmins() -> Intercom.AdminList +
client.unstable.articles.retrieveArticle({ ...params }) -> Intercom.Article
@@ -8022,7 +11579,7 @@ await client.unstable.admins.listActivityLogs({
-You can fetch a list of admins for a given workspace. +You can fetch the details of a single article by making a GET request to `https://api.intercom.io/articles/`.
@@ -8038,7 +11595,9 @@ You can fetch a list of admins for a given workspace.
```typescript -await client.unstable.admins.listAdmins(); +await client.unstable.articles.retrieveArticle({ + id: 1, +}); ```
@@ -8054,7 +11613,15 @@ await client.unstable.admins.listAdmins();
-**requestOptions:** `Admins.RequestOptions` +**request:** `Intercom.unstable.RetrieveArticleRequest` + +
+
+ +
+
+ +**requestOptions:** `Articles.RequestOptions`
@@ -8065,7 +11632,7 @@ await client.unstable.admins.listAdmins();
-
client.unstable.admins.retrieveAdmin({ ...params }) -> Intercom.Admin | undefined +
client.unstable.articles.deleteArticle({ ...params }) -> Intercom.DeletedArticleObject
@@ -8077,7 +11644,7 @@ await client.unstable.admins.listAdmins();
-You can retrieve the details of a single admin. +You can delete a single article by making a DELETE request to `https://api.intercom.io/articles/`.
@@ -8093,7 +11660,7 @@ You can retrieve the details of a single admin.
```typescript -await client.unstable.admins.retrieveAdmin({ +await client.unstable.articles.deleteArticle({ id: 1, }); ``` @@ -8111,7 +11678,7 @@ await client.unstable.admins.retrieveAdmin({
-**request:** `Intercom.unstable.RetrieveAdminRequest` +**request:** `Intercom.unstable.DeleteArticleRequest`
@@ -8119,7 +11686,7 @@ await client.unstable.admins.retrieveAdmin({
-**requestOptions:** `Admins.RequestOptions` +**requestOptions:** `Articles.RequestOptions`
@@ -8130,9 +11697,7 @@ await client.unstable.admins.retrieveAdmin({
-## AI Content - -
client.unstable.aiContent.listContentImportSources() -> Intercom.ContentImportSourcesList +
client.unstable.articles.searchArticles({ ...params }) -> Intercom.ArticleSearchResponse
@@ -8144,7 +11709,7 @@ await client.unstable.admins.retrieveAdmin({
-You can retrieve a list of all content import sources for a workspace. +You can search for articles by making a GET request to `https://api.intercom.io/articles/search`.
@@ -8160,7 +11725,10 @@ You can retrieve a list of all content import sources for a workspace.
```typescript -await client.unstable.aiContent.listContentImportSources(); +await client.unstable.articles.searchArticles({ + phrase: "Getting started", + state: "published", +}); ```
@@ -8176,7 +11744,15 @@ await client.unstable.aiContent.listContentImportSources();
-**requestOptions:** `AiContent.RequestOptions` +**request:** `Intercom.unstable.SearchArticlesRequest` + +
+
+ +
+
+ +**requestOptions:** `Articles.RequestOptions`
@@ -8187,7 +11763,9 @@ await client.unstable.aiContent.listContentImportSources();
-
client.unstable.aiContent.createContentImportSource({ ...params }) -> Intercom.ContentImportSource +## Away Status Reasons + +
client.unstable.awayStatusReasons.listAwayStatusReasons() -> Intercom.AwayStatusReason[]
@@ -8199,7 +11777,7 @@ await client.unstable.aiContent.listContentImportSources();
-You can create a new content import source by sending a POST request to this endpoint. +Returns a list of all away status reasons configured for the workspace, including deleted ones.
@@ -8215,9 +11793,7 @@ You can create a new content import source by sending a POST request to this end
```typescript -await client.unstable.aiContent.createContentImportSource({ - url: "https://www.example.com", -}); +await client.unstable.awayStatusReasons.listAwayStatusReasons(); ```
@@ -8233,15 +11809,7 @@ await client.unstable.aiContent.createContentImportSource({
-**request:** `Intercom.unstable.CreateContentImportSourceRequest` - -
-
- -
-
- -**requestOptions:** `AiContent.RequestOptions` +**requestOptions:** `AwayStatusReasons.RequestOptions`
@@ -8252,7 +11820,9 @@ await client.unstable.aiContent.createContentImportSource({
-
client.unstable.aiContent.getContentImportSource({ ...params }) -> Intercom.ContentImportSource +## Unstable Export + +
client.unstable.export.enqueueANewReportingDataExportJob({ ...params }) -> Intercom.PostExportReportingDataEnqueueResponse
@@ -8265,8 +11835,11 @@ await client.unstable.aiContent.createContentImportSource({
```typescript -await client.unstable.aiContent.getContentImportSource({ - id: "id", +await client.unstable.export.enqueueANewReportingDataExportJob({ + dataset_id: "conversation", + attribute_ids: ["conversation_id", "conversation_started_at"], + start_time: 1717490000, + end_time: 1717510000, }); ``` @@ -8283,44 +11856,29 @@ await client.unstable.aiContent.getContentImportSource({
-**request:** `Intercom.unstable.GetContentImportSourceRequest` - -
-
- -
-
- -**requestOptions:** `AiContent.RequestOptions` - -
-
-
-
- - - -
- -
client.unstable.aiContent.updateContentImportSource({ ...params }) -> Intercom.ContentImportSource -
-
- -#### 📝 Description - -
-
- +**request:** `Intercom.unstable.PostExportReportingDataEnqueueRequest` + +
+
+
-You can update an existing content import source. +**requestOptions:** `Export.RequestOptions`
+ + +
+ +
client.unstable.export.listAvailableDatasetsAndAttributes() -> Intercom.GetExportReportingDataGetDatasetsResponse +
+
+ #### 🔌 Usage
@@ -8330,11 +11888,7 @@ You can update an existing content import source.
```typescript -await client.unstable.aiContent.updateContentImportSource({ - id: "id", - sync_behavior: "api", - url: "https://www.example.com", -}); +await client.unstable.export.listAvailableDatasetsAndAttributes(); ```
@@ -8350,15 +11904,7 @@ await client.unstable.aiContent.updateContentImportSource({
-**request:** `Intercom.unstable.UpdateContentImportSourceRequest` - -
-
- -
-
- -**requestOptions:** `AiContent.RequestOptions` +**requestOptions:** `Export.RequestOptions`
@@ -8369,7 +11915,9 @@ await client.unstable.aiContent.updateContentImportSource({
-
client.unstable.aiContent.deleteContentImportSource({ ...params }) -> void +## Help Center + +
client.unstable.helpCenter.listAllCollections() -> Intercom.CollectionList
@@ -8381,7 +11929,9 @@ await client.unstable.aiContent.updateContentImportSource({
-You can delete a content import source by making a DELETE request this endpoint. This will also delete all external pages that were imported from this source. +You can fetch a list of all collections by making a GET request to `https://api.intercom.io/help_center/collections`. + +Collections will be returned in descending order on the `updated_at` attribute. This means if you need to iterate through results then we'll show the most recently updated collections first.
@@ -8397,9 +11947,7 @@ You can delete a content import source by making a DELETE request this endpoint.
```typescript -await client.unstable.aiContent.deleteContentImportSource({ - id: "id", -}); +await client.unstable.helpCenter.listAllCollections(); ```
@@ -8415,15 +11963,7 @@ await client.unstable.aiContent.deleteContentImportSource({
-**request:** `Intercom.unstable.DeleteContentImportSourceRequest` - -
-
- -
-
- -**requestOptions:** `AiContent.RequestOptions` +**requestOptions:** `HelpCenter.RequestOptions`
@@ -8434,7 +11974,7 @@ await client.unstable.aiContent.deleteContentImportSource({
-
client.unstable.aiContent.listExternalPages() -> Intercom.ExternalPagesList +
client.unstable.helpCenter.createCollection({ ...params }) -> Intercom.Collection
@@ -8446,7 +11986,7 @@ await client.unstable.aiContent.deleteContentImportSource({
-You can retrieve a list of all external pages for a workspace. +You can create a new collection by making a POST request to `https://api.intercom.io/help_center/collections.`
@@ -8462,7 +12002,9 @@ You can retrieve a list of all external pages for a workspace.
```typescript -await client.unstable.aiContent.listExternalPages(); +await client.unstable.helpCenter.createCollection({ + name: "Thanks for everything", +}); ```
@@ -8478,7 +12020,15 @@ await client.unstable.aiContent.listExternalPages();
-**requestOptions:** `AiContent.RequestOptions` +**request:** `Intercom.unstable.CreateCollectionRequest` + +
+
+ +
+
+ +**requestOptions:** `HelpCenter.RequestOptions`
@@ -8489,7 +12039,7 @@ await client.unstable.aiContent.listExternalPages();
-
client.unstable.aiContent.createExternalPage({ ...params }) -> Intercom.ExternalPage +
client.unstable.helpCenter.retrieveCollection({ ...params }) -> Intercom.Collection
@@ -8501,7 +12051,7 @@ await client.unstable.aiContent.listExternalPages();
-You can create a new external page by sending a POST request to this endpoint. If an external page already exists with the specified source_id and external_id, it will be updated instead. +You can fetch the details of a single collection by making a GET request to `https://api.intercom.io/help_center/collections/`.
@@ -8517,12 +12067,8 @@ You can create a new external page by sending a POST request to this endpoint. I
```typescript -await client.unstable.aiContent.createExternalPage({ - title: "Test", - html: "

Test

", - url: "https://www.example.com", - source_id: 44, - external_id: "abc1234", +await client.unstable.helpCenter.retrieveCollection({ + id: 1, }); ``` @@ -8539,7 +12085,7 @@ await client.unstable.aiContent.createExternalPage({
-**request:** `Intercom.unstable.CreateExternalPageRequest` +**request:** `Intercom.unstable.RetrieveCollectionRequest`
@@ -8547,7 +12093,7 @@ await client.unstable.aiContent.createExternalPage({
-**requestOptions:** `AiContent.RequestOptions` +**requestOptions:** `HelpCenter.RequestOptions`
@@ -8558,7 +12104,7 @@ await client.unstable.aiContent.createExternalPage({
-
client.unstable.aiContent.getExternalPage({ ...params }) -> Intercom.ExternalPage +
client.unstable.helpCenter.updateCollection({ ...params }) -> Intercom.Collection
@@ -8570,7 +12116,7 @@ await client.unstable.aiContent.createExternalPage({
-You can retrieve an external page. +You can update the details of a single collection by making a PUT request to `https://api.intercom.io/collections/`.
@@ -8586,8 +12132,9 @@ You can retrieve an external page.
```typescript -await client.unstable.aiContent.getExternalPage({ - id: "id", +await client.unstable.helpCenter.updateCollection({ + id: 1, + name: "Update collection name", }); ``` @@ -8604,7 +12151,7 @@ await client.unstable.aiContent.getExternalPage({
-**request:** `Intercom.unstable.GetExternalPageRequest` +**request:** `Intercom.unstable.UpdateCollectionRequest`
@@ -8612,7 +12159,7 @@ await client.unstable.aiContent.getExternalPage({
-**requestOptions:** `AiContent.RequestOptions` +**requestOptions:** `HelpCenter.RequestOptions`
@@ -8623,7 +12170,7 @@ await client.unstable.aiContent.getExternalPage({
-
client.unstable.aiContent.updateExternalPage({ ...params }) -> Intercom.ExternalPage +
client.unstable.helpCenter.deleteCollection({ ...params }) -> Intercom.DeletedCollectionObject
@@ -8635,7 +12182,7 @@ await client.unstable.aiContent.getExternalPage({
-You can update an existing external page (if it was created via the API). +You can delete a single collection by making a DELETE request to `https://api.intercom.io/collections/`.
@@ -8651,13 +12198,8 @@ You can update an existing external page (if it was created via the API).
```typescript -await client.unstable.aiContent.updateExternalPage({ - id: "id", - title: "Test", - html: "

Test

", - url: "https://www.example.com", - source_id: 47, - external_id: "5678", +await client.unstable.helpCenter.deleteCollection({ + id: 1, }); ``` @@ -8674,7 +12216,7 @@ await client.unstable.aiContent.updateExternalPage({
-**request:** `Intercom.unstable.UpdateExternalPageRequest` +**request:** `Intercom.unstable.DeleteCollectionRequest`
@@ -8682,7 +12224,7 @@ await client.unstable.aiContent.updateExternalPage({
-**requestOptions:** `AiContent.RequestOptions` +**requestOptions:** `HelpCenter.RequestOptions`
@@ -8693,7 +12235,7 @@ await client.unstable.aiContent.updateExternalPage({
-
client.unstable.aiContent.deleteExternalPage({ ...params }) -> Intercom.ExternalPage +
client.unstable.helpCenter.retrieveHelpCenter({ ...params }) -> Intercom.HelpCenter
@@ -8705,7 +12247,7 @@ await client.unstable.aiContent.updateExternalPage({
-Sending a DELETE request for an external page will remove it from the content library UI and from being used for AI answers. +You can fetch the details of a single Help Center by making a GET request to `https://api.intercom.io/help_center/help_center/`.
@@ -8721,8 +12263,8 @@ Sending a DELETE request for an external page will remove it from the content li
```typescript -await client.unstable.aiContent.deleteExternalPage({ - id: "id", +await client.unstable.helpCenter.retrieveHelpCenter({ + id: 1, }); ``` @@ -8739,7 +12281,7 @@ await client.unstable.aiContent.deleteExternalPage({
-**request:** `Intercom.unstable.DeleteExternalPageRequest` +**request:** `Intercom.unstable.RetrieveHelpCenterRequest`
@@ -8747,7 +12289,7 @@ await client.unstable.aiContent.deleteExternalPage({
-**requestOptions:** `AiContent.RequestOptions` +**requestOptions:** `HelpCenter.RequestOptions`
@@ -8758,9 +12300,7 @@ await client.unstable.aiContent.deleteExternalPage({
-## Articles - -
client.unstable.articles.listArticles() -> Intercom.ArticleList +
client.unstable.helpCenter.listHelpCenters() -> Intercom.HelpCenterList
@@ -8772,11 +12312,7 @@ await client.unstable.aiContent.deleteExternalPage({
-You can fetch a list of all articles by making a GET request to `https://api.intercom.io/articles`. - -> 📘 How are the articles sorted and ordered? -> -> Articles will be returned in descending order on the `updated_at` attribute. This means if you need to iterate through results then we'll show the most recently updated articles first. +You can list all Help Centers by making a GET request to `https://api.intercom.io/help_center/help_centers`.
@@ -8792,7 +12328,7 @@ You can fetch a list of all articles by making a GET request to `https://api.int
```typescript -await client.unstable.articles.listArticles(); +await client.unstable.helpCenter.listHelpCenters(); ```
@@ -8808,7 +12344,7 @@ await client.unstable.articles.listArticles();
-**requestOptions:** `Articles.RequestOptions` +**requestOptions:** `HelpCenter.RequestOptions`
@@ -8819,7 +12355,9 @@ await client.unstable.articles.listArticles();
-
client.unstable.articles.createArticle({ ...params }) -> Intercom.Article +## Internal Articles + +
client.unstable.internalArticles.listInternalArticles() -> Intercom.InternalArticleList
@@ -8831,7 +12369,7 @@ await client.unstable.articles.listArticles();
-You can create a new article by making a POST request to `https://api.intercom.io/articles`. +You can fetch a list of all internal articles by making a GET request to `https://api.intercom.io/internal_articles`.
@@ -8847,9 +12385,7 @@ You can create a new article by making a POST request to `https://api.intercom.i
```typescript -await client.unstable.articles.createArticle({ - key: "value", -}); +await client.unstable.internalArticles.listInternalArticles(); ```
@@ -8865,15 +12401,7 @@ await client.unstable.articles.createArticle({
-**request:** `unknown` - -
-
- -
-
- -**requestOptions:** `Articles.RequestOptions` +**requestOptions:** `InternalArticles.RequestOptions`
@@ -8884,7 +12412,7 @@ await client.unstable.articles.createArticle({
-
client.unstable.articles.retrieveArticle({ ...params }) -> Intercom.Article +
client.unstable.internalArticles.createInternalArticle({ ...params }) -> Intercom.InternalArticle
@@ -8896,7 +12424,7 @@ await client.unstable.articles.createArticle({
-You can fetch the details of a single article by making a GET request to `https://api.intercom.io/articles/`. +You can create a new internal article by making a POST request to `https://api.intercom.io/internal_articles`.
@@ -8912,8 +12440,11 @@ You can fetch the details of a single article by making a GET request to `https:
```typescript -await client.unstable.articles.retrieveArticle({ - id: 1, +await client.unstable.internalArticles.createInternalArticle({ + title: "Thanks for everything", + body: "Body of the Article", + author_id: 991266252, + owner_id: 991266252, }); ``` @@ -8930,7 +12461,7 @@ await client.unstable.articles.retrieveArticle({
-**request:** `Intercom.unstable.RetrieveArticleRequest` +**request:** `Intercom.CreateInternalArticleRequest`
@@ -8938,7 +12469,7 @@ await client.unstable.articles.retrieveArticle({
-**requestOptions:** `Articles.RequestOptions` +**requestOptions:** `InternalArticles.RequestOptions`
@@ -8949,7 +12480,7 @@ await client.unstable.articles.retrieveArticle({
-
client.unstable.articles.deleteArticle({ ...params }) -> Intercom.DeletedArticleObject +
client.unstable.internalArticles.retrieveInternalArticle({ ...params }) -> Intercom.InternalArticle
@@ -8961,7 +12492,7 @@ await client.unstable.articles.retrieveArticle({
-You can delete a single article by making a DELETE request to `https://api.intercom.io/articles/`. +You can fetch the details of a single internal article by making a GET request to `https://api.intercom.io/internal_articles/`.
@@ -8977,7 +12508,7 @@ You can delete a single article by making a DELETE request to `https://api.inter
```typescript -await client.unstable.articles.deleteArticle({ +await client.unstable.internalArticles.retrieveInternalArticle({ id: 1, }); ``` @@ -8995,7 +12526,7 @@ await client.unstable.articles.deleteArticle({
-**request:** `Intercom.unstable.DeleteArticleRequest` +**request:** `Intercom.unstable.RetrieveInternalArticleRequest`
@@ -9003,7 +12534,7 @@ await client.unstable.articles.deleteArticle({
-**requestOptions:** `Articles.RequestOptions` +**requestOptions:** `InternalArticles.RequestOptions`
@@ -9014,7 +12545,7 @@ await client.unstable.articles.deleteArticle({
-
client.unstable.articles.searchArticles({ ...params }) -> Intercom.ArticleSearchResponse +
client.unstable.internalArticles.updateInternalArticle({ ...params }) -> Intercom.InternalArticle
@@ -9026,7 +12557,7 @@ await client.unstable.articles.deleteArticle({
-You can search for articles by making a GET request to `https://api.intercom.io/articles/search`. +You can update the details of a single internal article by making a PUT request to `https://api.intercom.io/internal_articles/`.
@@ -9042,9 +12573,10 @@ You can search for articles by making a GET request to `https://api.intercom.io/
```typescript -await client.unstable.articles.searchArticles({ - phrase: "Getting started", - state: "published", +await client.unstable.internalArticles.updateInternalArticle({ + id: 1, + title: "Christmas is here!", + body: "

New gifts in store for the jolly season

", }); ``` @@ -9061,7 +12593,7 @@ await client.unstable.articles.searchArticles({
-**request:** `Intercom.unstable.SearchArticlesRequest` +**request:** `Intercom.unstable.UpdateInternalArticleRequestBody`
@@ -9069,7 +12601,7 @@ await client.unstable.articles.searchArticles({
-**requestOptions:** `Articles.RequestOptions` +**requestOptions:** `InternalArticles.RequestOptions`
@@ -9080,9 +12612,7 @@ await client.unstable.articles.searchArticles({
-## Away Status Reasons - -
client.unstable.awayStatusReasons.listAwayStatusReasons() -> Intercom.AwayStatusReason[] +
client.unstable.internalArticles.deleteInternalArticle({ ...params }) -> Intercom.DeletedInternalArticleObject
@@ -9094,7 +12624,7 @@ await client.unstable.articles.searchArticles({
-Returns a list of all away status reasons configured for the workspace, including deleted ones. +You can delete a single internal article by making a DELETE request to `https://api.intercom.io/internal_articles/`.
@@ -9110,7 +12640,9 @@ Returns a list of all away status reasons configured for the workspace, includin
```typescript -await client.unstable.awayStatusReasons.listAwayStatusReasons(); +await client.unstable.internalArticles.deleteInternalArticle({ + id: 1, +}); ```
@@ -9126,76 +12658,44 @@ await client.unstable.awayStatusReasons.listAwayStatusReasons();
-**requestOptions:** `AwayStatusReasons.RequestOptions` - -
-
- -
+**request:** `Intercom.unstable.DeleteInternalArticleRequest` -
- -## Unstable Export - -
client.unstable.export.enqueueANewReportingDataExportJob({ ...params }) -> Intercom.PostExportReportingDataEnqueueResponse -
-
- -#### 🔌 Usage - -
-
-```typescript -await client.unstable.export.enqueueANewReportingDataExportJob({ - dataset_id: "conversation", - attribute_ids: ["conversation.id", "conversation.first_user_conversation_part_created_at"], - start_time: 1717490000, - end_time: 1717510000, -}); -``` +**requestOptions:** `InternalArticles.RequestOptions`
-#### ⚙️ Parameters +
+
+
+
client.unstable.internalArticles.searchInternalArticles({ ...params }) -> Intercom.InternalArticleSearchResponse
+#### 📝 Description +
-**request:** `Intercom.unstable.PostExportReportingDataEnqueueRequest` - -
-
-
-**requestOptions:** `Export.RequestOptions` +You can search for internal articles by making a GET request to `https://api.intercom.io/internal_articles/search`.
- - -
- -
client.unstable.export.listAvailableDatasetsAndAttributes() -> Intercom.GetExportReportingDataGetDatasetsResponse -
-
- #### 🔌 Usage
@@ -9205,7 +12705,7 @@ await client.unstable.export.enqueueANewReportingDataExportJob({
```typescript -await client.unstable.export.listAvailableDatasetsAndAttributes(); +await client.unstable.internalArticles.searchInternalArticles(); ```
@@ -9221,7 +12721,15 @@ await client.unstable.export.listAvailableDatasetsAndAttributes();
-**requestOptions:** `Export.RequestOptions` +**request:** `Intercom.unstable.SearchInternalArticlesRequest` + +
+
+ +
+
+ +**requestOptions:** `InternalArticles.RequestOptions`
@@ -9232,9 +12740,9 @@ await client.unstable.export.listAvailableDatasetsAndAttributes();
-## Help Center +## Companies -
client.unstable.helpCenter.listAllCollections() -> Intercom.CollectionList +
client.unstable.companies.retrieveCompany({ ...params }) -> Intercom.CompanyList
@@ -9243,12 +12751,20 @@ await client.unstable.export.listAvailableDatasetsAndAttributes();
-
-
+
+
+ +You can fetch a single company by passing in `company_id` or `name`. + +`https://api.intercom.io/companies?name={name}` + +`https://api.intercom.io/companies?company_id={company_id}` + +You can fetch all companies and filter by `segment_id` or `tag_id` as a query parameter. -You can fetch a list of all collections by making a GET request to `https://api.intercom.io/help_center/collections`. +`https://api.intercom.io/companies?tag_id={tag_id}` -Collections will be returned in descending order on the `updated_at` attribute. This means if you need to iterate through results then we'll show the most recently updated collections first. +`https://api.intercom.io/companies?segment_id={segment_id}`
@@ -9264,7 +12780,12 @@ Collections will be returned in descending order on the `updated_at` attribute.
```typescript -await client.unstable.helpCenter.listAllCollections(); +await client.unstable.companies.retrieveCompany({ + name: "my company", + company_id: "12345", + tag_id: "678910", + segment_id: "98765", +}); ```
@@ -9280,7 +12801,15 @@ await client.unstable.helpCenter.listAllCollections();
-**requestOptions:** `HelpCenter.RequestOptions` +**request:** `Intercom.unstable.RetrieveCompanyRequest` + +
+
+ +
+
+ +**requestOptions:** `Companies.RequestOptions`
@@ -9291,7 +12820,7 @@ await client.unstable.helpCenter.listAllCollections();
-
client.unstable.helpCenter.createCollection({ ...params }) -> Intercom.Collection +
client.unstable.companies.createOrUpdateCompany({ ...params }) -> Intercom.Company
@@ -9303,7 +12832,15 @@ await client.unstable.helpCenter.listAllCollections();
-You can create a new collection by making a POST request to `https://api.intercom.io/help_center/collections.` +You can create or update a company. + +Companies will be only visible in Intercom when there is at least one associated user. + +Companies are looked up via `company_id` in a `POST` request, if not found via `company_id`, the new company will be created, if found, that company will be updated. + +{% admonition type="warning" name="Using `company_id`" %} +You can set a unique `company_id` value when creating a company. However, it is not possible to update `company_id`. Be sure to set a unique value once upon creation of the company. +{% /admonition %}
@@ -9319,8 +12856,8 @@ You can create a new collection by making a POST request to `https://api.interco
```typescript -await client.unstable.helpCenter.createCollection({ - name: "Thanks for everything", +await client.unstable.companies.createOrUpdateCompany({ + key: "value", }); ``` @@ -9337,7 +12874,7 @@ await client.unstable.helpCenter.createCollection({
-**request:** `Intercom.unstable.CreateCollectionRequest` +**request:** `unknown`
@@ -9345,7 +12882,7 @@ await client.unstable.helpCenter.createCollection({
-**requestOptions:** `HelpCenter.RequestOptions` +**requestOptions:** `Companies.RequestOptions`
@@ -9356,7 +12893,7 @@ await client.unstable.helpCenter.createCollection({
-
client.unstable.helpCenter.retrieveCollection({ ...params }) -> Intercom.Collection +
client.unstable.companies.retrieveACompanyById({ ...params }) -> Intercom.Company
@@ -9368,7 +12905,7 @@ await client.unstable.helpCenter.createCollection({
-You can fetch the details of a single collection by making a GET request to `https://api.intercom.io/help_center/collections/`. +You can fetch a single company.
@@ -9384,8 +12921,8 @@ You can fetch the details of a single collection by making a GET request to `htt
```typescript -await client.unstable.helpCenter.retrieveCollection({ - id: 1, +await client.unstable.companies.retrieveACompanyById({ + id: "5f4d3c1c-7b1b-4d7d-a97e-6095715c6632", }); ``` @@ -9402,7 +12939,7 @@ await client.unstable.helpCenter.retrieveCollection({
-**request:** `Intercom.unstable.RetrieveCollectionRequest` +**request:** `Intercom.unstable.RetrieveACompanyByIdRequest`
@@ -9410,7 +12947,7 @@ await client.unstable.helpCenter.retrieveCollection({
-**requestOptions:** `HelpCenter.RequestOptions` +**requestOptions:** `Companies.RequestOptions`
@@ -9421,7 +12958,7 @@ await client.unstable.helpCenter.retrieveCollection({
-
client.unstable.helpCenter.updateCollection({ ...params }) -> Intercom.Collection +
client.unstable.companies.updateCompany({ ...params }) -> Intercom.Company
@@ -9433,7 +12970,11 @@ await client.unstable.helpCenter.retrieveCollection({
-You can update the details of a single collection by making a PUT request to `https://api.intercom.io/collections/`. +You can update a single company using the Intercom provisioned `id`. + +{% admonition type="warning" name="Using `company_id`" %} +When updating a company it is not possible to update `company_id`. This can only be set once upon creation of the company. +{% /admonition %}
@@ -9449,9 +12990,8 @@ You can update the details of a single collection by making a PUT request to `ht
```typescript -await client.unstable.helpCenter.updateCollection({ - id: 1, - name: "Update collection name", +await client.unstable.companies.updateCompany({ + id: "5f4d3c1c-7b1b-4d7d-a97e-6095715c6632", }); ``` @@ -9468,7 +13008,7 @@ await client.unstable.helpCenter.updateCollection({
-**request:** `Intercom.unstable.UpdateCollectionRequest` +**request:** `Intercom.unstable.UpdateCompanyRequest`
@@ -9476,7 +13016,7 @@ await client.unstable.helpCenter.updateCollection({
-**requestOptions:** `HelpCenter.RequestOptions` +**requestOptions:** `Companies.RequestOptions`
@@ -9487,7 +13027,7 @@ await client.unstable.helpCenter.updateCollection({
-
client.unstable.helpCenter.deleteCollection({ ...params }) -> Intercom.DeletedCollectionObject +
client.unstable.companies.deleteCompany({ ...params }) -> Intercom.DeletedCompanyObject
@@ -9499,7 +13039,7 @@ await client.unstable.helpCenter.updateCollection({
-You can delete a single collection by making a DELETE request to `https://api.intercom.io/collections/`. +You can delete a single company.
@@ -9515,8 +13055,8 @@ You can delete a single collection by making a DELETE request to `https://api.in
```typescript -await client.unstable.helpCenter.deleteCollection({ - id: 1, +await client.unstable.companies.deleteCompany({ + id: "5f4d3c1c-7b1b-4d7d-a97e-6095715c6632", }); ``` @@ -9533,7 +13073,7 @@ await client.unstable.helpCenter.deleteCollection({
-**request:** `Intercom.unstable.DeleteCollectionRequest` +**request:** `Intercom.unstable.DeleteCompanyRequest`
@@ -9541,7 +13081,7 @@ await client.unstable.helpCenter.deleteCollection({
-**requestOptions:** `HelpCenter.RequestOptions` +**requestOptions:** `Companies.RequestOptions`
@@ -9552,7 +13092,7 @@ await client.unstable.helpCenter.deleteCollection({
-
client.unstable.helpCenter.retrieveHelpCenter({ ...params }) -> Intercom.HelpCenter +
client.unstable.companies.listAttachedContacts({ ...params }) -> Intercom.CompanyAttachedContacts
@@ -9564,7 +13104,7 @@ await client.unstable.helpCenter.deleteCollection({
-You can fetch the details of a single Help Center by making a GET request to `https://api.intercom.io/help_center/help_center/`. +You can fetch a list of all contacts that belong to a company.
@@ -9580,8 +13120,8 @@ You can fetch the details of a single Help Center by making a GET request to `ht
```typescript -await client.unstable.helpCenter.retrieveHelpCenter({ - id: 1, +await client.unstable.companies.listAttachedContacts({ + id: "5f4d3c1c-7b1b-4d7d-a97e-6095715c6632", }); ``` @@ -9598,7 +13138,7 @@ await client.unstable.helpCenter.retrieveHelpCenter({
-**request:** `Intercom.unstable.RetrieveHelpCenterRequest` +**request:** `Intercom.unstable.ListAttachedContactsRequest`
@@ -9606,7 +13146,7 @@ await client.unstable.helpCenter.retrieveHelpCenter({
-**requestOptions:** `HelpCenter.RequestOptions` +**requestOptions:** `Companies.RequestOptions`
@@ -9617,7 +13157,7 @@ await client.unstable.helpCenter.retrieveHelpCenter({
-
client.unstable.helpCenter.listHelpCenters() -> Intercom.HelpCenterList +
client.unstable.companies.listAttachedSegmentsForCompanies({ ...params }) -> Intercom.CompanyAttachedSegments
@@ -9629,7 +13169,7 @@ await client.unstable.helpCenter.retrieveHelpCenter({
-You can list all Help Centers by making a GET request to `https://api.intercom.io/help_center/help_centers`. +You can fetch a list of all segments that belong to a company.
@@ -9645,7 +13185,9 @@ You can list all Help Centers by making a GET request to `https://api.intercom.i
```typescript -await client.unstable.helpCenter.listHelpCenters(); +await client.unstable.companies.listAttachedSegmentsForCompanies({ + id: "5f4d3c1c-7b1b-4d7d-a97e-6095715c6632", +}); ```
@@ -9661,7 +13203,15 @@ await client.unstable.helpCenter.listHelpCenters();
-**requestOptions:** `HelpCenter.RequestOptions` +**request:** `Intercom.unstable.ListAttachedSegmentsForCompaniesRequest` + +
+
+ +
+
+ +**requestOptions:** `Companies.RequestOptions`
@@ -9672,9 +13222,7 @@ await client.unstable.helpCenter.listHelpCenters();
-## Companies - -
client.unstable.companies.retrieveCompany({ ...params }) -> Intercom.CompanyList +
client.unstable.companies.listAllCompanies({ ...params }) -> Intercom.CompanyList
@@ -9686,17 +13234,15 @@ await client.unstable.helpCenter.listHelpCenters();
-You can fetch a single company by passing in `company_id` or `name`. - -`https://api.intercom.io/companies?name={name}` - -`https://api.intercom.io/companies?company_id={company_id}` - -You can fetch all companies and filter by `segment_id` or `tag_id` as a query parameter. +You can list companies. The company list is sorted by the `last_request_at` field and by default is ordered descending, most recently requested first. -`https://api.intercom.io/companies?tag_id={tag_id}` +Note that the API does not include companies who have no associated users in list responses. -`https://api.intercom.io/companies?segment_id={segment_id}` +When using the Companies endpoint and the pages object to iterate through the returned companies, there is a limit of 10,000 Companies that can be returned. If you need to list or iterate on more than 10,000 Companies, please use the [Scroll API](https://developers.intercom.com/reference#iterating-over-all-companies). +{% admonition type="warning" name="Pagination" %} +You can use pagination to limit the number of results returned. The default is `20` results per page. +See the [pagination section](https://developers.intercom.com/docs/build-an-integration/learn-more/rest-apis/pagination/#pagination-for-list-apis) for more details on how to use the `starting_after` param. +{% /admonition %}
@@ -9712,11 +13258,8 @@ You can fetch all companies and filter by `segment_id` or `tag_id` as a query pa
```typescript -await client.unstable.companies.retrieveCompany({ - name: "my company", - company_id: "12345", - tag_id: "678910", - segment_id: "98765", +await client.unstable.companies.listAllCompanies({ + order: "desc", }); ``` @@ -9733,7 +13276,7 @@ await client.unstable.companies.retrieveCompany({
-**request:** `Intercom.unstable.RetrieveCompanyRequest` +**request:** `Intercom.unstable.ListAllCompaniesRequest`
@@ -9752,7 +13295,7 @@ await client.unstable.companies.retrieveCompany({
-
client.unstable.companies.createOrUpdateCompany({ ...params }) -> Intercom.Company +
client.unstable.companies.scrollOverAllCompanies({ ...params }) -> Intercom.CompanyScroll | undefined
@@ -9764,14 +13307,20 @@ await client.unstable.companies.retrieveCompany({
-You can create or update a company. - -Companies will be only visible in Intercom when there is at least one associated user. + The `list all companies` functionality does not work well for huge datasets, and can result in errors and performance problems when paging deeply. The Scroll API provides an efficient mechanism for iterating over all companies in a dataset. -Companies are looked up via `company_id` in a `POST` request, if not found via `company_id`, the new company will be created, if found, that company will be updated. +- Each app can only have 1 scroll open at a time. You'll get an error message if you try to have more than one open per app. +- If the scroll isn't used for 1 minute, it expires and calls with that scroll param will fail +- If the end of the scroll is reached, "companies" will be empty and the scroll parameter will expire -{% admonition type="warning" name="Using `company_id`" %} -You can set a unique `company_id` value when creating a company. However, it is not possible to update `company_id`. Be sure to set a unique value once upon creation of the company. +{% admonition type="info" name="Scroll Parameter" %} +You can get the first page of companies by simply sending a GET request to the scroll endpoint. +For subsequent requests you will need to use the scroll parameter from the response. +{% /admonition %} +{% admonition type="danger" name="Scroll network timeouts" %} +Since scroll is often used on large datasets network errors such as timeouts can be encountered. When this occurs you will see a HTTP 500 error with the following message: +"Request failed due to an internal network error. Please restart the scroll operation." +If this happens, you will need to restart your scroll query: It is not possible to continue from a specific point when using scroll. {% /admonition %}
@@ -9788,9 +13337,7 @@ You can set a unique `company_id` value when creating a company. However, it is
```typescript -await client.unstable.companies.createOrUpdateCompany({ - key: "value", -}); +await client.unstable.companies.scrollOverAllCompanies(); ```
@@ -9806,7 +13353,7 @@ await client.unstable.companies.createOrUpdateCompany({
-**request:** `unknown` +**request:** `Intercom.unstable.ScrollOverAllCompaniesRequest`
@@ -9825,7 +13372,7 @@ await client.unstable.companies.createOrUpdateCompany({
-
client.unstable.companies.retrieveACompanyById({ ...params }) -> Intercom.Company +
client.unstable.companies.attachContactToACompany({ ...params }) -> Intercom.Company
@@ -9837,7 +13384,7 @@ await client.unstable.companies.createOrUpdateCompany({
-You can fetch a single company. +You can attach a company to a single contact.
@@ -9853,8 +13400,9 @@ You can fetch a single company.
```typescript -await client.unstable.companies.retrieveACompanyById({ - id: "5f4d3c1c-7b1b-4d7d-a97e-6095715c6632", +await client.unstable.companies.attachContactToACompany({ + id: "id", + company_id: "6762f09a1bb69f9f2193bb34", }); ``` @@ -9871,7 +13419,7 @@ await client.unstable.companies.retrieveACompanyById({
-**request:** `Intercom.unstable.RetrieveACompanyByIdRequest` +**request:** `Intercom.unstable.AttachContactToACompanyRequest`
@@ -9890,7 +13438,7 @@ await client.unstable.companies.retrieveACompanyById({
-
client.unstable.companies.updateCompany({ ...params }) -> Intercom.Company +
client.unstable.companies.detachContactFromACompany({ ...params }) -> Intercom.Company
@@ -9902,11 +13450,7 @@ await client.unstable.companies.retrieveACompanyById({
-You can update a single company using the Intercom provisioned `id`. - -{% admonition type="warning" name="Using `company_id`" %} -When updating a company it is not possible to update `company_id`. This can only be set once upon creation of the company. -{% /admonition %} +You can detach a company from a single contact.
@@ -9922,8 +13466,9 @@ When updating a company it is not possible to update `company_id`. This can only
```typescript -await client.unstable.companies.updateCompany({ - id: "5f4d3c1c-7b1b-4d7d-a97e-6095715c6632", +await client.unstable.companies.detachContactFromACompany({ + contact_id: "58a430d35458202d41b1e65b", + id: "58a430d35458202d41b1e65b", }); ``` @@ -9940,7 +13485,7 @@ await client.unstable.companies.updateCompany({
-**request:** `Intercom.unstable.UpdateCompanyRequest` +**request:** `Intercom.unstable.DetachContactFromACompanyRequest`
@@ -9959,7 +13504,9 @@ await client.unstable.companies.updateCompany({
-
client.unstable.companies.deleteCompany({ ...params }) -> Intercom.DeletedCompanyObject +## Contacts + +
client.unstable.contacts.listCompaniesForAContact({ ...params }) -> Intercom.ContactAttachedCompanies
@@ -9971,7 +13518,7 @@ await client.unstable.companies.updateCompany({
-You can delete a single company. +You can fetch a list of companies that are associated to a contact.
@@ -9987,8 +13534,8 @@ You can delete a single company.
```typescript -await client.unstable.companies.deleteCompany({ - id: "5f4d3c1c-7b1b-4d7d-a97e-6095715c6632", +await client.unstable.contacts.listCompaniesForAContact({ + id: "63a07ddf05a32042dffac965", }); ``` @@ -10005,7 +13552,7 @@ await client.unstable.companies.deleteCompany({
-**request:** `Intercom.unstable.DeleteCompanyRequest` +**request:** `Intercom.unstable.ListCompaniesForAContactRequest`
@@ -10013,7 +13560,7 @@ await client.unstable.companies.deleteCompany({
-**requestOptions:** `Companies.RequestOptions` +**requestOptions:** `Contacts.RequestOptions`
@@ -10024,7 +13571,7 @@ await client.unstable.companies.deleteCompany({
-
client.unstable.companies.listAttachedContacts({ ...params }) -> Intercom.CompanyAttachedContacts +
client.unstable.contacts.listSegmentsForAContact({ ...params }) -> Intercom.ContactSegments
@@ -10036,7 +13583,7 @@ await client.unstable.companies.deleteCompany({
-You can fetch a list of all contacts that belong to a company. +You can fetch a list of segments that are associated to a contact.
@@ -10052,8 +13599,8 @@ You can fetch a list of all contacts that belong to a company.
```typescript -await client.unstable.companies.listAttachedContacts({ - id: "5f4d3c1c-7b1b-4d7d-a97e-6095715c6632", +await client.unstable.contacts.listSegmentsForAContact({ + contact_id: "63a07ddf05a32042dffac965", }); ``` @@ -10070,7 +13617,7 @@ await client.unstable.companies.listAttachedContacts({
-**request:** `Intercom.unstable.ListAttachedContactsRequest` +**request:** `Intercom.unstable.ListSegmentsForAContactRequest`
@@ -10078,7 +13625,7 @@ await client.unstable.companies.listAttachedContacts({
-**requestOptions:** `Companies.RequestOptions` +**requestOptions:** `Contacts.RequestOptions`
@@ -10089,7 +13636,7 @@ await client.unstable.companies.listAttachedContacts({
-
client.unstable.companies.listAttachedSegmentsForCompanies({ ...params }) -> Intercom.CompanyAttachedSegments +
client.unstable.contacts.listSubscriptionsForAContact({ ...params }) -> Intercom.SubscriptionTypeList
@@ -10101,7 +13648,13 @@ await client.unstable.companies.listAttachedContacts({
-You can fetch a list of all segments that belong to a company. +You can fetch a list of subscription types that are attached to a contact. These can be subscriptions that a user has 'opted-in' to or has 'opted-out' from, depending on the subscription type. +This will return a list of Subscription Type objects that the contact is associated with. + +The data property will show a combined list of: + +1.Opt-out subscription types that the user has opted-out from. +2.Opt-in subscription types that the user has opted-in to receiving.
@@ -10117,8 +13670,8 @@ You can fetch a list of all segments that belong to a company.
```typescript -await client.unstable.companies.listAttachedSegmentsForCompanies({ - id: "5f4d3c1c-7b1b-4d7d-a97e-6095715c6632", +await client.unstable.contacts.listSubscriptionsForAContact({ + contact_id: "63a07ddf05a32042dffac965", }); ``` @@ -10135,7 +13688,7 @@ await client.unstable.companies.listAttachedSegmentsForCompanies({
-**request:** `Intercom.unstable.ListAttachedSegmentsForCompaniesRequest` +**request:** `Intercom.unstable.ListSubscriptionsForAContactRequest`
@@ -10143,7 +13696,7 @@ await client.unstable.companies.listAttachedSegmentsForCompanies({
-**requestOptions:** `Companies.RequestOptions` +**requestOptions:** `Contacts.RequestOptions`
@@ -10154,7 +13707,7 @@ await client.unstable.companies.listAttachedSegmentsForCompanies({
-
client.unstable.companies.listAllCompanies({ ...params }) -> Intercom.CompanyList +
client.unstable.contacts.listTagsForAContact({ ...params }) -> Intercom.TagList
@@ -10166,15 +13719,7 @@ await client.unstable.companies.listAttachedSegmentsForCompanies({
-You can list companies. The company list is sorted by the `last_request_at` field and by default is ordered descending, most recently requested first. - -Note that the API does not include companies who have no associated users in list responses. - -When using the Companies endpoint and the pages object to iterate through the returned companies, there is a limit of 10,000 Companies that can be returned. If you need to list or iterate on more than 10,000 Companies, please use the [Scroll API](https://developers.intercom.com/reference#iterating-over-all-companies). -{% admonition type="warning" name="Pagination" %} -You can use pagination to limit the number of results returned. The default is `20` results per page. -See the [pagination section](https://developers.intercom.com/docs/build-an-integration/learn-more/rest-apis/pagination/#pagination-for-list-apis) for more details on how to use the `starting_after` param. -{% /admonition %} +You can fetch a list of all tags that are attached to a specific contact.
@@ -10189,9 +13734,9 @@ See the [pagination section](https://developers.intercom.com/docs/build-an-integ
-```typescript -await client.unstable.companies.listAllCompanies({ - order: "desc", +```typescript +await client.unstable.contacts.listTagsForAContact({ + contact_id: "63a07ddf05a32042dffac965", }); ``` @@ -10208,7 +13753,7 @@ await client.unstable.companies.listAllCompanies({
-**request:** `Intercom.unstable.ListAllCompaniesRequest` +**request:** `Intercom.unstable.ListTagsForAContactRequest`
@@ -10216,7 +13761,7 @@ await client.unstable.companies.listAllCompanies({
-**requestOptions:** `Companies.RequestOptions` +**requestOptions:** `Contacts.RequestOptions`
@@ -10227,7 +13772,7 @@ await client.unstable.companies.listAllCompanies({
-
client.unstable.companies.scrollOverAllCompanies({ ...params }) -> Intercom.CompanyScroll | undefined +
client.unstable.contacts.showContact({ ...params }) -> Intercom.ShowContactResponse
@@ -10239,21 +13784,7 @@ await client.unstable.companies.listAllCompanies({
- The `list all companies` functionality does not work well for huge datasets, and can result in errors and performance problems when paging deeply. The Scroll API provides an efficient mechanism for iterating over all companies in a dataset. - -- Each app can only have 1 scroll open at a time. You'll get an error message if you try to have more than one open per app. -- If the scroll isn't used for 1 minute, it expires and calls with that scroll param will fail -- If the end of the scroll is reached, "companies" will be empty and the scroll parameter will expire - -{% admonition type="info" name="Scroll Parameter" %} -You can get the first page of companies by simply sending a GET request to the scroll endpoint. -For subsequent requests you will need to use the scroll parameter from the response. -{% /admonition %} -{% admonition type="danger" name="Scroll network timeouts" %} -Since scroll is often used on large datasets network errors such as timeouts can be encountered. When this occurs you will see a HTTP 500 error with the following message: -"Request failed due to an internal network error. Please restart the scroll operation." -If this happens, you will need to restart your scroll query: It is not possible to continue from a specific point when using scroll. -{% /admonition %} +You can fetch the details of a single contact.
@@ -10269,7 +13800,9 @@ If this happens, you will need to restart your scroll query: It is not possible
```typescript -await client.unstable.companies.scrollOverAllCompanies(); +await client.unstable.contacts.showContact({ + id: "63a07ddf05a32042dffac965", +}); ```
@@ -10285,7 +13818,7 @@ await client.unstable.companies.scrollOverAllCompanies();
-**request:** `Intercom.unstable.ScrollOverAllCompaniesRequest` +**request:** `Intercom.unstable.ShowContactRequest`
@@ -10293,7 +13826,7 @@ await client.unstable.companies.scrollOverAllCompanies();
-**requestOptions:** `Companies.RequestOptions` +**requestOptions:** `Contacts.RequestOptions`
@@ -10304,7 +13837,7 @@ await client.unstable.companies.scrollOverAllCompanies();
-
client.unstable.companies.attachContactToACompany({ ...params }) -> Intercom.Company +
client.unstable.contacts.updateContact({ ...params }) -> Intercom.UpdateContactResponse
@@ -10316,7 +13849,13 @@ await client.unstable.companies.scrollOverAllCompanies();
-You can attach a company to a single contact. +You can update an existing contact (ie. user or lead). + +{% admonition type="info" %} +This endpoint handles both **contact updates** and **custom object associations**. + +See _`update a contact with an association to a custom object instance`_ in the request/response examples to see the custom object association format. +{% /admonition %}
@@ -10332,9 +13871,10 @@ You can attach a company to a single contact.
```typescript -await client.unstable.companies.attachContactToACompany({ - id: "id", - company_id: "6762f09a1bb69f9f2193bb34", +await client.unstable.contacts.updateContact({ + id: "63a07ddf05a32042dffac965", + email: "joebloggs@intercom.io", + name: "joe bloggs", }); ``` @@ -10351,7 +13891,7 @@ await client.unstable.companies.attachContactToACompany({
-**request:** `Intercom.unstable.AttachContactToACompanyRequest` +**request:** `Intercom.unstable.UpdateContactRequest`
@@ -10359,7 +13899,7 @@ await client.unstable.companies.attachContactToACompany({
-**requestOptions:** `Companies.RequestOptions` +**requestOptions:** `Contacts.RequestOptions`
@@ -10370,7 +13910,7 @@ await client.unstable.companies.attachContactToACompany({
-
client.unstable.companies.detachContactFromACompany({ ...params }) -> Intercom.Company +
client.unstable.contacts.deleteContact({ ...params }) -> Intercom.ContactDeleted
@@ -10382,7 +13922,7 @@ await client.unstable.companies.attachContactToACompany({
-You can detach a company from a single contact. +You can delete a single contact.
@@ -10398,9 +13938,8 @@ You can detach a company from a single contact.
```typescript -await client.unstable.companies.detachContactFromACompany({ - contact_id: "58a430d35458202d41b1e65b", - id: "58a430d35458202d41b1e65b", +await client.unstable.contacts.deleteContact({ + id: "id", }); ``` @@ -10417,7 +13956,7 @@ await client.unstable.companies.detachContactFromACompany({
-**request:** `Intercom.unstable.DetachContactFromACompanyRequest` +**request:** `Intercom.unstable.DeleteContactRequest`
@@ -10425,7 +13964,7 @@ await client.unstable.companies.detachContactFromACompany({
-**requestOptions:** `Companies.RequestOptions` +**requestOptions:** `Contacts.RequestOptions`
@@ -10436,9 +13975,7 @@ await client.unstable.companies.detachContactFromACompany({
-## Contacts - -
client.unstable.contacts.listCompaniesForAContact({ ...params }) -> Intercom.ContactAttachedCompanies +
client.unstable.contacts.mergeContact({ ...params }) -> Intercom.MergeContactResponse
@@ -10450,7 +13987,7 @@ await client.unstable.companies.detachContactFromACompany({
-You can fetch a list of companies that are associated to a contact. +You can merge a contact with a `role` of `lead` into a contact with a `role` of `user`.
@@ -10466,8 +14003,9 @@ You can fetch a list of companies that are associated to a contact.
```typescript -await client.unstable.contacts.listCompaniesForAContact({ - id: "63a07ddf05a32042dffac965", +await client.unstable.contacts.mergeContact({ + from: "6762f0d51bb69f9f2193bb7f", + into: "6762f0d51bb69f9f2193bb80", }); ``` @@ -10484,7 +14022,7 @@ await client.unstable.contacts.listCompaniesForAContact({
-**request:** `Intercom.unstable.ListCompaniesForAContactRequest` +**request:** `Intercom.unstable.MergeContactsRequest`
@@ -10503,7 +14041,7 @@ await client.unstable.contacts.listCompaniesForAContact({
-
client.unstable.contacts.listSegmentsForAContact({ ...params }) -> Intercom.ContactSegments +
client.unstable.contacts.searchContacts({ ...params }) -> Intercom.ContactList
@@ -10515,7 +14053,108 @@ await client.unstable.contacts.listCompaniesForAContact({
-You can fetch a list of segments that are associated to a contact. +You can search for multiple contacts by the value of their attributes in order to fetch exactly who you want. + +To search for contacts, you need to send a `POST` request to `https://api.intercom.io/contacts/search`. + +This will accept a query object in the body which will define your filters in order to search for contacts. + +{% admonition type="warning" name="Optimizing search queries" %} +Search queries can be complex, so optimizing them can help the performance of your search. +Use the `AND` and `OR` operators to combine multiple filters to get the exact results you need and utilize +pagination to limit the number of results returned. The default is `50` results per page. +See the [pagination section](https://developers.intercom.com/docs/build-an-integration/learn-more/rest-apis/pagination/#example-search-conversations-request) for more details on how to use the `starting_after` param. +{% /admonition %} + +### Contact Creation Delay + +If a contact has recently been created, there is a possibility that it will not yet be available when searching. This means that it may not appear in the response. This delay can take a few minutes. If you need to be instantly notified it is recommended to use webhooks and iterate to see if they match your search filters. + +### Nesting & Limitations + +You can nest these filters in order to get even more granular insights that pinpoint exactly what you need. Example: (1 OR 2) AND (3 OR 4). +There are some limitations to the amount of multiple's there can be: + +- There's a limit of max 2 nested filters +- There's a limit of max 15 filters for each AND or OR group + +### Searching for Timestamp Fields + +All timestamp fields (created_at, updated_at etc.) are indexed as Dates for Contact Search queries; Datetime queries are not currently supported. This means you can only query for timestamp fields by day - not hour, minute or second. +For example, if you search for all Contacts with a created_at value greater (>) than 1577869200 (the UNIX timestamp for January 1st, 2020 9:00 AM), that will be interpreted as 1577836800 (January 1st, 2020 12:00 AM). The search results will then include Contacts created from January 2nd, 2020 12:00 AM onwards. +If you'd like to get contacts created on January 1st, 2020 you should search with a created_at value equal (=) to 1577836800 (January 1st, 2020 12:00 AM). +This behaviour applies only to timestamps used in search queries. The search results will still contain the full UNIX timestamp and be sorted accordingly. + +### Accepted Fields + +Most key listed as part of the Contacts Model are searchable, whether writeable or not. The value you search for has to match the accepted type, otherwise the query will fail (ie. as `created_at` accepts a date, the `value` cannot be a string such as `"foorbar"`). + +| Field | Type | +| ---------------------------------- | ------------------------------ | +| id | String | +| role | String
Accepts user or lead | +| name | String | +| avatar | String | +| owner_id | Integer | +| email | String | +| email_domain | String | +| phone | String | +| formatted_phone | String | +| external_id | String | +| created_at | Date (UNIX Timestamp) | +| signed_up_at | Date (UNIX Timestamp) | +| updated_at | Date (UNIX Timestamp) | +| last_seen_at | Date (UNIX Timestamp) | +| last_contacted_at | Date (UNIX Timestamp) | +| last_replied_at | Date (UNIX Timestamp) | +| last_email_opened_at | Date (UNIX Timestamp) | +| last_email_clicked_at | Date (UNIX Timestamp) | +| language_override | String | +| browser | String | +| browser_language | String | +| os | String | +| location.country | String | +| location.region | String | +| location.city | String | +| unsubscribed_from_emails | Boolean | +| marked_email_as_spam | Boolean | +| has_hard_bounced | Boolean | +| ios_last_seen_at | Date (UNIX Timestamp) | +| ios_app_version | String | +| ios_device | String | +| ios_app_device | String | +| ios_os_version | String | +| ios_app_name | String | +| ios_sdk_version | String | +| android_last_seen_at | Date (UNIX Timestamp) | +| android_app_version | String | +| android_device | String | +| android_app_name | String | +| andoid_sdk_version | String | +| segment_id | String | +| tag_id | String | +| custom_attributes.{attribute_name} | String | + +### Accepted Operators + +{% admonition type="warning" name="Searching based on `created_at`" %} +You cannot use the `<=` or `>=` operators to search by `created_at`. +{% /admonition %} + +The table below shows the operators you can use to define how you want to search for the value. The operator should be put in as a string (`"="`). The operator has to be compatible with the field's type (eg. you cannot search with `>` for a given string value as it's only compatible for integer's and dates). + +| Operator | Valid Types | Description | +| :------- | :------------------------------- | :--------------------------------------------------------------- | +| = | All | Equals | +| != | All | Doesn't Equal | +| IN | All | In
Shortcut for `OR` queries
Values must be in Array | +| NIN | All | Not In
Shortcut for `OR !` queries
Values must be in Array | +| > | Integer
Date (UNIX Timestamp) | Greater than | +| < | Integer
Date (UNIX Timestamp) | Lower than | +| ~ | String | Contains | +| !~ | String | Doesn't Contain | +| ^ | String | Starts With | +| $ | String | Ends With |
@@ -10531,8 +14170,20 @@ You can fetch a list of segments that are associated to a contact.
```typescript -await client.unstable.contacts.listSegmentsForAContact({ - contact_id: "63a07ddf05a32042dffac965", +await client.unstable.contacts.searchContacts({ + query: { + operator: "AND", + value: [ + { + field: "created_at", + operator: ">", + value: "1306054154", + }, + ], + }, + pagination: { + per_page: 5, + }, }); ``` @@ -10549,7 +14200,7 @@ await client.unstable.contacts.listSegmentsForAContact({
-**request:** `Intercom.unstable.ListSegmentsForAContactRequest` +**request:** `Intercom.SearchRequest`
@@ -10568,7 +14219,7 @@ await client.unstable.contacts.listSegmentsForAContact({
-
client.unstable.contacts.listSubscriptionsForAContact({ ...params }) -> Intercom.SubscriptionTypeList +
client.unstable.contacts.listContacts() -> Intercom.ContactList
@@ -10580,13 +14231,11 @@ await client.unstable.contacts.listSegmentsForAContact({
-You can fetch a list of subscription types that are attached to a contact. These can be subscriptions that a user has 'opted-in' to or has 'opted-out' from, depending on the subscription type. -This will return a list of Subscription Type objects that the contact is associated with. - -The data property will show a combined list of: - -1.Opt-out subscription types that the user has opted-out from. -2.Opt-in subscription types that the user has opted-in to receiving. +You can fetch a list of all contacts (ie. users or leads) in your workspace. +{% admonition type="warning" name="Pagination" %} +You can use pagination to limit the number of results returned. The default is `50` results per page. +See the [pagination section](https://developers.intercom.com/docs/build-an-integration/learn-more/rest-apis/pagination/#pagination-for-list-apis) for more details on how to use the `starting_after` param. +{% /admonition %}
@@ -10602,9 +14251,7 @@ The data property will show a combined list of:
```typescript -await client.unstable.contacts.listSubscriptionsForAContact({ - contact_id: "63a07ddf05a32042dffac965", -}); +await client.unstable.contacts.listContacts(); ```
@@ -10620,14 +14267,6 @@ await client.unstable.contacts.listSubscriptionsForAContact({
-**request:** `Intercom.unstable.ListSubscriptionsForAContactRequest` - -
-
- -
-
- **requestOptions:** `Contacts.RequestOptions`
@@ -10639,7 +14278,7 @@ await client.unstable.contacts.listSubscriptionsForAContact({
-
client.unstable.contacts.listTagsForAContact({ ...params }) -> Intercom.TagList +
client.unstable.contacts.createContact({ ...params }) -> Intercom.CreateContactResponse
@@ -10651,7 +14290,7 @@ await client.unstable.contacts.listSubscriptionsForAContact({
-You can fetch a list of all tags that are attached to a specific contact. +You can create a new contact (ie. user or lead).
@@ -10667,8 +14306,8 @@ You can fetch a list of all tags that are attached to a specific contact.
```typescript -await client.unstable.contacts.listTagsForAContact({ - contact_id: "63a07ddf05a32042dffac965", +await client.unstable.contacts.createContact({ + email: "joebloggs@intercom.io", }); ``` @@ -10685,7 +14324,7 @@ await client.unstable.contacts.listTagsForAContact({
-**request:** `Intercom.unstable.ListTagsForAContactRequest` +**request:** `Intercom.CreateContactRequestTwo`
@@ -10704,7 +14343,7 @@ await client.unstable.contacts.listTagsForAContact({
-
client.unstable.contacts.showContact({ ...params }) -> Intercom.ShowContactResponse +
client.unstable.contacts.showContactByExternalId({ ...params }) -> Intercom.ShowContactByExternalIdResponse
@@ -10716,7 +14355,7 @@ await client.unstable.contacts.listTagsForAContact({
-You can fetch the details of a single contact. +You can fetch the details of a single contact by external ID. Note that this endpoint only supports users and not leads.
@@ -10732,8 +14371,8 @@ You can fetch the details of a single contact.
```typescript -await client.unstable.contacts.showContact({ - id: "63a07ddf05a32042dffac965", +await client.unstable.contacts.showContactByExternalId({ + external_id: "cdd29344-5e0c-4ef0-ac56-f9ba2979bc27", }); ``` @@ -10750,7 +14389,7 @@ await client.unstable.contacts.showContact({
-**request:** `Intercom.unstable.ShowContactRequest` +**request:** `Intercom.unstable.ShowContactByExternalIdRequest`
@@ -10769,7 +14408,7 @@ await client.unstable.contacts.showContact({
-
client.unstable.contacts.updateContact({ ...params }) -> Intercom.UpdateContactResponse +
client.unstable.contacts.archiveContact({ ...params }) -> Intercom.ContactArchived
@@ -10778,16 +14417,10 @@ await client.unstable.contacts.showContact({
-
-
- -You can update an existing contact (ie. user or lead). - -{% admonition type="info" %} -This endpoint handles both **contact updates** and **custom object associations**. +
+
-See _`update a contact with an association to a custom object instance`_ in the request/response examples to see the custom object association format. -{% /admonition %} +You can archive a single contact.
@@ -10803,10 +14436,8 @@ See _`update a contact with an association to a custom object instance`_ in the
```typescript -await client.unstable.contacts.updateContact({ +await client.unstable.contacts.archiveContact({ id: "63a07ddf05a32042dffac965", - email: "joebloggs@intercom.io", - name: "joe bloggs", }); ``` @@ -10823,7 +14454,7 @@ await client.unstable.contacts.updateContact({
-**request:** `Intercom.unstable.UpdateContactRequest` +**request:** `Intercom.unstable.ArchiveContactRequest`
@@ -10842,7 +14473,7 @@ await client.unstable.contacts.updateContact({
-
client.unstable.contacts.deleteContact({ ...params }) -> Intercom.ContactDeleted +
client.unstable.contacts.unarchiveContact({ ...params }) -> Intercom.ContactUnarchived
@@ -10854,7 +14485,7 @@ await client.unstable.contacts.updateContact({
-You can delete a single contact. +You can unarchive a single contact.
@@ -10870,8 +14501,8 @@ You can delete a single contact.
```typescript -await client.unstable.contacts.deleteContact({ - id: "id", +await client.unstable.contacts.unarchiveContact({ + id: "63a07ddf05a32042dffac965", }); ``` @@ -10888,7 +14519,7 @@ await client.unstable.contacts.deleteContact({
-**request:** `Intercom.unstable.DeleteContactRequest` +**request:** `Intercom.unstable.UnarchiveContactRequest`
@@ -10907,7 +14538,7 @@ await client.unstable.contacts.deleteContact({
-
client.unstable.contacts.mergeContact({ ...params }) -> Intercom.MergeContactResponse +
client.unstable.contacts.blockContact({ ...params }) -> Intercom.ContactBlocked
@@ -10919,7 +14550,7 @@ await client.unstable.contacts.deleteContact({
-You can merge a contact with a `role` of `lead` into a contact with a `role` of `user`. +Block a single contact.
**Note:** conversations of the contact will also be archived during the process.
More details in [FAQ How do I block Inbox spam?](https://www.intercom.com/help/en/articles/8838656-inbox-faqs)
@@ -10935,9 +14566,8 @@ You can merge a contact with a `role` of `lead` into a contact with a `role` of
```typescript -await client.unstable.contacts.mergeContact({ - from: "6762f0d51bb69f9f2193bb7f", - into: "6762f0d51bb69f9f2193bb80", +await client.unstable.contacts.blockContact({ + id: "63a07ddf05a32042dffac965", }); ``` @@ -10954,7 +14584,7 @@ await client.unstable.contacts.mergeContact({
-**request:** `Intercom.unstable.MergeContactsRequest` +**request:** `Intercom.unstable.BlockContactRequest`
@@ -10973,7 +14603,9 @@ await client.unstable.contacts.mergeContact({
-
client.unstable.contacts.searchContacts({ ...params }) -> Intercom.ContactList +## Notes + +
client.unstable.notes.listNotes({ ...params }) -> Intercom.NoteList
@@ -10985,108 +14617,7 @@ await client.unstable.contacts.mergeContact({
-You can search for multiple contacts by the value of their attributes in order to fetch exactly who you want. - -To search for contacts, you need to send a `POST` request to `https://api.intercom.io/contacts/search`. - -This will accept a query object in the body which will define your filters in order to search for contacts. - -{% admonition type="warning" name="Optimizing search queries" %} -Search queries can be complex, so optimizing them can help the performance of your search. -Use the `AND` and `OR` operators to combine multiple filters to get the exact results you need and utilize -pagination to limit the number of results returned. The default is `50` results per page. -See the [pagination section](https://developers.intercom.com/docs/build-an-integration/learn-more/rest-apis/pagination/#example-search-conversations-request) for more details on how to use the `starting_after` param. -{% /admonition %} - -### Contact Creation Delay - -If a contact has recently been created, there is a possibility that it will not yet be available when searching. This means that it may not appear in the response. This delay can take a few minutes. If you need to be instantly notified it is recommended to use webhooks and iterate to see if they match your search filters. - -### Nesting & Limitations - -You can nest these filters in order to get even more granular insights that pinpoint exactly what you need. Example: (1 OR 2) AND (3 OR 4). -There are some limitations to the amount of multiple's there can be: - -- There's a limit of max 2 nested filters -- There's a limit of max 15 filters for each AND or OR group - -### Searching for Timestamp Fields - -All timestamp fields (created_at, updated_at etc.) are indexed as Dates for Contact Search queries; Datetime queries are not currently supported. This means you can only query for timestamp fields by day - not hour, minute or second. -For example, if you search for all Contacts with a created_at value greater (>) than 1577869200 (the UNIX timestamp for January 1st, 2020 9:00 AM), that will be interpreted as 1577836800 (January 1st, 2020 12:00 AM). The search results will then include Contacts created from January 2nd, 2020 12:00 AM onwards. -If you'd like to get contacts created on January 1st, 2020 you should search with a created_at value equal (=) to 1577836800 (January 1st, 2020 12:00 AM). -This behaviour applies only to timestamps used in search queries. The search results will still contain the full UNIX timestamp and be sorted accordingly. - -### Accepted Fields - -Most key listed as part of the Contacts Model are searchable, whether writeable or not. The value you search for has to match the accepted type, otherwise the query will fail (ie. as `created_at` accepts a date, the `value` cannot be a string such as `"foorbar"`). - -| Field | Type | -| ---------------------------------- | ------------------------------ | -| id | String | -| role | String
Accepts user or lead | -| name | String | -| avatar | String | -| owner_id | Integer | -| email | String | -| email_domain | String | -| phone | String | -| formatted_phone | String | -| external_id | String | -| created_at | Date (UNIX Timestamp) | -| signed_up_at | Date (UNIX Timestamp) | -| updated_at | Date (UNIX Timestamp) | -| last_seen_at | Date (UNIX Timestamp) | -| last_contacted_at | Date (UNIX Timestamp) | -| last_replied_at | Date (UNIX Timestamp) | -| last_email_opened_at | Date (UNIX Timestamp) | -| last_email_clicked_at | Date (UNIX Timestamp) | -| language_override | String | -| browser | String | -| browser_language | String | -| os | String | -| location.country | String | -| location.region | String | -| location.city | String | -| unsubscribed_from_emails | Boolean | -| marked_email_as_spam | Boolean | -| has_hard_bounced | Boolean | -| ios_last_seen_at | Date (UNIX Timestamp) | -| ios_app_version | String | -| ios_device | String | -| ios_app_device | String | -| ios_os_version | String | -| ios_app_name | String | -| ios_sdk_version | String | -| android_last_seen_at | Date (UNIX Timestamp) | -| android_app_version | String | -| android_device | String | -| android_app_name | String | -| andoid_sdk_version | String | -| segment_id | String | -| tag_id | String | -| custom_attributes.{attribute_name} | String | - -### Accepted Operators - -{% admonition type="warning" name="Searching based on `created_at`" %} -You cannot use the `<=` or `>=` operators to search by `created_at`. -{% /admonition %} - -The table below shows the operators you can use to define how you want to search for the value. The operator should be put in as a string (`"="`). The operator has to be compatible with the field's type (eg. you cannot search with `>` for a given string value as it's only compatible for integer's and dates). - -| Operator | Valid Types | Description | -| :------- | :------------------------------- | :--------------------------------------------------------------- | -| = | All | Equals | -| != | All | Doesn't Equal | -| IN | All | In
Shortcut for `OR` queries
Values must be in Array | -| NIN | All | Not In
Shortcut for `OR !` queries
Values must be in Array | -| > | Integer
Date (UNIX Timestamp) | Greater than | -| < | Integer
Date (UNIX Timestamp) | Lower than | -| ~ | String | Contains | -| !~ | String | Doesn't Contain | -| ^ | String | Starts With | -| $ | String | Ends With | +You can fetch a list of notes that are associated to a contact.
@@ -11102,20 +14633,8 @@ The table below shows the operators you can use to define how you want to search
```typescript -await client.unstable.contacts.searchContacts({ - query: { - operator: "AND", - value: [ - { - field: "created_at", - operator: ">", - value: "1306054154", - }, - ], - }, - pagination: { - per_page: 5, - }, +await client.unstable.notes.listNotes({ + id: 1, }); ``` @@ -11132,7 +14651,7 @@ await client.unstable.contacts.searchContacts({
-**request:** `Intercom.SearchRequest` +**request:** `Intercom.unstable.ListNotesRequest`
@@ -11140,7 +14659,7 @@ await client.unstable.contacts.searchContacts({
-**requestOptions:** `Contacts.RequestOptions` +**requestOptions:** `Notes.RequestOptions`
@@ -11151,7 +14670,7 @@ await client.unstable.contacts.searchContacts({
-
client.unstable.contacts.listContacts() -> Intercom.ContactList +
client.unstable.notes.createNote({ ...params }) -> Intercom.Note
@@ -11163,11 +14682,7 @@ await client.unstable.contacts.searchContacts({
-You can fetch a list of all contacts (ie. users or leads) in your workspace. -{% admonition type="warning" name="Pagination" %} -You can use pagination to limit the number of results returned. The default is `50` results per page. -See the [pagination section](https://developers.intercom.com/docs/build-an-integration/learn-more/rest-apis/pagination/#pagination-for-list-apis) for more details on how to use the `starting_after` param. -{% /admonition %} +You can add a note to a single contact.
@@ -11183,7 +14698,12 @@ See the [pagination section](https://developers.intercom.com/docs/build-an-integ
```typescript -await client.unstable.contacts.listContacts(); +await client.unstable.notes.createNote({ + id: 1, + body: "Hello", + contact_id: "6762f0ad1bb69f9f2193bb62", + admin_id: "123", +}); ```
@@ -11199,7 +14719,15 @@ await client.unstable.contacts.listContacts();
-**requestOptions:** `Contacts.RequestOptions` +**request:** `Intercom.unstable.CreateNoteRequest` + +
+
+ +
+
+ +**requestOptions:** `Notes.RequestOptions`
@@ -11210,7 +14738,7 @@ await client.unstable.contacts.listContacts();
-
client.unstable.contacts.createContact({ ...params }) -> Intercom.CreateContactResponse +
client.unstable.notes.retrieveNote({ ...params }) -> Intercom.Note
@@ -11222,7 +14750,7 @@ await client.unstable.contacts.listContacts();
-You can create a new contact (ie. user or lead). +You can fetch the details of a single note.
@@ -11238,8 +14766,8 @@ You can create a new contact (ie. user or lead).
```typescript -await client.unstable.contacts.createContact({ - email: "joebloggs@intercom.io", +await client.unstable.notes.retrieveNote({ + id: 1, }); ``` @@ -11256,7 +14784,7 @@ await client.unstable.contacts.createContact({
-**request:** `Intercom.CreateContactRequestTwo` +**request:** `Intercom.unstable.RetrieveNoteRequest`
@@ -11264,7 +14792,7 @@ await client.unstable.contacts.createContact({
-**requestOptions:** `Contacts.RequestOptions` +**requestOptions:** `Notes.RequestOptions`
@@ -11275,7 +14803,9 @@ await client.unstable.contacts.createContact({
-
client.unstable.contacts.showContactByExternalId({ ...params }) -> Intercom.ShowContactByExternalIdResponse +## Subscription Types + +
client.unstable.subscriptionTypes.attachSubscriptionTypeToContact({ ...params }) -> Intercom.SubscriptionType
@@ -11287,7 +14817,13 @@ await client.unstable.contacts.createContact({
-You can fetch the details of a single contact by external ID. Note that this endpoint only supports users and not leads. +You can add a specific subscription to a contact. In Intercom, we have two different subscription types based on user consent - opt-out and opt-in: + +1.Attaching a contact to an opt-out subscription type will opt that user out from receiving messages related to that subscription type. + +2.Attaching a contact to an opt-in subscription type will opt that user in to receiving messages related to that subscription type. + +This will return a subscription type model for the subscription type that was added to the contact.
@@ -11303,8 +14839,10 @@ You can fetch the details of a single contact by external ID. Note that this end
```typescript -await client.unstable.contacts.showContactByExternalId({ - external_id: "cdd29344-5e0c-4ef0-ac56-f9ba2979bc27", +await client.unstable.subscriptionTypes.attachSubscriptionTypeToContact({ + contact_id: "63a07ddf05a32042dffac965", + id: "37846", + consent_type: "opt_in", }); ``` @@ -11321,7 +14859,7 @@ await client.unstable.contacts.showContactByExternalId({
-**request:** `Intercom.unstable.ShowContactByExternalIdRequest` +**request:** `Intercom.unstable.AttachSubscriptionTypeToContactRequest`
@@ -11329,7 +14867,7 @@ await client.unstable.contacts.showContactByExternalId({
-**requestOptions:** `Contacts.RequestOptions` +**requestOptions:** `SubscriptionTypes.RequestOptions`
@@ -11340,7 +14878,7 @@ await client.unstable.contacts.showContactByExternalId({
-
client.unstable.contacts.archiveContact({ ...params }) -> Intercom.ContactArchived +
client.unstable.subscriptionTypes.detachSubscriptionTypeToContact({ ...params }) -> Intercom.SubscriptionType
@@ -11352,7 +14890,7 @@ await client.unstable.contacts.showContactByExternalId({
-You can archive a single contact. +You can remove a specific subscription from a contact. This will return a subscription type model for the subscription type that was removed from the contact.
@@ -11368,8 +14906,9 @@ You can archive a single contact.
```typescript -await client.unstable.contacts.archiveContact({ - id: "63a07ddf05a32042dffac965", +await client.unstable.subscriptionTypes.detachSubscriptionTypeToContact({ + contact_id: "63a07ddf05a32042dffac965", + id: "37846", }); ``` @@ -11386,7 +14925,7 @@ await client.unstable.contacts.archiveContact({
-**request:** `Intercom.unstable.ArchiveContactRequest` +**request:** `Intercom.unstable.DetachSubscriptionTypeToContactRequest`
@@ -11394,7 +14933,7 @@ await client.unstable.contacts.archiveContact({
-**requestOptions:** `Contacts.RequestOptions` +**requestOptions:** `SubscriptionTypes.RequestOptions`
@@ -11405,7 +14944,7 @@ await client.unstable.contacts.archiveContact({
-
client.unstable.contacts.unarchiveContact({ ...params }) -> Intercom.ContactUnarchived +
client.unstable.subscriptionTypes.listSubscriptionTypes() -> Intercom.SubscriptionTypeList
@@ -11417,7 +14956,7 @@ await client.unstable.contacts.archiveContact({
-You can unarchive a single contact. +You can list all subscription types. A list of subscription type objects will be returned.
@@ -11433,33 +14972,23 @@ You can unarchive a single contact.
```typescript -await client.unstable.contacts.unarchiveContact({ - id: "63a07ddf05a32042dffac965", -}); +await client.unstable.subscriptionTypes.listSubscriptionTypes(); ```
- - - -#### ⚙️ Parameters - -
-
- -
-
- -**request:** `Intercom.unstable.UnarchiveContactRequest` - -
-
+
+
+ +#### ⚙️ Parameters
-**requestOptions:** `Contacts.RequestOptions` +
+
+ +**requestOptions:** `SubscriptionTypes.RequestOptions`
@@ -11470,7 +14999,9 @@ await client.unstable.contacts.unarchiveContact({
-
client.unstable.contacts.blockContact({ ...params }) -> Intercom.ContactBlocked +## Tags + +
client.unstable.tags.attachTagToContact({ ...params }) -> Intercom.Tag
@@ -11482,7 +15013,7 @@ await client.unstable.contacts.unarchiveContact({
-Block a single contact.
**Note:** conversations of the contact will also be archived during the process.
More details in [FAQ How do I block Inbox spam?](https://www.intercom.com/help/en/articles/8838656-inbox-faqs) +You can tag a specific contact. This will return a tag object for the tag that was added to the contact.
@@ -11498,8 +15029,9 @@ Block a single contact.
**Note:** conversations of the contact will also be a
```typescript -await client.unstable.contacts.blockContact({ - id: "63a07ddf05a32042dffac965", +await client.unstable.tags.attachTagToContact({ + contact_id: "63a07ddf05a32042dffac965", + id: "7522907", }); ``` @@ -11516,7 +15048,7 @@ await client.unstable.contacts.blockContact({
-**request:** `Intercom.unstable.BlockContactRequest` +**request:** `Intercom.unstable.AttachTagToContactRequest`
@@ -11524,7 +15056,7 @@ await client.unstable.contacts.blockContact({
-**requestOptions:** `Contacts.RequestOptions` +**requestOptions:** `Tags.RequestOptions`
@@ -11535,9 +15067,7 @@ await client.unstable.contacts.blockContact({
-## Notes - -
client.unstable.notes.listNotes({ ...params }) -> Intercom.NoteList +
client.unstable.tags.detachTagFromContact({ ...params }) -> Intercom.Tag
@@ -11549,7 +15079,7 @@ await client.unstable.contacts.blockContact({
-You can fetch a list of notes that are associated to a contact. +You can remove tag from a specific contact. This will return a tag object for the tag that was removed from the contact.
@@ -11565,8 +15095,9 @@ You can fetch a list of notes that are associated to a contact.
```typescript -await client.unstable.notes.listNotes({ - id: 1, +await client.unstable.tags.detachTagFromContact({ + contact_id: "63a07ddf05a32042dffac965", + id: "7522907", }); ``` @@ -11583,7 +15114,7 @@ await client.unstable.notes.listNotes({
-**request:** `Intercom.unstable.ListNotesRequest` +**request:** `Intercom.unstable.DetachTagFromContactRequest`
@@ -11591,7 +15122,7 @@ await client.unstable.notes.listNotes({
-**requestOptions:** `Notes.RequestOptions` +**requestOptions:** `Tags.RequestOptions`
@@ -11602,7 +15133,7 @@ await client.unstable.notes.listNotes({
-
client.unstable.notes.createNote({ ...params }) -> Intercom.Note +
client.unstable.tags.attachTagToConversation({ ...params }) -> Intercom.Tag
@@ -11614,7 +15145,7 @@ await client.unstable.notes.listNotes({
-You can add a note to a single contact. +You can tag a specific conversation. This will return a tag object for the tag that was added to the conversation.
@@ -11630,11 +15161,10 @@ You can add a note to a single contact.
```typescript -await client.unstable.notes.createNote({ - id: 1, - body: "Hello", - contact_id: "6762f0ad1bb69f9f2193bb62", - admin_id: "123", +await client.unstable.tags.attachTagToConversation({ + conversation_id: "64619700005694", + id: "7522907", + admin_id: "780", }); ``` @@ -11651,7 +15181,7 @@ await client.unstable.notes.createNote({
-**request:** `Intercom.unstable.CreateNoteRequest` +**request:** `Intercom.unstable.AttachTagToConversationRequest`
@@ -11659,7 +15189,7 @@ await client.unstable.notes.createNote({
-**requestOptions:** `Notes.RequestOptions` +**requestOptions:** `Tags.RequestOptions`
@@ -11670,7 +15200,7 @@ await client.unstable.notes.createNote({
-
client.unstable.notes.retrieveNote({ ...params }) -> Intercom.Note +
client.unstable.tags.detachTagFromConversation({ ...params }) -> Intercom.Tag
@@ -11682,7 +15212,7 @@ await client.unstable.notes.createNote({
-You can fetch the details of a single note. +You can remove tag from a specific conversation. This will return a tag object for the tag that was removed from the conversation.
@@ -11698,8 +15228,10 @@ You can fetch the details of a single note.
```typescript -await client.unstable.notes.retrieveNote({ - id: 1, +await client.unstable.tags.detachTagFromConversation({ + conversation_id: "64619700005694", + id: "7522907", + admin_id: "123", }); ``` @@ -11716,7 +15248,7 @@ await client.unstable.notes.retrieveNote({
-**request:** `Intercom.unstable.RetrieveNoteRequest` +**request:** `Intercom.unstable.DetachTagFromConversationRequest`
@@ -11724,7 +15256,7 @@ await client.unstable.notes.retrieveNote({
-**requestOptions:** `Notes.RequestOptions` +**requestOptions:** `Tags.RequestOptions`
@@ -11735,9 +15267,7 @@ await client.unstable.notes.retrieveNote({
-## Subscription Types - -
client.unstable.subscriptionTypes.attachSubscriptionTypeToContact({ ...params }) -> Intercom.SubscriptionType +
client.unstable.tags.listTags() -> Intercom.TagList
@@ -11749,13 +15279,7 @@ await client.unstable.notes.retrieveNote({
-You can add a specific subscription to a contact. In Intercom, we have two different subscription types based on user consent - opt-out and opt-in: - -1.Attaching a contact to an opt-out subscription type will opt that user out from receiving messages related to that subscription type. - -2.Attaching a contact to an opt-in subscription type will opt that user in to receiving messages related to that subscription type. - -This will return a subscription type model for the subscription type that was added to the contact. +You can fetch a list of all tags for a given workspace.
@@ -11771,11 +15295,7 @@ This will return a subscription type model for the subscription type that was ad
```typescript -await client.unstable.subscriptionTypes.attachSubscriptionTypeToContact({ - contact_id: "63a07ddf05a32042dffac965", - id: "37846", - consent_type: "opt_in", -}); +await client.unstable.tags.listTags(); ```
@@ -11791,15 +15311,7 @@ await client.unstable.subscriptionTypes.attachSubscriptionTypeToContact({
-**request:** `Intercom.unstable.AttachSubscriptionTypeToContactRequest` - -
-
- -
-
- -**requestOptions:** `SubscriptionTypes.RequestOptions` +**requestOptions:** `Tags.RequestOptions`
@@ -11810,7 +15322,7 @@ await client.unstable.subscriptionTypes.attachSubscriptionTypeToContact({
-
client.unstable.subscriptionTypes.detachSubscriptionTypeToContact({ ...params }) -> Intercom.SubscriptionType +
client.unstable.tags.createTag({ ...params }) -> Intercom.Tag
@@ -11822,7 +15334,19 @@ await client.unstable.subscriptionTypes.attachSubscriptionTypeToContact({
-You can remove a specific subscription from a contact. This will return a subscription type model for the subscription type that was removed from the contact. +You can use this endpoint to perform the following operations: + +**1. Create a new tag:** You can create a new tag by passing in the tag name as specified in "Create or Update Tag Request Payload" described below. + +**2. Update an existing tag:** You can update an existing tag by passing the id of the tag as specified in "Create or Update Tag Request Payload" described below. + +**3. Tag Companies:** You can tag single company or a list of companies. You can tag a company by passing in the tag name and the company details as specified in "Tag Company Request Payload" described below. Also, if the tag doesn't exist then a new one will be created automatically. + +**4. Untag Companies:** You can untag a single company or a list of companies. You can untag a company by passing in the tag id and the company details as specified in "Untag Company Request Payload" described below. + +**5. Tag Multiple Users:** You can tag a list of users. You can tag the users by passing in the tag name and the user details as specified in "Tag Users Request Payload" described below. + +Each operation will return a tag object.
@@ -11838,9 +15362,8 @@ You can remove a specific subscription from a contact. This will return a subscr
```typescript -await client.unstable.subscriptionTypes.detachSubscriptionTypeToContact({ - contact_id: "63a07ddf05a32042dffac965", - id: "37846", +await client.unstable.tags.createTag({ + name: "test", }); ``` @@ -11857,7 +15380,7 @@ await client.unstable.subscriptionTypes.detachSubscriptionTypeToContact({
-**request:** `Intercom.unstable.DetachSubscriptionTypeToContactRequest` +**request:** `Intercom.CreateTagRequestBody`
@@ -11865,7 +15388,7 @@ await client.unstable.subscriptionTypes.detachSubscriptionTypeToContact({
-**requestOptions:** `SubscriptionTypes.RequestOptions` +**requestOptions:** `Tags.RequestOptions`
@@ -11876,7 +15399,7 @@ await client.unstable.subscriptionTypes.detachSubscriptionTypeToContact({
-
client.unstable.subscriptionTypes.listSubscriptionTypes() -> Intercom.SubscriptionTypeList +
client.unstable.tags.findTag({ ...params }) -> Intercom.Tag
@@ -11888,7 +15411,8 @@ await client.unstable.subscriptionTypes.detachSubscriptionTypeToContact({
-You can list all subscription types. A list of subscription type objects will be returned. +You can fetch the details of tags that are on the workspace by their id. +This will return a tag object.
@@ -11904,7 +15428,9 @@ You can list all subscription types. A list of subscription type objects will be
```typescript -await client.unstable.subscriptionTypes.listSubscriptionTypes(); +await client.unstable.tags.findTag({ + id: "123", +}); ```
@@ -11920,7 +15446,15 @@ await client.unstable.subscriptionTypes.listSubscriptionTypes();
-**requestOptions:** `SubscriptionTypes.RequestOptions` +**request:** `Intercom.unstable.FindTagRequest` + +
+
+ +
+
+ +**requestOptions:** `Tags.RequestOptions`
@@ -11931,9 +15465,7 @@ await client.unstable.subscriptionTypes.listSubscriptionTypes();
-## Tags - -
client.unstable.tags.attachTagToContact({ ...params }) -> Intercom.Tag +
client.unstable.tags.deleteTag({ ...params }) -> void
@@ -11945,7 +15477,7 @@ await client.unstable.subscriptionTypes.listSubscriptionTypes();
-You can tag a specific contact. This will return a tag object for the tag that was added to the contact. +You can delete the details of tags that are on the workspace by passing in the id.
@@ -11961,9 +15493,8 @@ You can tag a specific contact. This will return a tag object for the tag that w
```typescript -await client.unstable.tags.attachTagToContact({ - contact_id: "63a07ddf05a32042dffac965", - id: "7522907", +await client.unstable.tags.deleteTag({ + id: "123", }); ``` @@ -11980,7 +15511,7 @@ await client.unstable.tags.attachTagToContact({
-**request:** `Intercom.unstable.AttachTagToContactRequest` +**request:** `Intercom.unstable.DeleteTagRequest`
@@ -11999,7 +15530,7 @@ await client.unstable.tags.attachTagToContact({
-
client.unstable.tags.detachTagFromContact({ ...params }) -> Intercom.Tag +
client.unstable.tags.attachTagToTicket({ ...params }) -> Intercom.Tag
@@ -12011,7 +15542,7 @@ await client.unstable.tags.attachTagToContact({
-You can remove tag from a specific contact. This will return a tag object for the tag that was removed from the contact. +You can tag a specific ticket. This will return a tag object for the tag that was added to the ticket.
@@ -12027,9 +15558,10 @@ You can remove tag from a specific contact. This will return a tag object for th
```typescript -await client.unstable.tags.detachTagFromContact({ - contact_id: "63a07ddf05a32042dffac965", +await client.unstable.tags.attachTagToTicket({ + ticket_id: "64619700005694", id: "7522907", + admin_id: "780", }); ``` @@ -12046,7 +15578,7 @@ await client.unstable.tags.detachTagFromContact({
-**request:** `Intercom.unstable.DetachTagFromContactRequest` +**request:** `Intercom.unstable.AttachTagToTicketRequest`
@@ -12065,7 +15597,7 @@ await client.unstable.tags.detachTagFromContact({
-
client.unstable.tags.attachTagToConversation({ ...params }) -> Intercom.Tag +
client.unstable.tags.detachTagFromTicket({ ...params }) -> Intercom.Tag
@@ -12077,7 +15609,7 @@ await client.unstable.tags.detachTagFromContact({
-You can tag a specific conversation. This will return a tag object for the tag that was added to the conversation. +You can remove tag from a specific ticket. This will return a tag object for the tag that was removed from the ticket.
@@ -12093,10 +15625,10 @@ You can tag a specific conversation. This will return a tag object for the tag t
```typescript -await client.unstable.tags.attachTagToConversation({ - conversation_id: "64619700005694", +await client.unstable.tags.detachTagFromTicket({ + ticket_id: "64619700005694", id: "7522907", - admin_id: "780", + admin_id: "123", }); ``` @@ -12113,7 +15645,7 @@ await client.unstable.tags.attachTagToConversation({
-**request:** `Intercom.unstable.AttachTagToConversationRequest` +**request:** `Intercom.unstable.DetachTagFromTicketRequest`
@@ -12132,7 +15664,9 @@ await client.unstable.tags.attachTagToConversation({
-
client.unstable.tags.detachTagFromConversation({ ...params }) -> Intercom.Tag +## Conversations + +
client.unstable.conversations.listConversations({ ...params }) -> Intercom.ConversationList
@@ -12144,7 +15678,13 @@ await client.unstable.tags.attachTagToConversation({
-You can remove tag from a specific conversation. This will return a tag object for the tag that was removed from the conversation. +You can fetch a list of all conversations. + +You can optionally request the result page size and the cursor to start after to fetch the result. +{% admonition type="warning" name="Pagination" %} +You can use pagination to limit the number of results returned. The default is `20` results per page. +See the [pagination section](https://developers.intercom.com/docs/build-an-integration/learn-more/rest-apis/pagination/#pagination-for-list-apis) for more details on how to use the `starting_after` param. +{% /admonition %}
@@ -12160,11 +15700,7 @@ You can remove tag from a specific conversation. This will return a tag object f
```typescript -await client.unstable.tags.detachTagFromConversation({ - conversation_id: "64619700005694", - id: "7522907", - admin_id: "123", -}); +await client.unstable.conversations.listConversations(); ```
@@ -12180,7 +15716,7 @@ await client.unstable.tags.detachTagFromConversation({
-**request:** `Intercom.unstable.DetachTagFromConversationRequest` +**request:** `Intercom.unstable.ListConversationsRequest`
@@ -12188,7 +15724,7 @@ await client.unstable.tags.detachTagFromConversation({
-**requestOptions:** `Tags.RequestOptions` +**requestOptions:** `Conversations.RequestOptions`
@@ -12199,7 +15735,7 @@ await client.unstable.tags.detachTagFromConversation({
-
client.unstable.tags.listTags() -> Intercom.TagList +
client.unstable.conversations.createConversation({ ...params }) -> Intercom.Message
@@ -12211,7 +15747,15 @@ await client.unstable.tags.detachTagFromConversation({
-You can fetch a list of all tags for a given workspace. +You can create a conversation that has been initiated by a contact (ie. user or lead). +The conversation can be an in-app message only. + +{% admonition type="info" name="Sending for visitors" %} +You can also send a message from a visitor by specifying their `user_id` or `id` value in the `from` field, along with a `type` field value of `contact`. +This visitor will be automatically converted to a contact with a lead role once the conversation is created. +{% /admonition %} + +This will return the Message model that has been created.
@@ -12227,7 +15771,13 @@ You can fetch a list of all tags for a given workspace.
```typescript -await client.unstable.tags.listTags(); +await client.unstable.conversations.createConversation({ + from: { + type: "user", + id: "6762f11b1bb69f9f2193bba3", + }, + body: "Hello there", +}); ```
@@ -12243,7 +15793,15 @@ await client.unstable.tags.listTags();
-**requestOptions:** `Tags.RequestOptions` +**request:** `Intercom.unstable.CreateConversationRequest` + +
+
+ +
+
+ +**requestOptions:** `Conversations.RequestOptions`
@@ -12254,7 +15812,7 @@ await client.unstable.tags.listTags();
-
client.unstable.tags.createTag({ ...params }) -> Intercom.Tag +
client.unstable.conversations.retrieveConversation({ ...params }) -> Intercom.Conversation
@@ -12266,19 +15824,15 @@ await client.unstable.tags.listTags();
-You can use this endpoint to perform the following operations: - -**1. Create a new tag:** You can create a new tag by passing in the tag name as specified in "Create or Update Tag Request Payload" described below. - -**2. Update an existing tag:** You can update an existing tag by passing the id of the tag as specified in "Create or Update Tag Request Payload" described below. - -**3. Tag Companies:** You can tag single company or a list of companies. You can tag a company by passing in the tag name and the company details as specified in "Tag Company Request Payload" described below. Also, if the tag doesn't exist then a new one will be created automatically. +You can fetch the details of a single conversation. -**4. Untag Companies:** You can untag a single company or a list of companies. You can untag a company by passing in the tag id and the company details as specified in "Untag Company Request Payload" described below. +This will return a single Conversation model with all its conversation parts. -**5. Tag Multiple Users:** You can tag a list of users. You can tag the users by passing in the tag name and the user details as specified in "Tag Users Request Payload" described below. +{% admonition type="warning" name="Hard limit of 500 parts" %} +The maximum number of conversation parts that can be returned via the API is 500. If you have more than that we will return the 500 most recent conversation parts. +{% /admonition %} -Each operation will return a tag object. +For AI agent conversation metadata, please note that you need to have the agent enabled in your workspace, which is a [paid feature](https://www.intercom.com/help/en/articles/8205718-fin-resolutions#h_97f8c2e671).
@@ -12294,8 +15848,9 @@ Each operation will return a tag object.
```typescript -await client.unstable.tags.createTag({ - name: "test", +await client.unstable.conversations.retrieveConversation({ + id: 1, + display_as: "plaintext", }); ``` @@ -12312,7 +15867,7 @@ await client.unstable.tags.createTag({
-**request:** `Intercom.CreateTagRequestBody` +**request:** `Intercom.unstable.RetrieveConversationRequest`
@@ -12320,7 +15875,7 @@ await client.unstable.tags.createTag({
-**requestOptions:** `Tags.RequestOptions` +**requestOptions:** `Conversations.RequestOptions`
@@ -12331,7 +15886,7 @@ await client.unstable.tags.createTag({
-
client.unstable.tags.findTag({ ...params }) -> Intercom.Tag +
client.unstable.conversations.updateConversation({ ...params }) -> Intercom.Conversation
@@ -12343,8 +15898,17 @@ await client.unstable.tags.createTag({
-You can fetch the details of tags that are on the workspace by their id. -This will return a tag object. +You can update an existing conversation. + +{% admonition type="info" name="Replying and other actions" %} +If you want to reply to a coveration or take an action such as assign, unassign, open, close or snooze, take a look at the reply and manage endpoints. +{% /admonition %} + +{% admonition type="info" %} +This endpoint handles both **conversation updates** and **custom object associations**. + +See _`update a conversation with an association to a custom object instance`_ in the request/response examples to see the custom object association format. +{% /admonition %}
@@ -12360,8 +15924,15 @@ This will return a tag object.
```typescript -await client.unstable.tags.findTag({ - id: "123", +await client.unstable.conversations.updateConversation({ + id: 1, + display_as: "plaintext", + read: true, + title: "new conversation title", + custom_attributes: { + issue_type: "Billing", + priority: "High", + }, }); ``` @@ -12378,7 +15949,7 @@ await client.unstable.tags.findTag({
-**request:** `Intercom.unstable.FindTagRequest` +**request:** `Intercom.unstable.UpdateConversationRequest`
@@ -12386,7 +15957,7 @@ await client.unstable.tags.findTag({
-**requestOptions:** `Tags.RequestOptions` +**requestOptions:** `Conversations.RequestOptions`
@@ -12397,7 +15968,7 @@ await client.unstable.tags.findTag({
-
client.unstable.tags.deleteTag({ ...params }) -> void +
client.unstable.conversations.deleteConversation({ ...params }) -> Intercom.ConversationDeleted
@@ -12409,7 +15980,7 @@ await client.unstable.tags.findTag({
-You can delete the details of tags that are on the workspace by passing in the id. +You can delete a single conversation.
@@ -12425,8 +15996,8 @@ You can delete the details of tags that are on the workspace by passing in the i
```typescript -await client.unstable.tags.deleteTag({ - id: "123", +await client.unstable.conversations.deleteConversation({ + id: 1, }); ``` @@ -12443,7 +16014,7 @@ await client.unstable.tags.deleteTag({
-**request:** `Intercom.unstable.DeleteTagRequest` +**request:** `Intercom.unstable.DeleteConversationRequest`
@@ -12451,7 +16022,7 @@ await client.unstable.tags.deleteTag({
-**requestOptions:** `Tags.RequestOptions` +**requestOptions:** `Conversations.RequestOptions`
@@ -12462,7 +16033,7 @@ await client.unstable.tags.deleteTag({
-
client.unstable.tags.attachTagToTicket({ ...params }) -> Intercom.Tag +
client.unstable.conversations.searchConversations({ ...params }) -> Intercom.ConversationList
@@ -12474,7 +16045,106 @@ await client.unstable.tags.deleteTag({
-You can tag a specific ticket. This will return a tag object for the tag that was added to the ticket. +You can search for multiple conversations by the value of their attributes in order to fetch exactly which ones you want. + +To search for conversations, you need to send a `POST` request to `https://api.intercom.io/conversations/search`. + +This will accept a query object in the body which will define your filters in order to search for conversations. +{% admonition type="warning" name="Optimizing search queries" %} +Search queries can be complex, so optimizing them can help the performance of your search. +Use the `AND` and `OR` operators to combine multiple filters to get the exact results you need and utilize +pagination to limit the number of results returned. The default is `20` results per page and maximum is `150`. +See the [pagination section](https://developers.intercom.com/docs/build-an-integration/learn-more/rest-apis/pagination/#example-search-conversations-request) for more details on how to use the `starting_after` param. +{% /admonition %} + +### Nesting & Limitations + +You can nest these filters in order to get even more granular insights that pinpoint exactly what you need. Example: (1 OR 2) AND (3 OR 4). +There are some limitations to the amount of multiple's there can be: + +- There's a limit of max 2 nested filters +- There's a limit of max 15 filters for each AND or OR group + +### Accepted Fields + +Most keys listed in the conversation model are searchable, whether writeable or not. The value you search for has to match the accepted type, otherwise the query will fail (ie. as `created_at` accepts a date, the `value` cannot be a string such as `"foorbar"`). +The `source.body` field is unique as the search will not be performed against the entire value, but instead against every element of the value separately. For example, when searching for a conversation with a `"I need support"` body - the query should contain a `=` operator with the value `"support"` for such conversation to be returned. A query with a `=` operator and a `"need support"` value will not yield a result. + +| Field | Type | +| :---------------------------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------- | +| id | String | +| created_at | Date (UNIX timestamp) | +| updated_at | Date (UNIX timestamp) | +| source.type | String
Accepted fields are `conversation`, `email`, `facebook`, `instagram`, `phone_call`, `phone_switch`, `push`, `sms`, `twitter` and `whatsapp`. | +| source.id | String | +| source.delivered_as | String | +| source.subject | String | +| source.body | String | +| source.author.id | String | +| source.author.type | String | +| source.author.name | String | +| source.author.email | String | +| source.url | String | +| contact_ids | String | +| teammate_ids | String | +| admin_assignee_id | String | +| team_assignee_id | String | +| channel_initiated | String | +| open | Boolean | +| read | Boolean | +| state | String | +| waiting_since | Date (UNIX timestamp) | +| snoozed_until | Date (UNIX timestamp) | +| tag_ids | String | +| priority | String | +| statistics.time_to_assignment | Integer | +| statistics.time_to_admin_reply | Integer | +| statistics.time_to_first_close | Integer | +| statistics.time_to_last_close | Integer | +| statistics.median_time_to_reply | Integer | +| statistics.first_contact_reply_at | Date (UNIX timestamp) | +| statistics.first_assignment_at | Date (UNIX timestamp) | +| statistics.first_admin_reply_at | Date (UNIX timestamp) | +| statistics.first_close_at | Date (UNIX timestamp) | +| statistics.last_assignment_at | Date (UNIX timestamp) | +| statistics.last_assignment_admin_reply_at | Date (UNIX timestamp) | +| statistics.last_contact_reply_at | Date (UNIX timestamp) | +| statistics.last_admin_reply_at | Date (UNIX timestamp) | +| statistics.last_close_at | Date (UNIX timestamp) | +| statistics.last_closed_by_id | String | +| statistics.count_reopens | Integer | +| statistics.count_assignments | Integer | +| statistics.count_conversation_parts | Integer | +| conversation_rating.requested_at | Date (UNIX timestamp) | +| conversation_rating.replied_at | Date (UNIX timestamp) | +| conversation_rating.score | Integer | +| conversation_rating.remark | String | +| conversation_rating.contact_id | String | +| conversation_rating.admin_d | String | +| ai_agent_participated | Boolean | +| ai_agent.resolution_state | String | +| ai_agent.last_answer_type | String | +| ai_agent.rating | Integer | +| ai_agent.rating_remark | String | +| ai_agent.source_type | String | +| ai_agent.source_title | String | + +### Accepted Operators + +The table below shows the operators you can use to define how you want to search for the value. The operator should be put in as a string (`"="`). The operator has to be compatible with the field's type (eg. you cannot search with `>` for a given string value as it's only compatible for integer's and dates). + +| Operator | Valid Types | Description | +| :------- | :---------------------------- | :--------------------------------------------------------- | +| = | All | Equals | +| != | All | Doesn't Equal | +| IN | All | In Shortcut for `OR` queries Values most be in Array | +| NIN | All | Not In Shortcut for `OR !` queries Values must be in Array | +| > | Integer Date (UNIX Timestamp) | Greater (or equal) than | +| < | Integer Date (UNIX Timestamp) | Lower (or equal) than | +| ~ | String | Contains | +| !~ | String | Doesn't Contain | +| ^ | String | Starts With | +| $ | String | Ends With |
@@ -12490,10 +16160,20 @@ You can tag a specific ticket. This will return a tag object for the tag that wa
```typescript -await client.unstable.tags.attachTagToTicket({ - ticket_id: "64619700005694", - id: "7522907", - admin_id: "780", +await client.unstable.conversations.searchConversations({ + query: { + operator: "AND", + value: [ + { + field: "created_at", + operator: ">", + value: "1306054154", + }, + ], + }, + pagination: { + per_page: 5, + }, }); ``` @@ -12510,7 +16190,7 @@ await client.unstable.tags.attachTagToTicket({
-**request:** `Intercom.unstable.AttachTagToTicketRequest` +**request:** `Intercom.SearchRequest`
@@ -12518,7 +16198,7 @@ await client.unstable.tags.attachTagToTicket({
-**requestOptions:** `Tags.RequestOptions` +**requestOptions:** `Conversations.RequestOptions`
@@ -12529,7 +16209,7 @@ await client.unstable.tags.attachTagToTicket({
-
client.unstable.tags.detachTagFromTicket({ ...params }) -> Intercom.Tag +
client.unstable.conversations.replyConversation({ ...params }) -> Intercom.Conversation
@@ -12541,7 +16221,7 @@ await client.unstable.tags.attachTagToTicket({
-You can remove tag from a specific ticket. This will return a tag object for the tag that was removed from the ticket. +You can reply to a conversation with a message from an admin or on behalf of a contact, or with a note for admins.
@@ -12557,10 +16237,14 @@ You can remove tag from a specific ticket. This will return a tag object for the
```typescript -await client.unstable.tags.detachTagFromTicket({ - ticket_id: "64619700005694", - id: "7522907", - admin_id: "123", +await client.unstable.conversations.replyConversation({ + id: '123 or "last"', + body: { + message_type: "comment", + type: "user", + body: "Thanks again :)", + intercom_user_id: "6762f1571bb69f9f2193bbbb", + }, }); ``` @@ -12577,7 +16261,7 @@ await client.unstable.tags.detachTagFromTicket({
-**request:** `Intercom.unstable.DetachTagFromTicketRequest` +**request:** `Intercom.unstable.ReplyConversationRequest`
@@ -12585,7 +16269,7 @@ await client.unstable.tags.detachTagFromTicket({
-**requestOptions:** `Tags.RequestOptions` +**requestOptions:** `Conversations.RequestOptions`
@@ -12596,9 +16280,7 @@ await client.unstable.tags.detachTagFromTicket({
-## Conversations - -
client.unstable.conversations.listConversations({ ...params }) -> Intercom.ConversationList +
client.unstable.conversations.manageConversation({ ...params }) -> Intercom.Conversation
@@ -12610,18 +16292,16 @@ await client.unstable.tags.detachTagFromTicket({
-You can fetch a list of all conversations. - -You can optionally request the result page size and the cursor to start after to fetch the result. -{% admonition type="warning" name="Pagination" %} -You can use pagination to limit the number of results returned. The default is `20` results per page. -See the [pagination section](https://developers.intercom.com/docs/build-an-integration/learn-more/rest-apis/pagination/#pagination-for-list-apis) for more details on how to use the `starting_after` param. -{% /admonition %} +For managing conversations you can: -
-
-
-
+- Close a conversation +- Snooze a conversation to reopen on a future date +- Open a conversation which is `snoozed` or `closed` +- Assign a conversation to an admin and/or team. + + + + #### 🔌 Usage @@ -12632,7 +16312,14 @@ See the [pagination section](https://developers.intercom.com/docs/build-an-integ
```typescript -await client.unstable.conversations.listConversations(); +await client.unstable.conversations.manageConversation({ + id: "123", + body: { + message_type: "close", + type: "admin", + admin_id: "12345", + }, +}); ```
@@ -12648,7 +16335,7 @@ await client.unstable.conversations.listConversations();
-**request:** `Intercom.unstable.ListConversationsRequest` +**request:** `Intercom.unstable.ManageConversationRequest`
@@ -12667,7 +16354,7 @@ await client.unstable.conversations.listConversations();
-
client.unstable.conversations.createConversation({ ...params }) -> Intercom.Message +
client.unstable.conversations.attachContactToConversation({ ...params }) -> Intercom.Conversation
@@ -12679,16 +16366,12 @@ await client.unstable.conversations.listConversations();
-You can create a conversation that has been initiated by a contact (ie. user or lead). -The conversation can be an in-app message only. +You can add participants who are contacts to a conversation, on behalf of either another contact or an admin. -{% admonition type="info" name="Sending for visitors" %} -You can also send a message from a visitor by specifying their `user_id` or `id` value in the `from` field, along with a `type` field value of `contact`. -This visitor will be automatically converted to a contact with a lead role once the conversation is created. +{% admonition type="warning" name="Contacts without an email" %} +If you add a contact via the email parameter and there is no user/lead found on that workspace with he given email, then we will create a new contact with `role` set to `lead`. {% /admonition %} -This will return the Message model that has been created. -
@@ -12703,12 +16386,12 @@ This will return the Message model that has been created.
```typescript -await client.unstable.conversations.createConversation({ - from: { - type: "user", - id: "6762f11b1bb69f9f2193bba3", +await client.unstable.conversations.attachContactToConversation({ + id: "123", + admin_id: "12345", + customer: { + intercom_user_id: "6762f19b1bb69f9f2193bbd4", }, - body: "Hello there", }); ``` @@ -12725,7 +16408,7 @@ await client.unstable.conversations.createConversation({
-**request:** `Intercom.unstable.CreateConversationRequest` +**request:** `Intercom.unstable.AttachContactToConversationRequest`
@@ -12744,7 +16427,7 @@ await client.unstable.conversations.createConversation({
-
client.unstable.conversations.retrieveConversation({ ...params }) -> Intercom.Conversation +
client.unstable.conversations.detachContactFromConversation({ ...params }) -> Intercom.Conversation
@@ -12756,15 +16439,11 @@ await client.unstable.conversations.createConversation({
-You can fetch the details of a single conversation. - -This will return a single Conversation model with all its conversation parts. - -{% admonition type="warning" name="Hard limit of 500 parts" %} -The maximum number of conversation parts that can be returned via the API is 500. If you have more than that we will return the 500 most recent conversation parts. -{% /admonition %} +You can add participants who are contacts to a conversation, on behalf of either another contact or an admin. -For AI agent conversation metadata, please note that you need to have the agent enabled in your workspace, which is a [paid feature](https://www.intercom.com/help/en/articles/8205718-fin-resolutions#h_97f8c2e671). +{% admonition type="warning" name="Contacts without an email" %} +If you add a contact via the email parameter and there is no user/lead found on that workspace with he given email, then we will create a new contact with `role` set to `lead`. +{% /admonition %}
@@ -12780,9 +16459,10 @@ For AI agent conversation metadata, please note that you need to have the agent
```typescript -await client.unstable.conversations.retrieveConversation({ - id: 1, - display_as: "plaintext", +await client.unstable.conversations.detachContactFromConversation({ + conversation_id: "123", + contact_id: "123", + admin_id: "5017690", }); ``` @@ -12799,7 +16479,7 @@ await client.unstable.conversations.retrieveConversation({
-**request:** `Intercom.unstable.RetrieveConversationRequest` +**request:** `Intercom.unstable.DetachContactFromConversationRequest`
@@ -12818,7 +16498,7 @@ await client.unstable.conversations.retrieveConversation({
-
client.unstable.conversations.updateConversation({ ...params }) -> Intercom.Conversation +
client.unstable.conversations.redactConversation({ ...params }) -> Intercom.Conversation
@@ -12830,16 +16510,10 @@ await client.unstable.conversations.retrieveConversation({
-You can update an existing conversation. - -{% admonition type="info" name="Replying and other actions" %} -If you want to reply to a coveration or take an action such as assign, unassign, open, close or snooze, take a look at the reply and manage endpoints. -{% /admonition %} - -{% admonition type="info" %} -This endpoint handles both **conversation updates** and **custom object associations**. +You can redact a conversation part or the source message of a conversation (as seen in the source object). -See _`update a conversation with an association to a custom object instance`_ in the request/response examples to see the custom object association format. +{% admonition type="info" name="Redacting parts and messages" %} +If you are redacting a conversation part, it must have a `body`. If you are redacting a source message, it must have been created by a contact. We will return a `conversation_part_not_redactable` error if these criteria are not met. {% /admonition %}
@@ -12856,15 +16530,10 @@ See _`update a conversation with an association to a custom object instance`_ in
```typescript -await client.unstable.conversations.updateConversation({ - id: 1, - display_as: "plaintext", - read: true, - title: "new conversation title", - custom_attributes: { - issue_type: "Billing", - priority: "High", - }, +await client.unstable.conversations.redactConversation({ + type: "conversation_part", + conversation_id: "19894788788", + conversation_part_id: "19381789428", }); ``` @@ -12881,7 +16550,7 @@ await client.unstable.conversations.updateConversation({
-**request:** `Intercom.unstable.UpdateConversationRequest` +**request:** `Intercom.RedactConversationRequest`
@@ -12900,7 +16569,7 @@ await client.unstable.conversations.updateConversation({
-
client.unstable.conversations.deleteConversation({ ...params }) -> Intercom.ConversationDeleted +
client.unstable.conversations.convertConversationToTicket({ ...params }) -> Intercom.Ticket | undefined
@@ -12912,7 +16581,7 @@ await client.unstable.conversations.updateConversation({
-You can delete a single conversation. +You can convert a conversation to a ticket.
@@ -12928,8 +16597,9 @@ You can delete a single conversation.
```typescript -await client.unstable.conversations.deleteConversation({ +await client.unstable.conversations.convertConversationToTicket({ id: 1, + ticket_type_id: "53", }); ``` @@ -12946,7 +16616,7 @@ await client.unstable.conversations.deleteConversation({
-**request:** `Intercom.unstable.DeleteConversationRequest` +**request:** `Intercom.unstable.ConvertConversationToTicketRequest`
@@ -12965,7 +16635,9 @@ await client.unstable.conversations.deleteConversation({
-
client.unstable.conversations.searchConversations({ ...params }) -> Intercom.ConversationList +## Unstable CustomChannelEvents + +
client.unstable.customChannelEvents.notifyNewConversation({ ...params }) -> Intercom.CustomChannelNotificationResponse
@@ -12977,106 +16649,9 @@ await client.unstable.conversations.deleteConversation({
-You can search for multiple conversations by the value of their attributes in order to fetch exactly which ones you want. - -To search for conversations, you need to send a `POST` request to `https://api.intercom.io/conversations/search`. - -This will accept a query object in the body which will define your filters in order to search for conversations. -{% admonition type="warning" name="Optimizing search queries" %} -Search queries can be complex, so optimizing them can help the performance of your search. -Use the `AND` and `OR` operators to combine multiple filters to get the exact results you need and utilize -pagination to limit the number of results returned. The default is `20` results per page and maximum is `150`. -See the [pagination section](https://developers.intercom.com/docs/build-an-integration/learn-more/rest-apis/pagination/#example-search-conversations-request) for more details on how to use the `starting_after` param. -{% /admonition %} - -### Nesting & Limitations - -You can nest these filters in order to get even more granular insights that pinpoint exactly what you need. Example: (1 OR 2) AND (3 OR 4). -There are some limitations to the amount of multiple's there can be: - -- There's a limit of max 2 nested filters -- There's a limit of max 15 filters for each AND or OR group - -### Accepted Fields - -Most keys listed in the conversation model are searchable, whether writeable or not. The value you search for has to match the accepted type, otherwise the query will fail (ie. as `created_at` accepts a date, the `value` cannot be a string such as `"foorbar"`). -The `source.body` field is unique as the search will not be performed against the entire value, but instead against every element of the value separately. For example, when searching for a conversation with a `"I need support"` body - the query should contain a `=` operator with the value `"support"` for such conversation to be returned. A query with a `=` operator and a `"need support"` value will not yield a result. - -| Field | Type | -| :---------------------------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------- | -| id | String | -| created_at | Date (UNIX timestamp) | -| updated_at | Date (UNIX timestamp) | -| source.type | String
Accepted fields are `conversation`, `email`, `facebook`, `instagram`, `phone_call`, `phone_switch`, `push`, `sms`, `twitter` and `whatsapp`. | -| source.id | String | -| source.delivered_as | String | -| source.subject | String | -| source.body | String | -| source.author.id | String | -| source.author.type | String | -| source.author.name | String | -| source.author.email | String | -| source.url | String | -| contact_ids | String | -| teammate_ids | String | -| admin_assignee_id | String | -| team_assignee_id | String | -| channel_initiated | String | -| open | Boolean | -| read | Boolean | -| state | String | -| waiting_since | Date (UNIX timestamp) | -| snoozed_until | Date (UNIX timestamp) | -| tag_ids | String | -| priority | String | -| statistics.time_to_assignment | Integer | -| statistics.time_to_admin_reply | Integer | -| statistics.time_to_first_close | Integer | -| statistics.time_to_last_close | Integer | -| statistics.median_time_to_reply | Integer | -| statistics.first_contact_reply_at | Date (UNIX timestamp) | -| statistics.first_assignment_at | Date (UNIX timestamp) | -| statistics.first_admin_reply_at | Date (UNIX timestamp) | -| statistics.first_close_at | Date (UNIX timestamp) | -| statistics.last_assignment_at | Date (UNIX timestamp) | -| statistics.last_assignment_admin_reply_at | Date (UNIX timestamp) | -| statistics.last_contact_reply_at | Date (UNIX timestamp) | -| statistics.last_admin_reply_at | Date (UNIX timestamp) | -| statistics.last_close_at | Date (UNIX timestamp) | -| statistics.last_closed_by_id | String | -| statistics.count_reopens | Integer | -| statistics.count_assignments | Integer | -| statistics.count_conversation_parts | Integer | -| conversation_rating.requested_at | Date (UNIX timestamp) | -| conversation_rating.replied_at | Date (UNIX timestamp) | -| conversation_rating.score | Integer | -| conversation_rating.remark | String | -| conversation_rating.contact_id | String | -| conversation_rating.admin_d | String | -| ai_agent_participated | Boolean | -| ai_agent.resolution_state | String | -| ai_agent.last_answer_type | String | -| ai_agent.rating | Integer | -| ai_agent.rating_remark | String | -| ai_agent.source_type | String | -| ai_agent.source_title | String | - -### Accepted Operators - -The table below shows the operators you can use to define how you want to search for the value. The operator should be put in as a string (`"="`). The operator has to be compatible with the field's type (eg. you cannot search with `>` for a given string value as it's only compatible for integer's and dates). +Notifies Intercom that a new conversation was created in your custom channel/platform. This triggers conversation creation and workflow automations within Intercom for your custom channel integration. -| Operator | Valid Types | Description | -| :------- | :---------------------------- | :--------------------------------------------------------- | -| = | All | Equals | -| != | All | Doesn't Equal | -| IN | All | In Shortcut for `OR` queries Values most be in Array | -| NIN | All | Not In Shortcut for `OR !` queries Values must be in Array | -| > | Integer Date (UNIX Timestamp) | Greater (or equal) than | -| < | Integer Date (UNIX Timestamp) | Lower (or equal) than | -| ~ | String | Contains | -| !~ | String | Doesn't Contain | -| ^ | String | Starts With | -| $ | String | Ends With | +> **Note:** This endpoint is currently under managed availability. Please reach out to your accounts team to discuss access and tailored, hands-on support.
@@ -13092,19 +16667,14 @@ The table below shows the operators you can use to define how you want to search
```typescript -await client.unstable.conversations.searchConversations({ - query: { - operator: "AND", - value: [ - { - field: "created_at", - operator: ">", - value: "1306054154", - }, - ], - }, - pagination: { - per_page: 5, +await client.unstable.customChannelEvents.notifyNewConversation({ + event_id: "evt_12345", + external_conversation_id: "conv_67890", + contact: { + type: "user", + external_id: "user_001", + name: "Jane Doe", + email: "jane.doe@example.com", }, }); ``` @@ -13122,7 +16692,7 @@ await client.unstable.conversations.searchConversations({
-**request:** `Intercom.SearchRequest` +**request:** `Intercom.CustomChannelBaseEvent`
@@ -13130,7 +16700,7 @@ await client.unstable.conversations.searchConversations({
-**requestOptions:** `Conversations.RequestOptions` +**requestOptions:** `CustomChannelEvents.RequestOptions`
@@ -13141,7 +16711,7 @@ await client.unstable.conversations.searchConversations({
-
client.unstable.conversations.replyConversation({ ...params }) -> Intercom.Conversation +
client.unstable.customChannelEvents.notifyNewMessage({ ...params }) -> Intercom.CustomChannelNotificationResponse
@@ -13153,7 +16723,9 @@ await client.unstable.conversations.searchConversations({
-You can reply to a conversation with a message from an admin or on behalf of a contact, or with a note for admins. +Notifies Intercom that a new message was sent in a conversation on your custom channel/platform. This allows Intercom to process the message and trigger any relevant workflow automations. + +> **Note:** This endpoint is currently under managed availability. Please reach out to your accounts team to discuss access and tailored, hands-on support.
@@ -13169,14 +16741,16 @@ You can reply to a conversation with a message from an admin or on behalf of a c
```typescript -await client.unstable.conversations.replyConversation({ - id: '123 or "last"', - body: { - message_type: "comment", +await client.unstable.customChannelEvents.notifyNewMessage({ + event_id: "evt_54321", + external_conversation_id: "conv_98765", + contact: { type: "user", - body: "Thanks again :)", - intercom_user_id: "6762f1571bb69f9f2193bbbb", + external_id: "user_002", + name: "John Smith", + email: "john.smith@example.com", }, + body: "Hello, I need help with my order.", }); ``` @@ -13193,7 +16767,7 @@ await client.unstable.conversations.replyConversation({
-**request:** `Intercom.unstable.ReplyConversationRequest` +**request:** `Intercom.unstable.NotifyNewMessageRequest`
@@ -13201,7 +16775,7 @@ await client.unstable.conversations.replyConversation({
-**requestOptions:** `Conversations.RequestOptions` +**requestOptions:** `CustomChannelEvents.RequestOptions`
@@ -13212,7 +16786,7 @@ await client.unstable.conversations.replyConversation({
-
client.unstable.conversations.manageConversation({ ...params }) -> Intercom.Conversation +
client.unstable.customChannelEvents.notifyQuickReplySelected({ ...params }) -> Intercom.CustomChannelNotificationResponse
@@ -13224,16 +16798,14 @@ await client.unstable.conversations.replyConversation({
-For managing conversations you can: +Notifies Intercom that a user selected a quick reply option in your custom channel/platform. This allows Intercom to process the response and trigger any relevant workflow automations. -- Close a conversation -- Snooze a conversation to reopen on a future date -- Open a conversation which is `snoozed` or `closed` -- Assign a conversation to an admin and/or team. -
-
-
-
+> **Note:** This endpoint is currently under managed availability. Please reach out to your accounts team to discuss access and tailored, hands-on support. + + + + + #### 🔌 Usage @@ -13244,13 +16816,16 @@ For managing conversations you can:
```typescript -await client.unstable.conversations.manageConversation({ - id: "123", - body: { - message_type: "close", - type: "admin", - admin_id: "12345", +await client.unstable.customChannelEvents.notifyQuickReplySelected({ + event_id: "evt_67890", + external_conversation_id: "conv_13579", + contact: { + type: "user", + external_id: "user_003", + name: "Alice Example", + email: "alice@example.com", }, + quick_reply_option_id: "1234", }); ``` @@ -13267,7 +16842,7 @@ await client.unstable.conversations.manageConversation({
-**request:** `Intercom.unstable.ManageConversationRequest` +**request:** `Intercom.unstable.NotifyQuickReplySelectedRequest`
@@ -13275,7 +16850,7 @@ await client.unstable.conversations.manageConversation({
-**requestOptions:** `Conversations.RequestOptions` +**requestOptions:** `CustomChannelEvents.RequestOptions`
@@ -13286,7 +16861,7 @@ await client.unstable.conversations.manageConversation({
-
client.unstable.conversations.attachContactToConversation({ ...params }) -> Intercom.Conversation +
client.unstable.customChannelEvents.notifyAttributeCollected({ ...params }) -> Intercom.CustomChannelNotificationResponse
@@ -13298,11 +16873,9 @@ await client.unstable.conversations.manageConversation({
-You can add participants who are contacts to a conversation, on behalf of either another contact or an admin. +Notifies Intercom that a user provided a response to an attribute collector in your custom channel/platform. This allows Intercom to process the attribute and trigger any relevant workflow automations. -{% admonition type="warning" name="Contacts without an email" %} -If you add a contact via the email parameter and there is no user/lead found on that workspace with he given email, then we will create a new contact with `role` set to `lead`. -{% /admonition %} +> **Note:** This endpoint is currently under managed availability. Please reach out to your accounts team to discuss access and tailored, hands-on support.
@@ -13318,11 +16891,18 @@ If you add a contact via the email parameter and there is no user/lead found on
```typescript -await client.unstable.conversations.attachContactToConversation({ - id: "123", - admin_id: "12345", - customer: { - intercom_user_id: "6762f19b1bb69f9f2193bbd4", +await client.unstable.customChannelEvents.notifyAttributeCollected({ + event_id: "evt_24680", + external_conversation_id: "conv_11223", + contact: { + type: "user", + external_id: "user_004", + name: "Bob Example", + email: "bob@example.com", + }, + attribute: { + id: "shipping_address", + value: "123 Main St, Springfield", }, }); ``` @@ -13340,7 +16920,7 @@ await client.unstable.conversations.attachContactToConversation({
-**request:** `Intercom.unstable.AttachContactToConversationRequest` +**request:** `Intercom.unstable.NotifyAttributeCollectedRequest`
@@ -13348,7 +16928,7 @@ await client.unstable.conversations.attachContactToConversation({
-**requestOptions:** `Conversations.RequestOptions` +**requestOptions:** `CustomChannelEvents.RequestOptions`
@@ -13359,7 +16939,9 @@ await client.unstable.conversations.attachContactToConversation({
-
client.unstable.conversations.detachContactFromConversation({ ...params }) -> Intercom.Conversation +## Custom Object Instances + +
client.unstable.customObjectInstances.getCustomObjectInstancesByExternalId({ ...params }) -> Intercom.CustomObjectInstance | undefined
@@ -13371,11 +16953,7 @@ await client.unstable.conversations.attachContactToConversation({
-You can add participants who are contacts to a conversation, on behalf of either another contact or an admin. - -{% admonition type="warning" name="Contacts without an email" %} -If you add a contact via the email parameter and there is no user/lead found on that workspace with he given email, then we will create a new contact with `role` set to `lead`. -{% /admonition %} +Fetch a Custom Object Instance by external_id.
@@ -13391,10 +16969,9 @@ If you add a contact via the email parameter and there is no user/lead found on
```typescript -await client.unstable.conversations.detachContactFromConversation({ - conversation_id: "123", - contact_id: "123", - admin_id: "5017690", +await client.unstable.customObjectInstances.getCustomObjectInstancesByExternalId({ + custom_object_type_identifier: "Order", + external_id: "external_id", }); ``` @@ -13411,7 +16988,7 @@ await client.unstable.conversations.detachContactFromConversation({
-**request:** `Intercom.unstable.DetachContactFromConversationRequest` +**request:** `Intercom.unstable.GetCustomObjectInstancesByExternalIdRequest`
@@ -13419,7 +16996,7 @@ await client.unstable.conversations.detachContactFromConversation({
-**requestOptions:** `Conversations.RequestOptions` +**requestOptions:** `CustomObjectInstances.RequestOptions`
@@ -13430,7 +17007,7 @@ await client.unstable.conversations.detachContactFromConversation({
-
client.unstable.conversations.redactConversation({ ...params }) -> Intercom.Conversation +
client.unstable.customObjectInstances.createCustomObjectInstances({ ...params }) -> Intercom.CustomObjectInstance | undefined
@@ -13442,11 +17019,7 @@ await client.unstable.conversations.detachContactFromConversation({
-You can redact a conversation part or the source message of a conversation (as seen in the source object). - -{% admonition type="info" name="Redacting parts and messages" %} -If you are redacting a conversation part, it must have a `body`. If you are redacting a source message, it must have been created by a contact. We will return a `conversation_part_not_redactable` error if these criteria are not met. -{% /admonition %} +Create or update a custom object instance
@@ -13462,10 +17035,15 @@ If you are redacting a conversation part, it must have a `body`. If you are reda
```typescript -await client.unstable.conversations.redactConversation({ - type: "conversation_part", - conversation_id: "19894788788", - conversation_part_id: "19381789428", +await client.unstable.customObjectInstances.createCustomObjectInstances({ + custom_object_type_identifier: "Order", + external_id: "123", + external_created_at: 1392036272, + external_updated_at: 1392036272, + custom_attributes: { + order_number: "ORDER-12345", + total_amount: "custom_attributes", + }, }); ``` @@ -13482,7 +17060,7 @@ await client.unstable.conversations.redactConversation({
-**request:** `Intercom.RedactConversationRequest` +**request:** `Intercom.unstable.CreateOrUpdateCustomObjectInstanceRequest`
@@ -13490,7 +17068,7 @@ await client.unstable.conversations.redactConversation({
-**requestOptions:** `Conversations.RequestOptions` +**requestOptions:** `CustomObjectInstances.RequestOptions`
@@ -13501,7 +17079,7 @@ await client.unstable.conversations.redactConversation({
-
client.unstable.conversations.convertConversationToTicket({ ...params }) -> Intercom.Ticket | undefined +
client.unstable.customObjectInstances.deleteCustomObjectInstancesById({ ...params }) -> Intercom.CustomObjectInstanceDeleted
@@ -13513,7 +17091,7 @@ await client.unstable.conversations.redactConversation({
-You can convert a conversation to a ticket. +Delete a single Custom Object instance by external_id.
@@ -13529,9 +17107,9 @@ You can convert a conversation to a ticket.
```typescript -await client.unstable.conversations.convertConversationToTicket({ - id: 1, - ticket_type_id: "53", +await client.unstable.customObjectInstances.deleteCustomObjectInstancesById({ + custom_object_type_identifier: "Order", + external_id: "external_id", }); ``` @@ -13548,7 +17126,7 @@ await client.unstable.conversations.convertConversationToTicket({
-**request:** `Intercom.unstable.ConvertConversationToTicketRequest` +**request:** `Intercom.unstable.DeleteCustomObjectInstancesByIdRequest`
@@ -13556,7 +17134,7 @@ await client.unstable.conversations.convertConversationToTicket({
-**requestOptions:** `Conversations.RequestOptions` +**requestOptions:** `CustomObjectInstances.RequestOptions`
@@ -13567,9 +17145,7 @@ await client.unstable.conversations.convertConversationToTicket({
-## Unstable CustomChannelEvents - -
client.unstable.customChannelEvents.notifyNewConversation({ ...params }) -> Intercom.CustomChannelNotificationResponse +
client.unstable.customObjectInstances.getCustomObjectInstancesById({ ...params }) -> Intercom.CustomObjectInstance | undefined
@@ -13581,9 +17157,7 @@ await client.unstable.conversations.convertConversationToTicket({
-Notifies Intercom that a new conversation was created in your custom channel/platform. This triggers conversation creation and workflow automations within Intercom for your custom channel integration. - -> **Note:** This endpoint is restricted to customers with access to the closed beta for "Fin over API". +Fetch a Custom Object Instance by id.
@@ -13599,15 +17173,9 @@ Notifies Intercom that a new conversation was created in your custom channel/pla
```typescript -await client.unstable.customChannelEvents.notifyNewConversation({ - event_id: "evt_12345", - external_conversation_id: "conv_67890", - contact: { - type: "user", - external_id: "user_001", - name: "Jane Doe", - email: "jane.doe@example.com", - }, +await client.unstable.customObjectInstances.getCustomObjectInstancesById({ + custom_object_type_identifier: "Order", + id: "id", }); ``` @@ -13624,7 +17192,7 @@ await client.unstable.customChannelEvents.notifyNewConversation({
-**request:** `Intercom.CustomChannelBaseEvent` +**request:** `Intercom.unstable.GetCustomObjectInstancesByIdRequest`
@@ -13632,7 +17200,7 @@ await client.unstable.customChannelEvents.notifyNewConversation({
-**requestOptions:** `CustomChannelEvents.RequestOptions` +**requestOptions:** `CustomObjectInstances.RequestOptions`
@@ -13643,7 +17211,7 @@ await client.unstable.customChannelEvents.notifyNewConversation({
-
client.unstable.customChannelEvents.notifyNewMessage({ ...params }) -> Intercom.CustomChannelNotificationResponse +
client.unstable.customObjectInstances.deleteCustomObjectInstancesByExternalId({ ...params }) -> Intercom.CustomObjectInstanceDeleted
@@ -13655,9 +17223,7 @@ await client.unstable.customChannelEvents.notifyNewConversation({
-Notifies Intercom that a new message was sent in a conversation on your custom channel/platform. This allows Intercom to process the message and trigger any relevant workflow automations. - -> **Note:** This endpoint is restricted to customers with access to the closed beta for "Fin over API". +Delete a single Custom Object instance using the Intercom defined id.
@@ -13673,16 +17239,9 @@ Notifies Intercom that a new message was sent in a conversation on your custom c
```typescript -await client.unstable.customChannelEvents.notifyNewMessage({ - event_id: "evt_54321", - external_conversation_id: "conv_98765", - contact: { - type: "user", - external_id: "user_002", - name: "John Smith", - email: "john.smith@example.com", - }, - body: "Hello, I need help with my order.", +await client.unstable.customObjectInstances.deleteCustomObjectInstancesByExternalId({ + custom_object_type_identifier: "Order", + id: "id", }); ``` @@ -13699,7 +17258,7 @@ await client.unstable.customChannelEvents.notifyNewMessage({
-**request:** `Intercom.unstable.NotifyNewMessageRequest` +**request:** `Intercom.unstable.DeleteCustomObjectInstancesByExternalIdRequest`
@@ -13707,7 +17266,7 @@ await client.unstable.customChannelEvents.notifyNewMessage({
-**requestOptions:** `CustomChannelEvents.RequestOptions` +**requestOptions:** `CustomObjectInstances.RequestOptions`
@@ -13718,7 +17277,9 @@ await client.unstable.customChannelEvents.notifyNewMessage({
-
client.unstable.customChannelEvents.notifyQuickReplySelected({ ...params }) -> Intercom.CustomChannelNotificationResponse +## Data Attributes + +
client.unstable.dataAttributes.lisDataAttributes({ ...params }) -> Intercom.DataAttributeList
@@ -13730,9 +17291,7 @@ await client.unstable.customChannelEvents.notifyNewMessage({
-Notifies Intercom that a user selected a quick reply option in your custom channel/platform. This allows Intercom to process the response and trigger any relevant workflow automations. - -> **Note:** This endpoint is restricted to customers with access to the closed beta for "Fin over API". +You can fetch a list of all data attributes belonging to a workspace for contacts, companies or conversations.
@@ -13748,17 +17307,7 @@ Notifies Intercom that a user selected a quick reply option in your custom chann
```typescript -await client.unstable.customChannelEvents.notifyQuickReplySelected({ - event_id: "evt_67890", - external_conversation_id: "conv_13579", - contact: { - type: "user", - external_id: "user_003", - name: "Alice Example", - email: "alice@example.com", - }, - quick_reply_option_id: "1234", -}); +await client.unstable.dataAttributes.lisDataAttributes(); ```
@@ -13774,7 +17323,7 @@ await client.unstable.customChannelEvents.notifyQuickReplySelected({
-**request:** `Intercom.unstable.NotifyQuickReplySelectedRequest` +**request:** `Intercom.unstable.LisDataAttributesRequest`
@@ -13782,7 +17331,7 @@ await client.unstable.customChannelEvents.notifyQuickReplySelected({
-**requestOptions:** `CustomChannelEvents.RequestOptions` +**requestOptions:** `DataAttributes.RequestOptions`
@@ -13793,7 +17342,7 @@ await client.unstable.customChannelEvents.notifyQuickReplySelected({
-
client.unstable.customChannelEvents.notifyAttributeCollected({ ...params }) -> Intercom.CustomChannelNotificationResponse +
client.unstable.dataAttributes.createDataAttribute({ ...params }) -> Intercom.DataAttribute
@@ -13805,9 +17354,7 @@ await client.unstable.customChannelEvents.notifyQuickReplySelected({
-Notifies Intercom that a user provided a response to an attribute collector in your custom channel/platform. This allows Intercom to process the attribute and trigger any relevant workflow automations. - -> **Note:** This endpoint is restricted to customers with access to the closed beta for "Fin over API". +You can create a data attributes for a `contact` or a `company`.
@@ -13823,19 +17370,8 @@ Notifies Intercom that a user provided a response to an attribute collector in y
```typescript -await client.unstable.customChannelEvents.notifyAttributeCollected({ - event_id: "evt_24680", - external_conversation_id: "conv_11223", - contact: { - type: "user", - external_id: "user_004", - name: "Bob Example", - email: "bob@example.com", - }, - attribute: { - id: "shipping_address", - value: "123 Main St, Springfield", - }, +await client.unstable.dataAttributes.createDataAttribute({ + key: "value", }); ``` @@ -13852,7 +17388,7 @@ await client.unstable.customChannelEvents.notifyAttributeCollected({
-**request:** `Intercom.unstable.NotifyAttributeCollectedRequest` +**request:** `unknown`
@@ -13860,7 +17396,7 @@ await client.unstable.customChannelEvents.notifyAttributeCollected({
-**requestOptions:** `CustomChannelEvents.RequestOptions` +**requestOptions:** `DataAttributes.RequestOptions`
@@ -13871,9 +17407,7 @@ await client.unstable.customChannelEvents.notifyAttributeCollected({
-## Custom Object Instances - -
client.unstable.customObjectInstances.getCustomObjectInstancesByExternalId({ ...params }) -> Intercom.CustomObjectInstance | undefined +
client.unstable.dataAttributes.updateDataAttribute({ ...params }) -> Intercom.DataAttribute
@@ -13885,7 +17419,11 @@ await client.unstable.customChannelEvents.notifyAttributeCollected({
-Fetch a Custom Object Instance by external_id. +You can update a data attribute. + +> 🚧 Updating the data type is not possible +> +> It is currently a dangerous action to execute changing a data attribute's type via the API. You will need to update the type via the UI instead.
@@ -13901,9 +17439,11 @@ Fetch a Custom Object Instance by external_id.
```typescript -await client.unstable.customObjectInstances.getCustomObjectInstancesByExternalId({ - custom_object_type_identifier: "Order", - external_id: "external_id", +await client.unstable.dataAttributes.updateDataAttribute({ + id: 1, + body: { + key: "value", + }, }); ``` @@ -13920,7 +17460,7 @@ await client.unstable.customObjectInstances.getCustomObjectInstancesByExternalId
-**request:** `Intercom.unstable.GetCustomObjectInstancesByExternalIdRequest` +**request:** `Intercom.unstable.UpdateDataAttributeRequest`
@@ -13928,7 +17468,7 @@ await client.unstable.customObjectInstances.getCustomObjectInstancesByExternalId
-**requestOptions:** `CustomObjectInstances.RequestOptions` +**requestOptions:** `DataAttributes.RequestOptions`
@@ -13939,7 +17479,9 @@ await client.unstable.customObjectInstances.getCustomObjectInstancesByExternalId
-
client.unstable.customObjectInstances.createCustomObjectInstances({ ...params }) -> Intercom.CustomObjectInstance | undefined +## Data Events + +
client.unstable.dataEvents.lisDataEvents({ ...params }) -> Intercom.DataEventSummary
@@ -13951,7 +17493,19 @@ await client.unstable.customObjectInstances.getCustomObjectInstancesByExternalId
-Create or update a custom object instance +> 🚧 +> +> Please note that you can only 'list' events that are less than 90 days old. Event counts and summaries will still include your events older than 90 days but you cannot 'list' these events individually if they are older than 90 days + +The events belonging to a customer can be listed by sending a GET request to `https://api.intercom.io/events` with a user or lead identifier along with a `type` parameter. The identifier parameter can be one of `user_id`, `email` or `intercom_user_id`. The `type` parameter value must be `user`. + +- `https://api.intercom.io/events?type=user&user_id={user_id}` +- `https://api.intercom.io/events?type=user&email={email}` +- `https://api.intercom.io/events?type=user&intercom_user_id={id}` (this call can be used to list leads) + +The `email` parameter value should be [url encoded](http://en.wikipedia.org/wiki/Percent-encoding) when sending. + +You can optionally define the result page size as well with the `per_page` parameter.
@@ -13967,15 +17521,11 @@ Create or update a custom object instance
```typescript -await client.unstable.customObjectInstances.createCustomObjectInstances({ - custom_object_type_identifier: "Order", - external_id: "123", - external_created_at: 1392036272, - external_updated_at: 1392036272, - custom_attributes: { - order_number: "ORDER-12345", - total_amount: "custom_attributes", +await client.unstable.dataEvents.lisDataEvents({ + filter: { + user_id: "user_id", }, + type: "type", }); ``` @@ -13992,7 +17542,7 @@ await client.unstable.customObjectInstances.createCustomObjectInstances({
-**request:** `Intercom.unstable.CreateOrUpdateCustomObjectInstanceRequest` +**request:** `Intercom.unstable.LisDataEventsRequest`
@@ -14000,7 +17550,7 @@ await client.unstable.customObjectInstances.createCustomObjectInstances({
-**requestOptions:** `CustomObjectInstances.RequestOptions` +**requestOptions:** `DataEvents.RequestOptions`
@@ -14011,24 +17561,62 @@ await client.unstable.customObjectInstances.createCustomObjectInstances({
-
client.unstable.customObjectInstances.deleteCustomObjectInstancesById({ ...params }) -> Intercom.CustomObjectInstanceDeleted +
client.unstable.dataEvents.createDataEvent({ ...params }) -> void +
+
+ +#### 📝 Description + +
+
+
-#### 📝 Description +You will need an Access Token that has write permissions to send Events. Once you have a key you can submit events via POST to the Events resource, which is located at https://api.intercom.io/events, or you can send events using one of the client libraries. When working with the HTTP API directly a client should send the event with a `Content-Type` of `application/json`. + +When using the JavaScript API, [adding the code to your app](http://docs.intercom.io/configuring-Intercom/tracking-user-events-in-your-app) makes the Events API available. Once added, you can submit an event using the `trackEvent` method. This will associate the event with the Lead or currently logged-in user or logged-out visitor/lead and send it to Intercom. The final parameter is a map that can be used to send optional metadata about the event. + +With the Ruby client you pass a hash describing the event to `Intercom::Event.create`, or call the `track_user` method directly on the current user object (e.g. `user.track_event`). + +**NB: For the JSON object types, please note that we do not currently support nested JSON structure.** + +| Type | Description | Example | +| :-------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------------- | +| String | The value is a JSON String | `"source":"desktop"` | +| Number | The value is a JSON Number | `"load": 3.67` | +| Date | The key ends with the String `_date` and the value is a [Unix timestamp](http://en.wikipedia.org/wiki/Unix_time), assumed to be in the [UTC](http://en.wikipedia.org/wiki/Coordinated_Universal_Time) timezone. | `"contact_date": 1392036272` | +| Link | The value is a HTTP or HTTPS URI. | `"article": "https://example.org/ab1de.html"` | +| Rich Link | The value is a JSON object that contains `url` and `value` keys. | `"article": {"url": "https://example.org/ab1de.html", "value":"the dude abides"}` | +| Monetary Amount | The value is a JSON object that contains `amount` and `currency` keys. The `amount` key is a positive integer representing the amount in cents. The price in the example to the right denotes €349.99. | `"price": {"amount": 34999, "currency": "eur"}` | + +**Lead Events** + +When submitting events for Leads, you will need to specify the Lead's `id`. + +**Metadata behaviour** + +- We currently limit the number of tracked metadata keys to 10 per event. Once the quota is reached, we ignore any further keys we receive. The first 10 metadata keys are determined by the order in which they are sent in with the event. +- It is not possible to change the metadata keys once the event has been sent. A new event will need to be created with the new keys and you can archive the old one. +- There might be up to 24 hrs delay when you send a new metadata for an existing event. + +**Event de-duplication** -
-
+The API may detect and ignore duplicate events. Each event is uniquely identified as a combination of the following data - the Workspace identifier, the Contact external identifier, the Data Event name and the Data Event created time. As a result, it is **strongly recommended** to send a second granularity Unix timestamp in the `created_at` field. -
-
+Duplicated events are responded to using the normal `202 Accepted` code - an error is not thrown, however repeat requests will be counted against any rate limit that is in place. -Delete a single Custom Object instance by external_id. +### HTTP API Responses -
-
-
-
+- Successful responses to submitted events return `202 Accepted` with an empty body. +- Unauthorised access will be rejected with a `401 Unauthorized` or `403 Forbidden` response code. +- Events sent about users that cannot be found will return a `404 Not Found`. +- Event lists containing duplicate events will have those duplicates ignored. +- Server errors will return a `500` response code and may contain an error message in the body. +
+
+
+
#### 🔌 Usage @@ -14039,9 +17627,8 @@ Delete a single Custom Object instance by external_id.
```typescript -await client.unstable.customObjectInstances.deleteCustomObjectInstancesById({ - custom_object_type_identifier: "Order", - external_id: "external_id", +await client.unstable.dataEvents.createDataEvent({ + key: "value", }); ``` @@ -14058,7 +17645,7 @@ await client.unstable.customObjectInstances.deleteCustomObjectInstancesById({
-**request:** `Intercom.unstable.DeleteCustomObjectInstancesByIdRequest` +**request:** `Intercom.CreateDataEventRequestTwo`
@@ -14066,7 +17653,7 @@ await client.unstable.customObjectInstances.deleteCustomObjectInstancesById({
-**requestOptions:** `CustomObjectInstances.RequestOptions` +**requestOptions:** `DataEvents.RequestOptions`
@@ -14077,7 +17664,7 @@ await client.unstable.customObjectInstances.deleteCustomObjectInstancesById({
-
client.unstable.customObjectInstances.getCustomObjectInstancesById({ ...params }) -> Intercom.CustomObjectInstance | undefined +
client.unstable.dataEvents.dataEventSummaries({ ...params }) -> void
@@ -14089,7 +17676,7 @@ await client.unstable.customObjectInstances.deleteCustomObjectInstancesById({
-Fetch a Custom Object Instance by id. +Create event summaries for a user. Event summaries are used to track the number of times an event has occurred, the first time it occurred and the last time it occurred.
@@ -14105,10 +17692,7 @@ Fetch a Custom Object Instance by id.
```typescript -await client.unstable.customObjectInstances.getCustomObjectInstancesById({ - custom_object_type_identifier: "Order", - id: "id", -}); +await client.unstable.dataEvents.dataEventSummaries(); ```
@@ -14124,7 +17708,7 @@ await client.unstable.customObjectInstances.getCustomObjectInstancesById({
-**request:** `Intercom.unstable.GetCustomObjectInstancesByIdRequest` +**request:** `Intercom.unstable.CreateDataEventSummariesRequest`
@@ -14132,7 +17716,7 @@ await client.unstable.customObjectInstances.getCustomObjectInstancesById({
-**requestOptions:** `CustomObjectInstances.RequestOptions` +**requestOptions:** `DataEvents.RequestOptions`
@@ -14143,7 +17727,9 @@ await client.unstable.customObjectInstances.getCustomObjectInstancesById({
-
client.unstable.customObjectInstances.deleteCustomObjectInstancesByExternalId({ ...params }) -> Intercom.CustomObjectInstanceDeleted +## Data Export + +
client.unstable.dataExport.createDataExport({ ...params }) -> Intercom.DataExport
@@ -14155,7 +17741,21 @@ await client.unstable.customObjectInstances.getCustomObjectInstancesById({
-Delete a single Custom Object instance using the Intercom defined id. +To create your export job, you need to send a `POST` request to the export endpoint `https://api.intercom.io/export/content/data`. + +The only parameters you need to provide are the range of dates that you want exported. + +> 🚧 Limit of one active job +> +> You can only have one active job per workspace. You will receive a HTTP status code of 429 with the message Exceeded rate limit of 1 pending message data export jobs if you attempt to create a second concurrent job. + +> ❗️ Updated_at not included +> +> It should be noted that the timeframe only includes messages sent during the time period and not messages that were only updated during this period. For example, if a message was updated yesterday but sent two days ago, you would need to set the created_at_after date before the message was sent to include that in your retrieval job. + +> 📘 Date ranges are inclusive +> +> Requesting data for 2018-06-01 until 2018-06-30 will get all data for those days including those specified - e.g. 2018-06-01 00:00:00 until 2018-06-30 23:59:99.
@@ -14171,9 +17771,9 @@ Delete a single Custom Object instance using the Intercom defined id.
```typescript -await client.unstable.customObjectInstances.deleteCustomObjectInstancesByExternalId({ - custom_object_type_identifier: "Order", - id: "id", +await client.unstable.dataExport.createDataExport({ + created_at_after: 1734519776, + created_at_before: 1734537776, }); ``` @@ -14190,7 +17790,7 @@ await client.unstable.customObjectInstances.deleteCustomObjectInstancesByExterna
-**request:** `Intercom.unstable.DeleteCustomObjectInstancesByExternalIdRequest` +**request:** `Intercom.unstable.CreateDataExportsRequest`
@@ -14198,7 +17798,7 @@ await client.unstable.customObjectInstances.deleteCustomObjectInstancesByExterna
-**requestOptions:** `CustomObjectInstances.RequestOptions` +**requestOptions:** `DataExport.RequestOptions`
@@ -14209,9 +17809,7 @@ await client.unstable.customObjectInstances.deleteCustomObjectInstancesByExterna
-## Data Attributes - -
client.unstable.dataAttributes.lisDataAttributes({ ...params }) -> Intercom.DataAttributeList +
client.unstable.dataExport.getDataExport({ ...params }) -> Intercom.DataExport
@@ -14223,7 +17821,11 @@ await client.unstable.customObjectInstances.deleteCustomObjectInstancesByExterna
-You can fetch a list of all data attributes belonging to a workspace for contacts, companies or conversations. +You can view the status of your job by sending a `GET` request to the URL +`https://api.intercom.io/export/content/data/{job_identifier}` - the `{job_identifier}` is the value returned in the response when you first created the export job. More on it can be seen in the Export Job Model. + +> 🚧 Jobs expire after two days +> All jobs that have completed processing (and are thus available to download from the provided URL) will have an expiry limit of two days from when the export ob completed. After this, the data will no longer be available.
@@ -14239,7 +17841,9 @@ You can fetch a list of all data attributes belonging to a workspace for contact
```typescript -await client.unstable.dataAttributes.lisDataAttributes(); +await client.unstable.dataExport.getDataExport({ + job_identifier: "job_identifier", +}); ```
@@ -14255,7 +17859,7 @@ await client.unstable.dataAttributes.lisDataAttributes();
-**request:** `Intercom.unstable.LisDataAttributesRequest` +**request:** `Intercom.unstable.GetDataExportRequest`
@@ -14263,7 +17867,7 @@ await client.unstable.dataAttributes.lisDataAttributes();
-**requestOptions:** `DataAttributes.RequestOptions` +**requestOptions:** `DataExport.RequestOptions`
@@ -14274,7 +17878,7 @@ await client.unstable.dataAttributes.lisDataAttributes();
-
client.unstable.dataAttributes.createDataAttribute({ ...params }) -> Intercom.DataAttribute +
client.unstable.dataExport.cancelDataExport({ ...params }) -> Intercom.DataExport
@@ -14286,7 +17890,7 @@ await client.unstable.dataAttributes.lisDataAttributes();
-You can create a data attributes for a `contact` or a `company`. +You can cancel your job
@@ -14302,10 +17906,8 @@ You can create a data attributes for a `contact` or a `company`.
```typescript -await client.unstable.dataAttributes.createDataAttribute({ - name: "Mithril Shirt", - model: "company", - data_type: "string", +await client.unstable.dataExport.cancelDataExport({ + job_identifier: "job_identifier", }); ``` @@ -14322,7 +17924,7 @@ await client.unstable.dataAttributes.createDataAttribute({
-**request:** `Intercom.unstable.CreateDataAttributeRequest` +**request:** `Intercom.unstable.CancelDataExportRequest`
@@ -14330,7 +17932,7 @@ await client.unstable.dataAttributes.createDataAttribute({
-**requestOptions:** `DataAttributes.RequestOptions` +**requestOptions:** `DataExport.RequestOptions`
@@ -14341,7 +17943,7 @@ await client.unstable.dataAttributes.createDataAttribute({
-
client.unstable.dataAttributes.updateDataAttribute({ ...params }) -> Intercom.DataAttribute +
client.unstable.dataExport.downloadDataExport({ ...params }) -> void
@@ -14353,11 +17955,13 @@ await client.unstable.dataAttributes.createDataAttribute({
-You can update a data attribute. +When a job has a status of complete, and thus a filled download_url, you can download your data by hitting that provided URL, formatted like so: https://api.intercom.io/download/content/data/xyz1234. -> 🚧 Updating the data type is not possible +Your exported message data will be streamed continuously back down to you in a gzipped CSV format. + +> 📘 Octet header required > -> It is currently a dangerous action to execute changing a data attribute's type via the API. You will need to update the type via the UI instead. +> You will have to specify the header Accept: `application/octet-stream` when hitting this endpoint.
@@ -14373,11 +17977,8 @@ You can update a data attribute.
```typescript -await client.unstable.dataAttributes.updateDataAttribute({ - id: 1, - archived: false, - description: "Just a plain old ring", - options: ["options", "options"], +await client.unstable.dataExport.downloadDataExport({ + job_identifier: "job_identifier", }); ``` @@ -14394,7 +17995,7 @@ await client.unstable.dataAttributes.updateDataAttribute({
-**request:** `Intercom.unstable.UpdateDataAttributeRequest` +**request:** `Intercom.unstable.DownloadDataExportRequest`
@@ -14402,7 +18003,7 @@ await client.unstable.dataAttributes.updateDataAttribute({
-**requestOptions:** `DataAttributes.RequestOptions` +**requestOptions:** `DataExport.RequestOptions`
@@ -14413,9 +18014,9 @@ await client.unstable.dataAttributes.updateDataAttribute({
-## Data Events +## Jobs -
client.unstable.dataEvents.lisDataEvents({ ...params }) -> Intercom.DataEventSummary +
client.unstable.jobs.status({ ...params }) -> Intercom.Jobs
@@ -14427,19 +18028,7 @@ await client.unstable.dataAttributes.updateDataAttribute({
-> 🚧 -> -> Please note that you can only 'list' events that are less than 90 days old. Event counts and summaries will still include your events older than 90 days but you cannot 'list' these events individually if they are older than 90 days - -The events belonging to a customer can be listed by sending a GET request to `https://api.intercom.io/events` with a user or lead identifier along with a `type` parameter. The identifier parameter can be one of `user_id`, `email` or `intercom_user_id`. The `type` parameter value must be `user`. - -- `https://api.intercom.io/events?type=user&user_id={user_id}` -- `https://api.intercom.io/events?type=user&email={email}` -- `https://api.intercom.io/events?type=user&intercom_user_id={id}` (this call can be used to list leads) - -The `email` parameter value should be [url encoded](http://en.wikipedia.org/wiki/Percent-encoding) when sending. - -You can optionally define the result page size as well with the `per_page` parameter. +Retrieve the status of job execution.
@@ -14455,11 +18044,8 @@ You can optionally define the result page size as well with the `per_page` param
```typescript -await client.unstable.dataEvents.lisDataEvents({ - filter: { - user_id: "user_id", - }, - type: "type", +await client.unstable.jobs.status({ + id: "id", }); ``` @@ -14476,7 +18062,7 @@ await client.unstable.dataEvents.lisDataEvents({
-**request:** `Intercom.unstable.LisDataEventsRequest` +**request:** `Intercom.unstable.JobsStatusRequest`
@@ -14484,7 +18070,7 @@ await client.unstable.dataEvents.lisDataEvents({
-**requestOptions:** `DataEvents.RequestOptions` +**requestOptions:** `Jobs.RequestOptions`
@@ -14495,7 +18081,9 @@ await client.unstable.dataEvents.lisDataEvents({
-
client.unstable.dataEvents.createDataEvent({ ...params }) -> void +## Macros + +
client.unstable.macros.listMacros({ ...params }) -> Intercom.MacroList
@@ -14507,46 +18095,20 @@ await client.unstable.dataEvents.lisDataEvents({
-You will need an Access Token that has write permissions to send Events. Once you have a key you can submit events via POST to the Events resource, which is located at https://api.intercom.io/events, or you can send events using one of the client libraries. When working with the HTTP API directly a client should send the event with a `Content-Type` of `application/json`. - -When using the JavaScript API, [adding the code to your app](http://docs.intercom.io/configuring-Intercom/tracking-user-events-in-your-app) makes the Events API available. Once added, you can submit an event using the `trackEvent` method. This will associate the event with the Lead or currently logged-in user or logged-out visitor/lead and send it to Intercom. The final parameter is a map that can be used to send optional metadata about the event. - -With the Ruby client you pass a hash describing the event to `Intercom::Event.create`, or call the `track_user` method directly on the current user object (e.g. `user.track_event`). - -**NB: For the JSON object types, please note that we do not currently support nested JSON structure.** - -| Type | Description | Example | -| :-------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------------- | -| String | The value is a JSON String | `"source":"desktop"` | -| Number | The value is a JSON Number | `"load": 3.67` | -| Date | The key ends with the String `_date` and the value is a [Unix timestamp](http://en.wikipedia.org/wiki/Unix_time), assumed to be in the [UTC](http://en.wikipedia.org/wiki/Coordinated_Universal_Time) timezone. | `"contact_date": 1392036272` | -| Link | The value is a HTTP or HTTPS URI. | `"article": "https://example.org/ab1de.html"` | -| Rich Link | The value is a JSON object that contains `url` and `value` keys. | `"article": {"url": "https://example.org/ab1de.html", "value":"the dude abides"}` | -| Monetary Amount | The value is a JSON object that contains `amount` and `currency` keys. The `amount` key is a positive integer representing the amount in cents. The price in the example to the right denotes €349.99. | `"price": {"amount": 34999, "currency": "eur"}` | - -**Lead Events** - -When submitting events for Leads, you will need to specify the Lead's `id`. - -**Metadata behaviour** +You can fetch a list of all macros (saved replies) in your workspace for use in automating responses. -- We currently limit the number of tracked metadata keys to 10 per event. Once the quota is reached, we ignore any further keys we receive. The first 10 metadata keys are determined by the order in which they are sent in with the event. -- It is not possible to change the metadata keys once the event has been sent. A new event will need to be created with the new keys and you can archive the old one. -- There might be up to 24 hrs delay when you send a new metadata for an existing event. +The macros are returned in descending order by updated_at. -**Event de-duplication** +**Pagination** -The API may detect and ignore duplicate events. Each event is uniquely identified as a combination of the following data - the Workspace identifier, the Contact external identifier, the Data Event name and the Data Event created time. As a result, it is **strongly recommended** to send a second granularity Unix timestamp in the `created_at` field. +This endpoint uses cursor-based pagination via the `starting_after` parameter. The cursor is a Base64-encoded JSON array containing `[updated_at, id]` of the last item from the previous page. -Duplicated events are responded to using the normal `202 Accepted` code - an error is not thrown, however repeat requests will be counted against any rate limit that is in place. +**Placeholder Transformation** -### HTTP API Responses +The API transforms Intercom placeholders to a more standard XML-like format: -- Successful responses to submitted events return `202 Accepted` with an empty body. -- Unauthorised access will be rejected with a `401 Unauthorized` or `403 Forbidden` response code. -- Events sent about users that cannot be found will return a `404 Not Found`. -- Event lists containing duplicate events will have those duplicates ignored. -- Server errors will return a `500` response code and may contain an error message in the body. +- From: `{{user.name | fallback: 'there'}}` +- To: ``
@@ -14561,8 +18123,8 @@ Duplicated events are responded to using the normal `202 Accepted` code - an err
```typescript -await client.unstable.dataEvents.createDataEvent({ - key: "value", +await client.unstable.macros.listMacros({ + starting_after: "WzE3MTk0OTM3NTcuMCwgIjEyMyJd", }); ``` @@ -14579,7 +18141,7 @@ await client.unstable.dataEvents.createDataEvent({
-**request:** `Intercom.CreateDataEventRequestTwo` +**request:** `Intercom.unstable.ListMacrosRequest`
@@ -14587,7 +18149,7 @@ await client.unstable.dataEvents.createDataEvent({
-**requestOptions:** `DataEvents.RequestOptions` +**requestOptions:** `Macros.RequestOptions`
@@ -14598,7 +18160,7 @@ await client.unstable.dataEvents.createDataEvent({
-
client.unstable.dataEvents.dataEventSummaries({ ...params }) -> void +
client.unstable.macros.getMacro({ ...params }) -> Intercom.Macro | undefined
@@ -14610,7 +18172,25 @@ await client.unstable.dataEvents.createDataEvent({
-Create event summaries for a user. Event summaries are used to track the number of times an event has occurred, the first time it occurred and the last time it occurred. +You can fetch a single macro (saved reply) by its ID. The macro will only be returned if it is visible to the authenticated user based on its visibility settings. + +**Visibility Rules** + +A macro is returned based on its `visible_to` setting: + +- `everyone`: Always visible to all team members +- `specific_teams`: Only visible if the authenticated user belongs to one of the teams specified in `visible_to_team_ids` + +If a macro exists but is not visible to the authenticated user, a 404 error is returned. + +**Placeholder Transformation** + +The API transforms Intercom placeholders to a more standard XML-like format in the `body` field: + +- From: `{{user.name | fallback: 'there'}}` +- To: `` + +Default values in placeholders are HTML-escaped for security.
@@ -14626,7 +18206,9 @@ Create event summaries for a user. Event summaries are used to track the number
```typescript -await client.unstable.dataEvents.dataEventSummaries(); +await client.unstable.macros.getMacro({ + id: "123", +}); ```
@@ -14642,7 +18224,7 @@ await client.unstable.dataEvents.dataEventSummaries();
-**request:** `Intercom.unstable.CreateDataEventSummariesRequest` +**request:** `Intercom.unstable.GetMacroRequest`
@@ -14650,7 +18232,7 @@ await client.unstable.dataEvents.dataEventSummaries();
-**requestOptions:** `DataEvents.RequestOptions` +**requestOptions:** `Macros.RequestOptions`
@@ -14661,9 +18243,9 @@ await client.unstable.dataEvents.dataEventSummaries();
-## Data Export +## Messages -
client.unstable.dataExport.createDataExport({ ...params }) -> Intercom.DataExport +
client.unstable.messages.createMessage({ ...params }) -> Intercom.Message
@@ -14675,21 +18257,17 @@ await client.unstable.dataEvents.dataEventSummaries();
-To create your export job, you need to send a `POST` request to the export endpoint `https://api.intercom.io/export/content/data`. - -The only parameters you need to provide are the range of dates that you want exported. +You can create a message that has been initiated by an admin. The conversation can be either an in-app message, an email, sms or whatsapp. -> 🚧 Limit of one active job +> 🚧 Sending for visitors > -> You can only have one active job per workspace. You will receive a HTTP status code of 429 with the message Exceeded rate limit of 1 pending message data export jobs if you attempt to create a second concurrent job. +> There can be a short delay between when a contact is created and when a contact becomes available to be messaged through the API. A 404 Not Found error will be returned in this case. -> ❗️ Updated_at not included -> -> It should be noted that the timeframe only includes messages sent during the time period and not messages that were only updated during this period. For example, if a message was updated yesterday but sent two days ago, you would need to set the created_at_after date before the message was sent to include that in your retrieval job. +This will return the Message model that has been created. -> 📘 Date ranges are inclusive +> 🚧 Retrieving Associated Conversations > -> Requesting data for 2018-06-01 until 2018-06-30 will get all data for those days including those specified - e.g. 2018-06-01 00:00:00 until 2018-06-30 23:59:99. +> As this is a message, there will be no conversation present until the contact responds. Once they do, you will have to search for a contact's conversations with the id of the message.
@@ -14705,9 +18283,13 @@ The only parameters you need to provide are the range of dates that you want exp
```typescript -await client.unstable.dataExport.createDataExport({ - created_at_after: 1734519776, - created_at_before: 1734537776, +await client.unstable.messages.createMessage({ + from: { + type: "user", + id: "6762f2341bb69f9f2193bc17", + }, + body: "heyy", + referer: "https://twitter.com/bob", }); ``` @@ -14724,7 +18306,7 @@ await client.unstable.dataExport.createDataExport({
-**request:** `Intercom.unstable.CreateDataExportsRequest` +**request:** `Intercom.CreateMessageRequestThree`
@@ -14732,7 +18314,7 @@ await client.unstable.dataExport.createDataExport({
-**requestOptions:** `DataExport.RequestOptions` +**requestOptions:** `Messages.RequestOptions`
@@ -14743,7 +18325,7 @@ await client.unstable.dataExport.createDataExport({
-
client.unstable.dataExport.getDataExport({ ...params }) -> Intercom.DataExport +
client.unstable.messages.getWhatsAppMessageStatus({ ...params }) -> Intercom.WhatsappMessageStatusList
@@ -14755,11 +18337,10 @@ await client.unstable.dataExport.createDataExport({
-You can view the status of your job by sending a `GET` request to the URL -`https://api.intercom.io/export/content/data/{job_identifier}` - the `{job_identifier}` is the value returned in the response when you first created the export job. More on it can be seen in the Export Job Model. +Retrieves statuses of messages sent from the Outbound module. Currently, this API only supports WhatsApp messages. -> 🚧 Jobs expire after two days -> All jobs that have completed processing (and are thus available to download from the provided URL) will have an expiry limit of two days from when the export ob completed. After this, the data will no longer be available. +This endpoint returns paginated status events for WhatsApp messages sent via the Outbound module, providing +information about delivery state and related message details.
@@ -14775,8 +18356,8 @@ You can view the status of your job by sending a `GET` request to the URL
```typescript -await client.unstable.dataExport.getDataExport({ - job_identifier: "job_identifier", +await client.unstable.messages.getWhatsAppMessageStatus({ + ruleset_id: "ruleset_id", }); ``` @@ -14793,7 +18374,7 @@ await client.unstable.dataExport.getDataExport({
-**request:** `Intercom.unstable.GetDataExportRequest` +**request:** `Intercom.unstable.GetWhatsAppMessageStatusRequest`
@@ -14801,7 +18382,7 @@ await client.unstable.dataExport.getDataExport({
-**requestOptions:** `DataExport.RequestOptions` +**requestOptions:** `Messages.RequestOptions`
@@ -14812,7 +18393,9 @@ await client.unstable.dataExport.getDataExport({
-
client.unstable.dataExport.cancelDataExport({ ...params }) -> Intercom.DataExport +## News + +
client.unstable.news.listNewsItems() -> Intercom.PaginatedResponse
@@ -14824,7 +18407,7 @@ await client.unstable.dataExport.getDataExport({
-You can cancel your job +You can fetch a list of all news items
@@ -14840,9 +18423,7 @@ You can cancel your job
```typescript -await client.unstable.dataExport.cancelDataExport({ - job_identifier: "job_identifier", -}); +await client.unstable.news.listNewsItems(); ```
@@ -14858,15 +18439,7 @@ await client.unstable.dataExport.cancelDataExport({
-**request:** `Intercom.unstable.CancelDataExportRequest` - -
-
- -
-
- -**requestOptions:** `DataExport.RequestOptions` +**requestOptions:** `News.RequestOptions`
@@ -14877,7 +18450,7 @@ await client.unstable.dataExport.cancelDataExport({
-
client.unstable.dataExport.downloadDataExport({ ...params }) -> void +
client.unstable.news.createNewsItem({ ...params }) -> Intercom.NewsItem
@@ -14889,13 +18462,7 @@ await client.unstable.dataExport.cancelDataExport({
-When a job has a status of complete, and thus a filled download_url, you can download your data by hitting that provided URL, formatted like so: https://api.intercom.io/download/content/data/xyz1234. - -Your exported message data will be streamed continuously back down to you in a gzipped CSV format. - -> 📘 Octet header required -> -> You will have to specify the header Accept: `application/octet-stream` when hitting this endpoint. +You can create a news item
@@ -14911,8 +18478,20 @@ Your exported message data will be streamed continuously back down to you in a g
```typescript -await client.unstable.dataExport.downloadDataExport({ - job_identifier: "job_identifier", +await client.unstable.news.createNewsItem({ + title: "Halloween is here!", + body: "

New costumes in store for this spooky season

", + sender_id: 991267834, + state: "live", + deliver_silently: true, + labels: ["Product", "Update", "New"], + reactions: ["\uD83D\uDE06", "\uD83D\uDE05"], + newsfeed_assignments: [ + { + newsfeed_id: 53, + published_at: 1664638214, + }, + ], }); ``` @@ -14929,7 +18508,7 @@ await client.unstable.dataExport.downloadDataExport({
-**request:** `Intercom.unstable.DownloadDataExportRequest` +**request:** `Intercom.NewsItemRequest`
@@ -14937,7 +18516,7 @@ await client.unstable.dataExport.downloadDataExport({
-**requestOptions:** `DataExport.RequestOptions` +**requestOptions:** `News.RequestOptions`
@@ -14948,9 +18527,7 @@ await client.unstable.dataExport.downloadDataExport({
-## Jobs - -
client.unstable.jobs.status({ ...params }) -> Intercom.Jobs +
client.unstable.news.retrieveNewsItem({ ...params }) -> Intercom.NewsItem
@@ -14962,7 +18539,7 @@ await client.unstable.dataExport.downloadDataExport({
-Retrieve the status of job execution. +You can fetch the details of a single news item.
@@ -14978,8 +18555,8 @@ Retrieve the status of job execution.
```typescript -await client.unstable.jobs.status({ - id: "id", +await client.unstable.news.retrieveNewsItem({ + id: 1, }); ``` @@ -14996,7 +18573,7 @@ await client.unstable.jobs.status({
-**request:** `Intercom.unstable.JobsStatusRequest` +**request:** `Intercom.unstable.RetrieveNewsItemRequest`
@@ -15004,7 +18581,7 @@ await client.unstable.jobs.status({
-**requestOptions:** `Jobs.RequestOptions` +**requestOptions:** `News.RequestOptions`
@@ -15015,37 +18592,10 @@ await client.unstable.jobs.status({
-## Messages - -
client.unstable.messages.createMessage({ ...params }) -> Intercom.Message -
-
- -#### 📝 Description - -
-
- +
client.unstable.news.updateNewsItem({ ...params }) -> Intercom.NewsItem
-You can create a message that has been initiated by an admin. The conversation can be either an in-app message, an email or sms. - -> 🚧 Sending for visitors -> -> There can be a short delay between when a contact is created and when a contact becomes available to be messaged through the API. A 404 Not Found error will be returned in this case. - -This will return the Message model that has been created. - -> 🚧 Retrieving Associated Conversations -> -> As this is a message, there will be no conversation present until the contact responds. Once they do, you will have to search for a contact's conversations with the id of the message. - -
-
-
-
- #### 🔌 Usage
@@ -15055,13 +18605,14 @@ This will return the Message model that has been created.
```typescript -await client.unstable.messages.createMessage({ - from: { - type: "user", - id: "6762f2341bb69f9f2193bc17", +await client.unstable.news.updateNewsItem({ + id: 1, + body: { + title: "Christmas is here!", + body: "

New gifts in store for the jolly season

", + sender_id: 991267845, + reactions: ["\uD83D\uDE1D", "\uD83D\uDE02"], }, - body: "heyy", - referer: "https://twitter.com/bob", }); ``` @@ -15078,7 +18629,7 @@ await client.unstable.messages.createMessage({
-**request:** `Intercom.CreateMessageRequestTwo` +**request:** `Intercom.unstable.UpdateNewsItemRequest`
@@ -15086,7 +18637,7 @@ await client.unstable.messages.createMessage({
-**requestOptions:** `Messages.RequestOptions` +**requestOptions:** `News.RequestOptions`
@@ -15097,7 +18648,7 @@ await client.unstable.messages.createMessage({
-
client.unstable.messages.getWhatsAppMessageStatus({ ...params }) -> Intercom.WhatsappMessageStatusList +
client.unstable.news.deleteNewsItem({ ...params }) -> Intercom.DeletedObject
@@ -15109,10 +18660,7 @@ await client.unstable.messages.createMessage({
-Retrieves statuses of messages sent from the Outbound module. Currently, this API only supports WhatsApp messages. - -This endpoint returns paginated status events for WhatsApp messages sent via the Outbound module, providing -information about delivery state and related message details. +You can delete a single news item.
@@ -15128,8 +18676,8 @@ information about delivery state and related message details.
```typescript -await client.unstable.messages.getWhatsAppMessageStatus({ - ruleset_id: "ruleset_id", +await client.unstable.news.deleteNewsItem({ + id: 1, }); ``` @@ -15146,7 +18694,7 @@ await client.unstable.messages.getWhatsAppMessageStatus({
-**request:** `Intercom.unstable.GetWhatsAppMessageStatusRequest` +**request:** `Intercom.unstable.DeleteNewsItemRequest`
@@ -15154,7 +18702,7 @@ await client.unstable.messages.getWhatsAppMessageStatus({
-**requestOptions:** `Messages.RequestOptions` +**requestOptions:** `News.RequestOptions`
@@ -15165,9 +18713,7 @@ await client.unstable.messages.getWhatsAppMessageStatus({
-## News - -
client.unstable.news.listNewsItems() -> Intercom.PaginatedResponse +
client.unstable.news.listLiveNewsfeedItems({ ...params }) -> Intercom.PaginatedResponse
@@ -15179,7 +18725,7 @@ await client.unstable.messages.getWhatsAppMessageStatus({
-You can fetch a list of all news items +You can fetch a list of all news items that are live on a given newsfeed
@@ -15195,7 +18741,9 @@ You can fetch a list of all news items
```typescript -await client.unstable.news.listNewsItems(); +await client.unstable.news.listLiveNewsfeedItems({ + id: "123", +}); ```
@@ -15211,6 +18759,14 @@ await client.unstable.news.listNewsItems();
+**request:** `Intercom.unstable.ListLiveNewsfeedItemsRequest` + +
+
+ +
+
+ **requestOptions:** `News.RequestOptions`
@@ -15222,7 +18778,7 @@ await client.unstable.news.listNewsItems();
-
client.unstable.news.createNewsItem({ ...params }) -> Intercom.NewsItem +
client.unstable.news.listNewsfeeds() -> Intercom.PaginatedResponse
@@ -15234,7 +18790,7 @@ await client.unstable.news.listNewsItems();
-You can create a news item +You can fetch a list of all newsfeeds
@@ -15250,21 +18806,7 @@ You can create a news item
```typescript -await client.unstable.news.createNewsItem({ - title: "Halloween is here!", - body: "

New costumes in store for this spooky season

", - sender_id: 991267834, - state: "live", - deliver_silently: true, - labels: ["Product", "Update", "New"], - reactions: ["\uD83D\uDE06", "\uD83D\uDE05"], - newsfeed_assignments: [ - { - newsfeed_id: 53, - published_at: 1664638214, - }, - ], -}); +await client.unstable.news.listNewsfeeds(); ```
@@ -15280,14 +18822,6 @@ await client.unstable.news.createNewsItem({
-**request:** `Intercom.NewsItemRequest` - -
-
- -
-
- **requestOptions:** `News.RequestOptions`
@@ -15299,7 +18833,7 @@ await client.unstable.news.createNewsItem({
-
client.unstable.news.retrieveNewsItem({ ...params }) -> Intercom.NewsItem +
client.unstable.news.retrieveNewsfeed({ ...params }) -> Intercom.Newsfeed
@@ -15311,7 +18845,7 @@ await client.unstable.news.createNewsItem({
-You can fetch the details of a single news item. +You can fetch the details of a single newsfeed
@@ -15327,8 +18861,8 @@ You can fetch the details of a single news item.
```typescript -await client.unstable.news.retrieveNewsItem({ - id: 1, +await client.unstable.news.retrieveNewsfeed({ + id: "123", }); ``` @@ -15345,7 +18879,7 @@ await client.unstable.news.retrieveNewsItem({
-**request:** `Intercom.unstable.RetrieveNewsItemRequest` +**request:** `Intercom.unstable.RetrieveNewsfeedRequest`
@@ -15364,10 +18898,27 @@ await client.unstable.news.retrieveNewsItem({
-
client.unstable.news.updateNewsItem({ ...params }) -> Intercom.NewsItem +## Segments + +
client.unstable.segments.listSegments({ ...params }) -> Intercom.SegmentList +
+
+ +#### 📝 Description + +
+
+
+You can fetch a list of all segments. + +
+
+
+
+ #### 🔌 Usage
@@ -15377,15 +18928,7 @@ await client.unstable.news.retrieveNewsItem({
```typescript -await client.unstable.news.updateNewsItem({ - id: 1, - body: { - title: "Christmas is here!", - body: "

New gifts in store for the jolly season

", - sender_id: 991267845, - reactions: ["\uD83D\uDE1D", "\uD83D\uDE02"], - }, -}); +await client.unstable.segments.listSegments(); ```
@@ -15401,7 +18944,7 @@ await client.unstable.news.updateNewsItem({
-**request:** `Intercom.unstable.UpdateNewsItemRequest` +**request:** `Intercom.unstable.ListSegmentsRequest`
@@ -15409,7 +18952,7 @@ await client.unstable.news.updateNewsItem({
-**requestOptions:** `News.RequestOptions` +**requestOptions:** `Segments.RequestOptions`
@@ -15420,7 +18963,7 @@ await client.unstable.news.updateNewsItem({
-
client.unstable.news.deleteNewsItem({ ...params }) -> Intercom.DeletedObject +
client.unstable.segments.retrieveSegment({ ...params }) -> Intercom.Segment
@@ -15432,7 +18975,7 @@ await client.unstable.news.updateNewsItem({
-You can delete a single news item. +You can fetch the details of a single segment.
@@ -15448,8 +18991,8 @@ You can delete a single news item.
```typescript -await client.unstable.news.deleteNewsItem({ - id: 1, +await client.unstable.segments.retrieveSegment({ + id: "123", }); ``` @@ -15466,7 +19009,7 @@ await client.unstable.news.deleteNewsItem({
-**request:** `Intercom.unstable.DeleteNewsItemRequest` +**request:** `Intercom.unstable.RetrieveSegmentRequest`
@@ -15474,7 +19017,7 @@ await client.unstable.news.deleteNewsItem({
-**requestOptions:** `News.RequestOptions` +**requestOptions:** `Segments.RequestOptions`
@@ -15485,7 +19028,9 @@ await client.unstable.news.deleteNewsItem({
-
client.unstable.news.listLiveNewsfeedItems({ ...params }) -> Intercom.PaginatedResponse +## Switch + +
client.unstable.switch.createPhoneSwitch({ ...params }) -> Intercom.PhoneSwitch | undefined
@@ -15497,7 +19042,10 @@ await client.unstable.news.deleteNewsItem({
-You can fetch a list of all news items that are live on a given newsfeed +You can use the API to deflect phone calls to the Intercom Messenger. +Calling this endpoint will send an SMS with a link to the Messenger to the phone number specified. + +If custom attributes are specified, they will be added to the user or lead's custom data attributes.
@@ -15513,8 +19061,8 @@ You can fetch a list of all news items that are live on a given newsfeed
```typescript -await client.unstable.news.listLiveNewsfeedItems({ - id: "123", +await client.unstable.switch.createPhoneSwitch({ + key: "value", }); ``` @@ -15531,7 +19079,7 @@ await client.unstable.news.listLiveNewsfeedItems({
-**request:** `Intercom.unstable.ListLiveNewsfeedItemsRequest` +**request:** `unknown`
@@ -15539,7 +19087,7 @@ await client.unstable.news.listLiveNewsfeedItems({
-**requestOptions:** `News.RequestOptions` +**requestOptions:** `Switch.RequestOptions`
@@ -15550,7 +19098,9 @@ await client.unstable.news.listLiveNewsfeedItems({
-
client.unstable.news.listNewsfeeds() -> Intercom.PaginatedResponse +## Unstable Calls + +
client.unstable.calls.listCalls({ ...params }) -> Intercom.CallList
@@ -15562,7 +19112,7 @@ await client.unstable.news.listLiveNewsfeedItems({
-You can fetch a list of all newsfeeds +Retrieve a paginated list of calls.
@@ -15578,7 +19128,7 @@ You can fetch a list of all newsfeeds
```typescript -await client.unstable.news.listNewsfeeds(); +await client.unstable.calls.listCalls(); ```
@@ -15594,7 +19144,15 @@ await client.unstable.news.listNewsfeeds();
-**requestOptions:** `News.RequestOptions` +**request:** `Intercom.unstable.ListCallsRequest` + +
+
+ +
+
+ +**requestOptions:** `Calls.RequestOptions`
@@ -15605,7 +19163,7 @@ await client.unstable.news.listNewsfeeds();
-
client.unstable.news.retrieveNewsfeed({ ...params }) -> Intercom.Newsfeed +
client.unstable.calls.showCall({ ...params }) -> Intercom.Call
@@ -15617,7 +19175,7 @@ await client.unstable.news.listNewsfeeds();
-You can fetch the details of a single newsfeed +Retrieve a single call by id.
@@ -15633,8 +19191,8 @@ You can fetch the details of a single newsfeed
```typescript -await client.unstable.news.retrieveNewsfeed({ - id: "123", +await client.unstable.calls.showCall({ + id: "id", }); ``` @@ -15651,7 +19209,7 @@ await client.unstable.news.retrieveNewsfeed({
-**request:** `Intercom.unstable.RetrieveNewsfeedRequest` +**request:** `Intercom.unstable.ShowCallRequest`
@@ -15659,7 +19217,7 @@ await client.unstable.news.retrieveNewsfeed({
-**requestOptions:** `News.RequestOptions` +**requestOptions:** `Calls.RequestOptions`
@@ -15670,9 +19228,7 @@ await client.unstable.news.retrieveNewsfeed({
-## Segments - -
client.unstable.segments.listSegments({ ...params }) -> Intercom.SegmentList +
client.unstable.calls.showCallRecording({ ...params }) -> void
@@ -15684,7 +19240,7 @@ await client.unstable.news.retrieveNewsfeed({
-You can fetch a list of all segments. +Redirects to a signed URL for the call's recording if it exists.
@@ -15700,7 +19256,9 @@ You can fetch a list of all segments.
```typescript -await client.unstable.segments.listSegments(); +await client.unstable.calls.showCallRecording({ + id: "id", +}); ```
@@ -15716,7 +19274,7 @@ await client.unstable.segments.listSegments();
-**request:** `Intercom.unstable.ListSegmentsRequest` +**request:** `Intercom.unstable.ShowCallRecordingRequest`
@@ -15724,7 +19282,7 @@ await client.unstable.segments.listSegments();
-**requestOptions:** `Segments.RequestOptions` +**requestOptions:** `Calls.RequestOptions`
@@ -15735,7 +19293,7 @@ await client.unstable.segments.listSegments();
-
client.unstable.segments.retrieveSegment({ ...params }) -> Intercom.Segment +
client.unstable.calls.showCallTranscript({ ...params }) -> string
@@ -15747,7 +19305,7 @@ await client.unstable.segments.listSegments();
-You can fetch the details of a single segment. +Returns the transcript for the specified call as a downloadable text file.
@@ -15763,8 +19321,8 @@ You can fetch the details of a single segment.
```typescript -await client.unstable.segments.retrieveSegment({ - id: "123", +await client.unstable.calls.showCallTranscript({ + id: "id", }); ``` @@ -15781,7 +19339,7 @@ await client.unstable.segments.retrieveSegment({
-**request:** `Intercom.unstable.RetrieveSegmentRequest` +**request:** `Intercom.unstable.ShowCallTranscriptRequest`
@@ -15789,7 +19347,7 @@ await client.unstable.segments.retrieveSegment({
-**requestOptions:** `Segments.RequestOptions` +**requestOptions:** `Calls.RequestOptions`
@@ -15800,9 +19358,7 @@ await client.unstable.segments.retrieveSegment({
-## Switch - -
client.unstable.switch.createPhoneSwitch({ ...params }) -> Intercom.PhoneSwitch | undefined +
client.unstable.calls.listCallsWithTranscripts({ ...params }) -> Intercom.ListCallsWithTranscriptsResponse
@@ -15814,10 +19370,8 @@ await client.unstable.segments.retrieveSegment({
-You can use the API to deflect phone calls to the Intercom Messenger. -Calling this endpoint will send an SMS with a link to the Messenger to the phone number specified. - -If custom attributes are specified, they will be added to the user or lead's custom data attributes. +Retrieve calls by a list of conversation ids and include transcripts when available. +A maximum of 20 `conversation_ids` can be provided. If none are provided or more than 20 are provided, a 400 error is returned.
@@ -15833,8 +19387,8 @@ If custom attributes are specified, they will be added to the user or lead's cus
```typescript -await client.unstable.switch.createPhoneSwitch({ - key: "value", +await client.unstable.calls.listCallsWithTranscripts({ + conversation_ids: ["64619700005694", "64619700005695"], }); ``` @@ -15851,7 +19405,7 @@ await client.unstable.switch.createPhoneSwitch({
-**request:** `unknown` +**request:** `Intercom.unstable.ListCallsWithTranscriptsRequest`
@@ -15859,7 +19413,7 @@ await client.unstable.switch.createPhoneSwitch({
-**requestOptions:** `Switch.RequestOptions` +**requestOptions:** `Calls.RequestOptions`
@@ -16781,6 +20335,14 @@ The `source.body` field is unique as the search will not be performed against th | snoozed_until | Date (UNIX timestamp) | | ticket_attribute.{id} | String or Boolean or Date (UNIX timestamp) or Float or Integer | +{% admonition type="info" name="Searching by Category" %} +When searching for tickets by the **`category`** field, specific terms must be used instead of the category names: + +- For **Customer** category tickets, use the term `request`. +- For **Back-office** category tickets, use the term `task`. +- For **Tracker** category tickets, use the term `tracker`. + {% /admonition %} + ### Accepted Operators {% admonition type="info" name="Searching based on `created_at`" %} @@ -17076,3 +20638,248 @@ await client.unstable.visitors.convertVisitor({
+ +## Brands + +
client.unstable.brands.listBrands() -> Intercom.BrandList +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Retrieves all brands for the workspace, including the default brand. +The default brand id always matches the workspace + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.unstable.brands.listBrands(); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**requestOptions:** `Brands.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.unstable.brands.retrieveBrand({ ...params }) -> Intercom.Brand +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Fetches a specific brand by its unique identifier + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.unstable.brands.retrieveBrand({ + id: "id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Intercom.unstable.RetrieveBrandRequest` + +
+
+ +
+
+ +**requestOptions:** `Brands.RequestOptions` + +
+
+
+
+ +
+
+
+ +## Emails + +
client.unstable.emails.listEmails() -> Intercom.EmailList +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Lists all sender email address settings for the workspace + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.unstable.emails.listEmails(); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**requestOptions:** `Emails.RequestOptions` + +
+
+
+
+ +
+
+
+ +
client.unstable.emails.retrieveEmail({ ...params }) -> Intercom.EmailSetting +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Fetches a specific email setting by its unique identifier + +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.unstable.emails.retrieveEmail({ + id: "id", +}); +``` + +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Intercom.unstable.RetrieveEmailRequest` + +
+
+ +
+
+ +**requestOptions:** `Emails.RequestOptions` + +
+
+
+
+ +
+
+
diff --git a/src/Client.ts b/src/Client.ts index bdbba22c..f96c9d35 100644 --- a/src/Client.ts +++ b/src/Client.ts @@ -5,21 +5,30 @@ import * as environments from "./environments"; import * as core from "./core"; import { Admins } from "./api/resources/admins/client/Client"; +import { AiContent } from "./api/resources/aiContent/client/Client"; import { Articles } from "./api/resources/articles/client/Client"; +import { AwayStatusReasons } from "./api/resources/awayStatusReasons/client/Client"; +import { Export } from "./api/resources/export/client/Client"; +import { DataExport } from "./api/resources/dataExport/client/Client"; import { HelpCenters } from "./api/resources/helpCenters/client/Client"; +import { InternalArticles } from "./api/resources/internalArticles/client/Client"; import { Companies } from "./api/resources/companies/client/Client"; import { Contacts } from "./api/resources/contacts/client/Client"; import { Notes } from "./api/resources/notes/client/Client"; import { Tags } from "./api/resources/tags/client/Client"; import { Conversations } from "./api/resources/conversations/client/Client"; +import { CustomChannelEvents } from "./api/resources/customChannelEvents/client/Client"; +import { CustomObjectInstances } from "./api/resources/customObjectInstances/client/Client"; import { DataAttributes } from "./api/resources/dataAttributes/client/Client"; import { Events } from "./api/resources/events/client/Client"; -import { DataExport } from "./api/resources/dataExport/client/Client"; +import { Jobs } from "./api/resources/jobs/client/Client"; import { Messages } from "./api/resources/messages/client/Client"; import { Segments } from "./api/resources/segments/client/Client"; import { SubscriptionTypes } from "./api/resources/subscriptionTypes/client/Client"; import { PhoneCallRedirects } from "./api/resources/phoneCallRedirects/client/Client"; +import { Calls } from "./api/resources/calls/client/Client"; import { Teams } from "./api/resources/teams/client/Client"; +import { TicketStates } from "./api/resources/ticketStates/client/Client"; import { TicketTypes } from "./api/resources/ticketTypes/client/Client"; import { Tickets } from "./api/resources/tickets/client/Client"; import { Visitors } from "./api/resources/visitors/client/Client"; @@ -89,21 +98,30 @@ export declare namespace IntercomClient { export class IntercomClient { protected _admins: Admins | undefined; + protected _aiContent: AiContent | undefined; protected _articles: Articles | undefined; + protected _awayStatusReasons: AwayStatusReasons | undefined; + protected _export: Export | undefined; + protected _dataExport: DataExport | undefined; protected _helpCenters: HelpCenters | undefined; + protected _internalArticles: InternalArticles | undefined; protected _companies: Companies | undefined; protected _contacts: Contacts | undefined; protected _notes: Notes | undefined; protected _tags: Tags | undefined; protected _conversations: Conversations | undefined; + protected _customChannelEvents: CustomChannelEvents | undefined; + protected _customObjectInstances: CustomObjectInstances | undefined; protected _dataAttributes: DataAttributes | undefined; protected _events: Events | undefined; - protected _dataExport: DataExport | undefined; + protected _jobs: Jobs | undefined; protected _messages: Messages | undefined; protected _segments: Segments | undefined; protected _subscriptionTypes: SubscriptionTypes | undefined; protected _phoneCallRedirects: PhoneCallRedirects | undefined; + protected _calls: Calls | undefined; protected _teams: Teams | undefined; + protected _ticketStates: TicketStates | undefined; protected _ticketTypes: TicketTypes | undefined; protected _tickets: Tickets | undefined; protected _visitors: Visitors | undefined; @@ -116,14 +134,34 @@ export class IntercomClient { return (this._admins ??= new Admins(this._options)); } + public get aiContent(): AiContent { + return (this._aiContent ??= new AiContent(this._options)); + } + public get articles(): Articles { return (this._articles ??= new Articles(this._options)); } + public get awayStatusReasons(): AwayStatusReasons { + return (this._awayStatusReasons ??= new AwayStatusReasons(this._options)); + } + + public get export(): Export { + return (this._export ??= new Export(this._options)); + } + + public get dataExport(): DataExport { + return (this._dataExport ??= new DataExport(this._options)); + } + public get helpCenters(): HelpCenters { return (this._helpCenters ??= new HelpCenters(this._options)); } + public get internalArticles(): InternalArticles { + return (this._internalArticles ??= new InternalArticles(this._options)); + } + public get companies(): Companies { return (this._companies ??= new Companies(this._options)); } @@ -144,6 +182,14 @@ export class IntercomClient { return (this._conversations ??= new Conversations(this._options)); } + public get customChannelEvents(): CustomChannelEvents { + return (this._customChannelEvents ??= new CustomChannelEvents(this._options)); + } + + public get customObjectInstances(): CustomObjectInstances { + return (this._customObjectInstances ??= new CustomObjectInstances(this._options)); + } + public get dataAttributes(): DataAttributes { return (this._dataAttributes ??= new DataAttributes(this._options)); } @@ -152,8 +198,8 @@ export class IntercomClient { return (this._events ??= new Events(this._options)); } - public get dataExport(): DataExport { - return (this._dataExport ??= new DataExport(this._options)); + public get jobs(): Jobs { + return (this._jobs ??= new Jobs(this._options)); } public get messages(): Messages { @@ -172,10 +218,18 @@ export class IntercomClient { return (this._phoneCallRedirects ??= new PhoneCallRedirects(this._options)); } + public get calls(): Calls { + return (this._calls ??= new Calls(this._options)); + } + public get teams(): Teams { return (this._teams ??= new Teams(this._options)); } + public get ticketStates(): TicketStates { + return (this._ticketStates ??= new TicketStates(this._options)); + } + public get ticketTypes(): TicketTypes { return (this._ticketTypes ??= new TicketTypes(this._options)); } diff --git a/src/api/errors/TooManyRequestsError.ts b/src/api/errors/TooManyRequestsError.ts new file mode 100644 index 00000000..389235e6 --- /dev/null +++ b/src/api/errors/TooManyRequestsError.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as errors from "../../errors/index"; +import * as Intercom from "../index"; +import * as core from "../../core"; + +export class TooManyRequestsError extends errors.IntercomError { + constructor(body: Intercom.Error_, rawResponse?: core.RawResponse) { + super({ + message: "TooManyRequestsError", + statusCode: 429, + body: body, + rawResponse: rawResponse, + }); + Object.setPrototypeOf(this, TooManyRequestsError.prototype); + } +} diff --git a/src/api/errors/index.ts b/src/api/errors/index.ts index f81dc80f..c7eea160 100644 --- a/src/api/errors/index.ts +++ b/src/api/errors/index.ts @@ -1,5 +1,6 @@ +export * from "./BadRequestError"; export * from "./UnauthorizedError"; export * from "./NotFoundError"; -export * from "./BadRequestError"; +export * from "./TooManyRequestsError"; export * from "./ForbiddenError"; export * from "./UnprocessableEntityError"; diff --git a/src/api/resources/admins/client/Client.ts b/src/api/resources/admins/client/Client.ts index 007cc89c..48cdf3ff 100644 --- a/src/api/resources/admins/client/Client.ts +++ b/src/api/resources/admins/client/Client.ts @@ -88,13 +88,15 @@ export class Admins { * @example * await client.admins.identify() */ - public identify(requestOptions?: Admins.RequestOptions): core.HttpResponsePromise { + public identify( + requestOptions?: Admins.RequestOptions, + ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__identify(requestOptions)); } private async __identify( requestOptions?: Admins.RequestOptions, - ): Promise> { + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.baseUrl)) ?? @@ -107,8 +109,8 @@ export class Admins { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -121,7 +123,7 @@ export class Admins { abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return { data: _response.body as Intercom.AdminWithApp, rawResponse: _response.rawResponse }; + return { data: _response.body as Intercom.AdminWithApp | undefined, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { @@ -155,12 +157,21 @@ export class Admins { * @param {Intercom.ConfigureAwayAdminRequest} request * @param {Admins.RequestOptions} requestOptions - Request-specific configuration. * + * @throws {@link Intercom.BadRequestError} * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.NotFoundError} * * @example * await client.admins.away({ - * admin_id: "admin_id", + * admin_id: 1, + * away_mode_enabled: true, + * away_mode_reassign: true, + * away_status_reason_id: 12345 + * }) + * + * @example + * await client.admins.away({ + * admin_id: 1, * away_mode_enabled: true, * away_mode_reassign: true * }) @@ -168,14 +179,14 @@ export class Admins { public away( request: Intercom.ConfigureAwayAdminRequest, requestOptions?: Admins.RequestOptions, - ): core.HttpResponsePromise { + ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__away(request, requestOptions)); } private async __away( request: Intercom.ConfigureAwayAdminRequest, requestOptions?: Admins.RequestOptions, - ): Promise> { + ): Promise> { const { admin_id: adminId, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( @@ -189,8 +200,8 @@ export class Admins { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -204,11 +215,13 @@ export class Admins { abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return { data: _response.body as Intercom.Admin, rawResponse: _response.rawResponse }; + return { data: _response.body as Intercom.Admin | undefined, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { switch (_response.error.statusCode) { + case 400: + throw new Intercom.BadRequestError(_response.error.body as unknown, _response.rawResponse); case 401: throw new Intercom.UnauthorizedError( _response.error.body as Intercom.Error_, @@ -286,8 +299,8 @@ export class Admins { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -364,8 +377,8 @@ export class Admins { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -425,20 +438,20 @@ export class Admins { * * @example * await client.admins.find({ - * admin_id: "123" + * admin_id: 1 * }) */ public find( request: Intercom.FindAdminRequest, requestOptions?: Admins.RequestOptions, - ): core.HttpResponsePromise { + ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__find(request, requestOptions)); } private async __find( request: Intercom.FindAdminRequest, requestOptions?: Admins.RequestOptions, - ): Promise> { + ): Promise> { const { admin_id: adminId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( @@ -452,8 +465,8 @@ export class Admins { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -466,7 +479,7 @@ export class Admins { abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return { data: _response.body as Intercom.Admin, rawResponse: _response.rawResponse }; + return { data: _response.body as Intercom.Admin | undefined, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { diff --git a/src/api/resources/admins/client/requests/ConfigureAwayAdminRequest.ts b/src/api/resources/admins/client/requests/ConfigureAwayAdminRequest.ts index 524d1a23..bb4599d4 100644 --- a/src/api/resources/admins/client/requests/ConfigureAwayAdminRequest.ts +++ b/src/api/resources/admins/client/requests/ConfigureAwayAdminRequest.ts @@ -5,21 +5,22 @@ /** * @example * { - * admin_id: "admin_id", + * admin_id: 1, * away_mode_enabled: true, - * away_mode_reassign: true + * away_mode_reassign: true, + * away_status_reason_id: 12345 * } * * @example * { - * admin_id: "admin_id", + * admin_id: 1, * away_mode_enabled: true, * away_mode_reassign: true * } * * @example * { - * admin_id: "admin_id", + * admin_id: 1, * away_mode_enabled: true, * away_mode_reassign: true * } @@ -28,9 +29,11 @@ export interface ConfigureAwayAdminRequest { /** * The unique identifier of a given admin */ - admin_id: string; + admin_id: number; /** Set to "true" to change the status of the admin to away. */ away_mode_enabled: boolean; /** Set to "true" to assign any new conversation replies to your default inbox. */ away_mode_reassign: boolean; + /** The unique identifier of the away status reason */ + away_status_reason_id?: number; } diff --git a/src/api/resources/admins/client/requests/FindAdminRequest.ts b/src/api/resources/admins/client/requests/FindAdminRequest.ts index 85d66282..011b7dd3 100644 --- a/src/api/resources/admins/client/requests/FindAdminRequest.ts +++ b/src/api/resources/admins/client/requests/FindAdminRequest.ts @@ -5,12 +5,12 @@ /** * @example * { - * admin_id: "123" + * admin_id: 1 * } */ export interface FindAdminRequest { /** * The unique identifier of a given admin */ - admin_id: string; + admin_id: number; } diff --git a/src/api/resources/admins/types/Admin.ts b/src/api/resources/admins/types/Admin.ts index 33266da0..64a34550 100644 --- a/src/api/resources/admins/types/Admin.ts +++ b/src/api/resources/admins/types/Admin.ts @@ -9,7 +9,7 @@ import * as Intercom from "../../../index"; */ export interface Admin { /** String representing the object's type. Always has the value `admin`. */ - type?: "admin"; + type?: string; /** The id representing the admin. */ id: string; /** The name of the admin. */ @@ -17,26 +17,18 @@ export interface Admin { /** The email of the admin. */ email: string; /** The job title of the admin. */ - job_title: string; + job_title?: string; /** Identifies if this admin is currently set in away mode. */ away_mode_enabled: boolean; /** Identifies if this admin is set to automatically reassign new conversations to the apps default inbox. */ away_mode_reassign: boolean; + /** The unique identifier of the away status reason */ + away_status_reason_id?: number; /** Identifies if this admin has a paid inbox seat to restrict/allow features that require them. */ has_inbox_seat: boolean; /** This object represents the avatar associated with the admin. */ team_ids: number[]; - /** The avatar object associated with the admin */ - avatar?: Admin.Avatar; + /** Image for the associated team or teammate */ + avatar?: string; team_priority_level?: Intercom.TeamPriorityLevel; } - -export namespace Admin { - /** - * The avatar object associated with the admin - */ - export interface Avatar { - /** URL of the admin's avatar image */ - image_url: string; - } -} diff --git a/src/api/resources/aiAgent/types/AiAgent.ts b/src/api/resources/aiAgent/types/AiAgent.ts index af7c7974..a3d00c0c 100644 --- a/src/api/resources/aiAgent/types/AiAgent.ts +++ b/src/api/resources/aiAgent/types/AiAgent.ts @@ -9,7 +9,7 @@ import * as Intercom from "../../../index"; */ export interface AiAgent { /** The type of the source that triggered AI Agent involvement in the conversation. */ - source_type: AiAgent.SourceType; + source_type?: AiAgent.SourceType; /** The title of the source that triggered AI Agent involvement in the conversation. If this is `essentials_plan_setup` then it will return `null`. */ source_title?: string; /** The type of the last answer delivered by AI Agent. If no answer was delivered then this will return `null` */ @@ -20,6 +20,10 @@ export interface AiAgent { rating?: number; /** The customer satisfaction rating remark given to AI Agent. */ rating_remark?: string; + /** The time when the AI agent rating was created. */ + created_at?: number; + /** The time when the AI agent rating was last updated. */ + updated_at?: number; content_sources?: Intercom.ContentSourcesList; } diff --git a/src/api/resources/aiContent/client/Client.ts b/src/api/resources/aiContent/client/Client.ts new file mode 100644 index 00000000..f5b8aaa4 --- /dev/null +++ b/src/api/resources/aiContent/client/Client.ts @@ -0,0 +1,982 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Intercom from "../../../index"; +import urlJoin from "url-join"; +import * as errors from "../../../../errors/index"; + +export declare namespace AiContent { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Intercom-Version header */ + version?: + | "1.0" + | "1.1" + | "1.2" + | "1.3" + | "1.4" + | "2.0" + | "2.1" + | "2.2" + | "2.3" + | "2.4" + | "2.5" + | "2.6" + | "2.7" + | "2.8" + | "2.9" + | "2.10" + | "2.11" + | "Unstable"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Additional headers to include in the request. */ + headers?: Record; + /** Override the Intercom-Version header */ + version?: + | "1.0" + | "1.1" + | "1.2" + | "1.3" + | "1.4" + | "2.0" + | "2.1" + | "2.2" + | "2.3" + | "2.4" + | "2.5" + | "2.6" + | "2.7" + | "2.8" + | "2.9" + | "2.10" + | "2.11" + | "Unstable"; + } +} + +/** + * With the AI Content APIs, you can create and manage External Pages and Content Import Sources for your Fin Content Library. + * + *   + * + * *External Pages* are pages that you want Fin to be able to answer questions about. The API for External Pages is a great way to ingest into your Fin Content Library pages that are not publicly accessible and hence can't be crawled by Intercom. + * + *   + * + * *Content Import Sources* are the sources of those pages, and they are used to determine the default audience for the pages (configured via the UI). You should create a Content Import Source for each source of External Pages that you want to ingest into your Fin Content Library. + * + *   + * + * You can then iterate through the content from that source via its API and POST it to the External Pages endpoint. That endpoint has an *external_id* parameter which allows you to specify the identifier from the source. The endpoint will then either create a new External Page or update an existing one as appropriate.", + */ +export class AiContent { + constructor(protected readonly _options: AiContent.Options = {}) {} + + /** + * You can retrieve a list of all content import sources for a workspace. + * + * @param {AiContent.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Intercom.UnauthorizedError} + * + * @example + * await client.aiContent.listContentImportSources() + */ + public listContentImportSources( + requestOptions?: AiContent.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__listContentImportSources(requestOptions)); + } + + private async __listContentImportSources( + requestOptions?: AiContent.RequestOptions, + ): Promise> { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + "ai/content_import_sources", + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "intercom-client", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", + "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 20000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { data: _response.body as Intercom.ContentImportSourcesList, rawResponse: _response.rawResponse }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 401: + throw new Intercom.UnauthorizedError( + _response.error.body as Intercom.Error_, + _response.rawResponse, + ); + default: + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.IntercomTimeoutError("Timeout exceeded when calling GET /ai/content_import_sources."); + case "unknown": + throw new errors.IntercomError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + } + + /** + * You can create a new content import source by sending a POST request to this endpoint. + * + * @param {Intercom.CreateContentImportSourceRequest} request + * @param {AiContent.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Intercom.UnauthorizedError} + * + * @example + * await client.aiContent.createContentImportSource({ + * url: "https://www.example.com" + * }) + */ + public createContentImportSource( + request: Intercom.CreateContentImportSourceRequest, + requestOptions?: AiContent.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__createContentImportSource(request, requestOptions)); + } + + private async __createContentImportSource( + request: Intercom.CreateContentImportSourceRequest, + requestOptions?: AiContent.RequestOptions, + ): Promise> { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + "ai/content_import_sources", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "intercom-client", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", + "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: { ...request, sync_behavior: "api" }, + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 20000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { data: _response.body as Intercom.ContentImportSource, rawResponse: _response.rawResponse }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 401: + throw new Intercom.UnauthorizedError( + _response.error.body as Intercom.Error_, + _response.rawResponse, + ); + default: + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.IntercomTimeoutError("Timeout exceeded when calling POST /ai/content_import_sources."); + case "unknown": + throw new errors.IntercomError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + } + + /** + * @param {Intercom.GetContentImportSourceRequest} request + * @param {AiContent.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Intercom.UnauthorizedError} + * + * @example + * await client.aiContent.getContentImportSource({ + * source_id: "source_id" + * }) + */ + public getContentImportSource( + request: Intercom.GetContentImportSourceRequest, + requestOptions?: AiContent.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__getContentImportSource(request, requestOptions)); + } + + private async __getContentImportSource( + request: Intercom.GetContentImportSourceRequest, + requestOptions?: AiContent.RequestOptions, + ): Promise> { + const { source_id: sourceId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `ai/content_import_sources/${encodeURIComponent(sourceId)}`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "intercom-client", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", + "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 20000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { data: _response.body as Intercom.ContentImportSource, rawResponse: _response.rawResponse }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 401: + throw new Intercom.UnauthorizedError( + _response.error.body as Intercom.Error_, + _response.rawResponse, + ); + default: + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.IntercomTimeoutError( + "Timeout exceeded when calling GET /ai/content_import_sources/{source_id}.", + ); + case "unknown": + throw new errors.IntercomError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + } + + /** + * You can update an existing content import source. + * + * @param {Intercom.UpdateContentImportSourceRequest} request + * @param {AiContent.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Intercom.UnauthorizedError} + * + * @example + * await client.aiContent.updateContentImportSource({ + * source_id: "source_id", + * sync_behavior: "api", + * url: "https://www.example.com" + * }) + */ + public updateContentImportSource( + request: Intercom.UpdateContentImportSourceRequest, + requestOptions?: AiContent.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__updateContentImportSource(request, requestOptions)); + } + + private async __updateContentImportSource( + request: Intercom.UpdateContentImportSourceRequest, + requestOptions?: AiContent.RequestOptions, + ): Promise> { + const { source_id: sourceId, ..._body } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `ai/content_import_sources/${encodeURIComponent(sourceId)}`, + ), + method: "PUT", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "intercom-client", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", + "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: _body, + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 20000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { data: _response.body as Intercom.ContentImportSource, rawResponse: _response.rawResponse }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 401: + throw new Intercom.UnauthorizedError( + _response.error.body as Intercom.Error_, + _response.rawResponse, + ); + default: + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.IntercomTimeoutError( + "Timeout exceeded when calling PUT /ai/content_import_sources/{source_id}.", + ); + case "unknown": + throw new errors.IntercomError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + } + + /** + * You can delete a content import source by making a DELETE request this endpoint. This will also delete all external pages that were imported from this source. + * + * @param {Intercom.DeleteContentImportSourceRequest} request + * @param {AiContent.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Intercom.UnauthorizedError} + * + * @example + * await client.aiContent.deleteContentImportSource({ + * source_id: "source_id" + * }) + */ + public deleteContentImportSource( + request: Intercom.DeleteContentImportSourceRequest, + requestOptions?: AiContent.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__deleteContentImportSource(request, requestOptions)); + } + + private async __deleteContentImportSource( + request: Intercom.DeleteContentImportSourceRequest, + requestOptions?: AiContent.RequestOptions, + ): Promise> { + const { source_id: sourceId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `ai/content_import_sources/${encodeURIComponent(sourceId)}`, + ), + method: "DELETE", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "intercom-client", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", + "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 20000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { data: undefined, rawResponse: _response.rawResponse }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 401: + throw new Intercom.UnauthorizedError( + _response.error.body as Intercom.Error_, + _response.rawResponse, + ); + default: + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.IntercomTimeoutError( + "Timeout exceeded when calling DELETE /ai/content_import_sources/{source_id}.", + ); + case "unknown": + throw new errors.IntercomError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + } + + /** + * You can retrieve a list of all external pages for a workspace. + * + * @param {AiContent.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Intercom.UnauthorizedError} + * + * @example + * await client.aiContent.listExternalPages() + */ + public listExternalPages( + requestOptions?: AiContent.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__listExternalPages(requestOptions)); + } + + private async __listExternalPages( + requestOptions?: AiContent.RequestOptions, + ): Promise> { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + "ai/external_pages", + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "intercom-client", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", + "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 20000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { data: _response.body as Intercom.ExternalPagesList, rawResponse: _response.rawResponse }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 401: + throw new Intercom.UnauthorizedError( + _response.error.body as Intercom.Error_, + _response.rawResponse, + ); + default: + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.IntercomTimeoutError("Timeout exceeded when calling GET /ai/external_pages."); + case "unknown": + throw new errors.IntercomError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + } + + /** + * You can create a new external page by sending a POST request to this endpoint. If an external page already exists with the specified source_id and external_id, it will be updated instead. + * + * @param {Intercom.CreateExternalPageRequest} request + * @param {AiContent.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Intercom.UnauthorizedError} + * + * @example + * await client.aiContent.createExternalPage({ + * title: "Test", + * html: "

Test

", + * url: "https://www.example.com", + * source_id: 44, + * external_id: "abc1234" + * }) + */ + public createExternalPage( + request: Intercom.CreateExternalPageRequest, + requestOptions?: AiContent.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__createExternalPage(request, requestOptions)); + } + + private async __createExternalPage( + request: Intercom.CreateExternalPageRequest, + requestOptions?: AiContent.RequestOptions, + ): Promise> { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + "ai/external_pages", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "intercom-client", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", + "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: { ...request, locale: "en" }, + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 20000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { data: _response.body as Intercom.ExternalPage, rawResponse: _response.rawResponse }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 401: + throw new Intercom.UnauthorizedError( + _response.error.body as Intercom.Error_, + _response.rawResponse, + ); + default: + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.IntercomTimeoutError("Timeout exceeded when calling POST /ai/external_pages."); + case "unknown": + throw new errors.IntercomError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + } + + /** + * You can retrieve an external page. + * + * @param {Intercom.GetExternalPageRequest} request + * @param {AiContent.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Intercom.UnauthorizedError} + * + * @example + * await client.aiContent.getExternalPage({ + * page_id: "page_id" + * }) + */ + public getExternalPage( + request: Intercom.GetExternalPageRequest, + requestOptions?: AiContent.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__getExternalPage(request, requestOptions)); + } + + private async __getExternalPage( + request: Intercom.GetExternalPageRequest, + requestOptions?: AiContent.RequestOptions, + ): Promise> { + const { page_id: pageId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `ai/external_pages/${encodeURIComponent(pageId)}`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "intercom-client", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", + "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 20000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { data: _response.body as Intercom.ExternalPage, rawResponse: _response.rawResponse }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 401: + throw new Intercom.UnauthorizedError( + _response.error.body as Intercom.Error_, + _response.rawResponse, + ); + default: + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.IntercomTimeoutError( + "Timeout exceeded when calling GET /ai/external_pages/{page_id}.", + ); + case "unknown": + throw new errors.IntercomError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + } + + /** + * You can update an existing external page (if it was created via the API). + * + * @param {Intercom.UpdateExternalPageRequest} request + * @param {AiContent.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Intercom.UnauthorizedError} + * + * @example + * await client.aiContent.updateExternalPage({ + * page_id: "page_id", + * title: "Test", + * html: "

Test

", + * url: "https://www.example.com", + * source_id: 47, + * external_id: "5678" + * }) + */ + public updateExternalPage( + request: Intercom.UpdateExternalPageRequest, + requestOptions?: AiContent.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__updateExternalPage(request, requestOptions)); + } + + private async __updateExternalPage( + request: Intercom.UpdateExternalPageRequest, + requestOptions?: AiContent.RequestOptions, + ): Promise> { + const { page_id: pageId, ..._body } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `ai/external_pages/${encodeURIComponent(pageId)}`, + ), + method: "PUT", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "intercom-client", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", + "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: { ..._body, locale: "en" }, + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 20000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { data: _response.body as Intercom.ExternalPage, rawResponse: _response.rawResponse }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 401: + throw new Intercom.UnauthorizedError( + _response.error.body as Intercom.Error_, + _response.rawResponse, + ); + default: + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.IntercomTimeoutError( + "Timeout exceeded when calling PUT /ai/external_pages/{page_id}.", + ); + case "unknown": + throw new errors.IntercomError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + } + + /** + * Sending a DELETE request for an external page will remove it from the content library UI and from being used for AI answers. + * + * @param {Intercom.DeleteExternalPageRequest} request + * @param {AiContent.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Intercom.UnauthorizedError} + * + * @example + * await client.aiContent.deleteExternalPage({ + * page_id: "page_id" + * }) + */ + public deleteExternalPage( + request: Intercom.DeleteExternalPageRequest, + requestOptions?: AiContent.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__deleteExternalPage(request, requestOptions)); + } + + private async __deleteExternalPage( + request: Intercom.DeleteExternalPageRequest, + requestOptions?: AiContent.RequestOptions, + ): Promise> { + const { page_id: pageId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `ai/external_pages/${encodeURIComponent(pageId)}`, + ), + method: "DELETE", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "intercom-client", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", + "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 20000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { data: _response.body as Intercom.ExternalPage, rawResponse: _response.rawResponse }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 401: + throw new Intercom.UnauthorizedError( + _response.error.body as Intercom.Error_, + _response.rawResponse, + ); + default: + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.IntercomTimeoutError( + "Timeout exceeded when calling DELETE /ai/external_pages/{page_id}.", + ); + case "unknown": + throw new errors.IntercomError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["INTERCOM_API_KEY"]; + if (bearer == null) { + throw new errors.IntercomError({ + message: + "Please specify a bearer by either passing it in to the constructor or initializing a INTERCOM_API_KEY environment variable", + }); + } + + return `Bearer ${bearer}`; + } +} diff --git a/src/api/resources/aiContent/client/index.ts b/src/api/resources/aiContent/client/index.ts new file mode 100644 index 00000000..415726b7 --- /dev/null +++ b/src/api/resources/aiContent/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/aiContent/client/requests/CreateContentImportSourceRequest.ts b/src/api/resources/aiContent/client/requests/CreateContentImportSourceRequest.ts new file mode 100644 index 00000000..06da2b4a --- /dev/null +++ b/src/api/resources/aiContent/client/requests/CreateContentImportSourceRequest.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * url: "https://www.example.com" + * } + */ +export interface CreateContentImportSourceRequest { + /** The status of the content import source. */ + status?: CreateContentImportSourceRequest.Status; + /** The URL of the content import source. */ + url: string; +} + +export namespace CreateContentImportSourceRequest { + /** + * The status of the content import source. + */ + export type Status = "active" | "deactivated"; + export const Status = { + Active: "active", + Deactivated: "deactivated", + } as const; +} diff --git a/src/api/resources/aiContent/client/requests/CreateExternalPageRequest.ts b/src/api/resources/aiContent/client/requests/CreateExternalPageRequest.ts new file mode 100644 index 00000000..d0d37237 --- /dev/null +++ b/src/api/resources/aiContent/client/requests/CreateExternalPageRequest.ts @@ -0,0 +1,30 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * title: "Test", + * html: "

Test

", + * url: "https://www.example.com", + * source_id: 44, + * external_id: "abc1234" + * } + */ +export interface CreateExternalPageRequest { + /** The title of the external page. */ + title: string; + /** The body of the external page in HTML. */ + html: string; + /** The URL of the external page. This will be used by Fin to link end users to the page it based its answer on. When a URL is not present, Fin will not reference the source. */ + url?: string; + /** Whether the external page should be used to answer questions by AI Agent. Will not default when updating an existing external page. */ + ai_agent_availability?: boolean; + /** Whether the external page should be used to answer questions by AI Copilot. Will not default when updating an existing external page. */ + ai_copilot_availability?: boolean; + /** The unique identifier for the source of the external page which was given by Intercom. Every external page must be associated with a Content Import Source which represents the place it comes from and from which it inherits a default audience (configured in the UI). For a new source, make a POST request to the Content Import Source endpoint and an ID for the source will be returned in the response. */ + source_id: number; + /** The identifier for the external page which was given by the source. Must be unique for the source. */ + external_id: string; +} diff --git a/src/api/resources/aiContent/client/requests/DeleteContentImportSourceRequest.ts b/src/api/resources/aiContent/client/requests/DeleteContentImportSourceRequest.ts new file mode 100644 index 00000000..86c4f90d --- /dev/null +++ b/src/api/resources/aiContent/client/requests/DeleteContentImportSourceRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * source_id: "source_id" + * } + */ +export interface DeleteContentImportSourceRequest { + /** + * The unique identifier for the content import source which is given by Intercom. + */ + source_id: string; +} diff --git a/src/api/resources/aiContent/client/requests/DeleteExternalPageRequest.ts b/src/api/resources/aiContent/client/requests/DeleteExternalPageRequest.ts new file mode 100644 index 00000000..b1fb3436 --- /dev/null +++ b/src/api/resources/aiContent/client/requests/DeleteExternalPageRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * page_id: "page_id" + * } + */ +export interface DeleteExternalPageRequest { + /** + * The unique identifier for the external page which is given by Intercom. + */ + page_id: string; +} diff --git a/src/api/resources/aiContent/client/requests/GetContentImportSourceRequest.ts b/src/api/resources/aiContent/client/requests/GetContentImportSourceRequest.ts new file mode 100644 index 00000000..55dc0d67 --- /dev/null +++ b/src/api/resources/aiContent/client/requests/GetContentImportSourceRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * source_id: "source_id" + * } + */ +export interface GetContentImportSourceRequest { + /** + * The unique identifier for the content import source which is given by Intercom. + */ + source_id: string; +} diff --git a/src/api/resources/aiContent/client/requests/GetExternalPageRequest.ts b/src/api/resources/aiContent/client/requests/GetExternalPageRequest.ts new file mode 100644 index 00000000..769465a7 --- /dev/null +++ b/src/api/resources/aiContent/client/requests/GetExternalPageRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * page_id: "page_id" + * } + */ +export interface GetExternalPageRequest { + /** + * The unique identifier for the external page which is given by Intercom. + */ + page_id: string; +} diff --git a/src/api/resources/aiContent/client/requests/UpdateContentImportSourceRequest.ts b/src/api/resources/aiContent/client/requests/UpdateContentImportSourceRequest.ts new file mode 100644 index 00000000..ac5921c8 --- /dev/null +++ b/src/api/resources/aiContent/client/requests/UpdateContentImportSourceRequest.ts @@ -0,0 +1,44 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * source_id: "source_id", + * sync_behavior: "api", + * url: "https://www.example.com" + * } + */ +export interface UpdateContentImportSourceRequest { + /** + * The unique identifier for the content import source which is given by Intercom. + */ + source_id: string; + /** If you intend to create or update External Pages via the API, this should be set to `api`. You can not change the value to or from api. */ + sync_behavior: UpdateContentImportSourceRequest.SyncBehavior; + /** The status of the content import source. */ + status?: UpdateContentImportSourceRequest.Status; + /** The URL of the content import source. This may only be different from the existing value if the sync behavior is API. */ + url: string; +} + +export namespace UpdateContentImportSourceRequest { + /** + * If you intend to create or update External Pages via the API, this should be set to `api`. You can not change the value to or from api. + */ + export type SyncBehavior = "api" | "automated" | "manual"; + export const SyncBehavior = { + Api: "api", + Automated: "automated", + Manual: "manual", + } as const; + /** + * The status of the content import source. + */ + export type Status = "active" | "deactivated"; + export const Status = { + Active: "active", + Deactivated: "deactivated", + } as const; +} diff --git a/src/api/resources/aiContent/client/requests/UpdateExternalPageRequest.ts b/src/api/resources/aiContent/client/requests/UpdateExternalPageRequest.ts new file mode 100644 index 00000000..81252387 --- /dev/null +++ b/src/api/resources/aiContent/client/requests/UpdateExternalPageRequest.ts @@ -0,0 +1,33 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * page_id: "page_id", + * title: "Test", + * html: "

Test

", + * url: "https://www.example.com", + * source_id: 47, + * external_id: "5678" + * } + */ +export interface UpdateExternalPageRequest { + /** + * The unique identifier for the external page which is given by Intercom. + */ + page_id: string; + /** The title of the external page. */ + title: string; + /** The body of the external page in HTML. */ + html: string; + /** The URL of the external page. This will be used by Fin to link end users to the page it based its answer on. */ + url: string; + /** Whether the external page should be used to answer questions by Fin. */ + fin_availability?: boolean; + /** The unique identifier for the source of the external page which was given by Intercom. Every external page must be associated with a Content Import Source which represents the place it comes from and from which it inherits a default audience (configured in the UI). For a new source, make a POST request to the Content Import Source endpoint and an ID for the source will be returned in the response. */ + source_id: number; + /** The identifier for the external page which was given by the source. Must be unique for the source. */ + external_id?: string; +} diff --git a/src/api/resources/aiContent/client/requests/index.ts b/src/api/resources/aiContent/client/requests/index.ts new file mode 100644 index 00000000..820c72ee --- /dev/null +++ b/src/api/resources/aiContent/client/requests/index.ts @@ -0,0 +1,8 @@ +export { type CreateContentImportSourceRequest } from "./CreateContentImportSourceRequest"; +export { type GetContentImportSourceRequest } from "./GetContentImportSourceRequest"; +export { type UpdateContentImportSourceRequest } from "./UpdateContentImportSourceRequest"; +export { type DeleteContentImportSourceRequest } from "./DeleteContentImportSourceRequest"; +export { type CreateExternalPageRequest } from "./CreateExternalPageRequest"; +export { type GetExternalPageRequest } from "./GetExternalPageRequest"; +export { type UpdateExternalPageRequest } from "./UpdateExternalPageRequest"; +export { type DeleteExternalPageRequest } from "./DeleteExternalPageRequest"; diff --git a/src/api/resources/aiContent/index.ts b/src/api/resources/aiContent/index.ts new file mode 100644 index 00000000..c9240f83 --- /dev/null +++ b/src/api/resources/aiContent/index.ts @@ -0,0 +1,2 @@ +export * from "./types"; +export * from "./client"; diff --git a/src/api/resources/aiContent/types/ContentImportSource.ts b/src/api/resources/aiContent/types/ContentImportSource.ts new file mode 100644 index 00000000..ef5cd352 --- /dev/null +++ b/src/api/resources/aiContent/types/ContentImportSource.ts @@ -0,0 +1,45 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * An external source for External Pages that you add to your Fin Content Library. + */ +export interface ContentImportSource { + /** Always external_page */ + type: "content_import_source"; + /** The unique identifier for the content import source which is given by Intercom. */ + id: number; + /** The time when the content import source was last synced. */ + last_synced_at: number; + /** If you intend to create or update External Pages via the API, this should be set to `api`. */ + sync_behavior: ContentImportSource.SyncBehavior; + /** The status of the content import source. */ + status: ContentImportSource.Status; + /** The URL of the root of the external source. */ + url: string; + /** The time when the content import source was created. */ + created_at: number; + /** The time when the content import source was last updated. */ + updated_at: number; +} + +export namespace ContentImportSource { + /** + * If you intend to create or update External Pages via the API, this should be set to `api`. + */ + export type SyncBehavior = "api" | "automatic" | "manual"; + export const SyncBehavior = { + Api: "api", + Automatic: "automatic", + Manual: "manual", + } as const; + /** + * The status of the content import source. + */ + export type Status = "active" | "deactivated"; + export const Status = { + Active: "active", + Deactivated: "deactivated", + } as const; +} diff --git a/src/api/resources/aiContent/types/ContentImportSourcesList.ts b/src/api/resources/aiContent/types/ContentImportSourcesList.ts new file mode 100644 index 00000000..07b3d4f8 --- /dev/null +++ b/src/api/resources/aiContent/types/ContentImportSourcesList.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Intercom from "../../../index"; + +/** + * This will return a list of the content import sources for the App. + */ +export interface ContentImportSourcesList { + /** The type of the object - `list`. */ + type?: "list"; + pages?: Intercom.PagesLink; + /** A count of the total number of content import sources. */ + total_count?: number; + /** An array of Content Import Source objects */ + data?: Intercom.ContentImportSource[]; +} diff --git a/src/api/resources/aiContent/types/ExternalPage.ts b/src/api/resources/aiContent/types/ExternalPage.ts new file mode 100644 index 00000000..93a5eaf4 --- /dev/null +++ b/src/api/resources/aiContent/types/ExternalPage.ts @@ -0,0 +1,37 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * External pages that you have added to your Fin Content Library. + */ +export interface ExternalPage { + /** Always external_page */ + type: "external_page"; + /** The unique identifier for the external page which is given by Intercom. */ + id: string; + /** The title of the external page. */ + title: string; + /** The body of the external page in HTML. */ + html: string; + /** The URL of the external page. This will be used by Fin to link end users to the page it based its answer on. */ + url?: string; + /** Whether the external page should be used to answer questions by AI Agent. */ + ai_agent_availability: boolean; + /** Whether the external page should be used to answer questions by AI Copilot. */ + ai_copilot_availability: boolean; + /** Deprecated. Use ai_agent_availability and ai_copilot_availability instead. */ + fin_availability?: boolean; + /** Always en */ + locale: "en"; + /** The unique identifier for the source of the external page which was given by Intercom. Every external page must be associated with a Content Import Source which represents the place it comes from and from which it inherits a default audience (configured in the UI). For a new source, make a POST request to the Content Import Source endpoint and an ID for the source will be returned in the response. */ + source_id: number; + /** The identifier for the external page which was given by the source. Must be unique for the source. */ + external_id: string; + /** The time when the external page was created. */ + created_at: number; + /** The time when the external page was last updated. */ + updated_at: number; + /** The time when the external page was last ingested. */ + last_ingested_at: number; +} diff --git a/src/api/resources/aiContent/types/ExternalPagesList.ts b/src/api/resources/aiContent/types/ExternalPagesList.ts new file mode 100644 index 00000000..1b9d3eec --- /dev/null +++ b/src/api/resources/aiContent/types/ExternalPagesList.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Intercom from "../../../index"; + +/** + * This will return a list of external pages for the App. + */ +export interface ExternalPagesList { + /** The type of the object - `list`. */ + type?: "list"; + pages?: Intercom.PagesLink; + /** A count of the total number of external pages. */ + total_count?: number; + /** An array of External Page objects */ + data?: Intercom.ExternalPage[]; +} diff --git a/src/api/resources/aiContent/types/index.ts b/src/api/resources/aiContent/types/index.ts new file mode 100644 index 00000000..a1b39227 --- /dev/null +++ b/src/api/resources/aiContent/types/index.ts @@ -0,0 +1,4 @@ +export * from "./ContentImportSource"; +export * from "./ContentImportSourcesList"; +export * from "./ExternalPage"; +export * from "./ExternalPagesList"; diff --git a/src/api/resources/aiContentSource/types/ContentSource.ts b/src/api/resources/aiContentSource/types/ContentSource.ts index 15fd382f..0e3db56c 100644 --- a/src/api/resources/aiContentSource/types/ContentSource.ts +++ b/src/api/resources/aiContentSource/types/ContentSource.ts @@ -7,11 +7,11 @@ */ export interface ContentSource { /** The type of the content source. */ - content_type: "custom_answer"; + content_type?: "custom_answer"; /** The internal URL linking to the content source for teammates. */ - url: string; + url?: string; /** The title of the content source. */ - title: string; + title?: string; /** The ISO 639 language code of the content source. */ - locale: string; + locale?: string; } diff --git a/src/api/resources/articles/client/Client.ts b/src/api/resources/articles/client/Client.ts index 78948f01..b27dd29a 100644 --- a/src/api/resources/articles/client/Client.ts +++ b/src/api/resources/articles/client/Client.ts @@ -116,8 +116,8 @@ export class Articles { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -194,17 +194,16 @@ export class Articles { * title: "Thanks for everything", * description: "Description of the Article", * body: "Body of the Article", - * author_id: 991267407, + * author_id: 991267497, * state: "published", * parent_id: 145, * parent_type: "collection", * translated_content: { * fr: { - * type: "article_content", * title: "Merci pour tout", * description: "Description de l'article", * body: "Corps de l'article", - * author_id: 991267407, + * author_id: 991267497, * state: "published" * } * } @@ -220,14 +219,14 @@ export class Articles { * }) */ public create( - request: Intercom.CreateArticleRequest, + request?: Intercom.CreateArticleRequest, requestOptions?: Articles.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions)); } private async __create( - request: Intercom.CreateArticleRequest, + request?: Intercom.CreateArticleRequest, requestOptions?: Articles.RequestOptions, ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ @@ -242,8 +241,8 @@ export class Articles { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -251,7 +250,7 @@ export class Articles { }, contentType: "application/json", requestType: "json", - body: request, + body: request != null ? request : undefined, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 20000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -306,7 +305,7 @@ export class Articles { * * @example * await client.articles.find({ - * article_id: "123" + * article_id: 1 * }) */ public find( @@ -333,8 +332,8 @@ export class Articles { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -396,7 +395,7 @@ export class Articles { * * @example * await client.articles.update({ - * article_id: "123", + * article_id: 1, * title: "Christmas is here!", * body: "

New gifts in store for the jolly season

" * }) @@ -425,8 +424,8 @@ export class Articles { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -489,7 +488,7 @@ export class Articles { * * @example * await client.articles.delete({ - * article_id: "123" + * article_id: 1 * }) */ public delete( @@ -516,8 +515,8 @@ export class Articles { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -585,14 +584,14 @@ export class Articles { public search( request: Intercom.SearchArticlesRequest = {}, requestOptions?: Articles.RequestOptions, - ): core.HttpResponsePromise { + ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__search(request, requestOptions)); } private async __search( request: Intercom.SearchArticlesRequest = {}, requestOptions?: Articles.RequestOptions, - ): Promise> { + ): Promise> { const { phrase, state, help_center_id: helpCenterId, highlight } = request; const _queryParams: Record = {}; if (phrase != null) { @@ -623,8 +622,8 @@ export class Articles { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -638,7 +637,7 @@ export class Articles { abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return { data: _response.body as Intercom.SearchArticlesResponse, rawResponse: _response.rawResponse }; + return { data: _response.body as Intercom.ArticleSearchResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { diff --git a/src/api/resources/articles/client/requests/DeleteArticleRequest.ts b/src/api/resources/articles/client/requests/DeleteArticleRequest.ts index cfc44703..ec76164d 100644 --- a/src/api/resources/articles/client/requests/DeleteArticleRequest.ts +++ b/src/api/resources/articles/client/requests/DeleteArticleRequest.ts @@ -5,12 +5,12 @@ /** * @example * { - * article_id: "123" + * article_id: 1 * } */ export interface DeleteArticleRequest { /** * The unique identifier for the article which is given by Intercom. */ - article_id: string; + article_id: number; } diff --git a/src/api/resources/articles/client/requests/FindArticleRequest.ts b/src/api/resources/articles/client/requests/FindArticleRequest.ts index 29e6bc18..fa2df707 100644 --- a/src/api/resources/articles/client/requests/FindArticleRequest.ts +++ b/src/api/resources/articles/client/requests/FindArticleRequest.ts @@ -5,12 +5,12 @@ /** * @example * { - * article_id: "123" + * article_id: 1 * } */ export interface FindArticleRequest { /** * The unique identifier for the article which is given by Intercom. */ - article_id: string; + article_id: number; } diff --git a/src/api/resources/articles/client/requests/UpdateArticleRequest.ts b/src/api/resources/articles/client/requests/UpdateArticleRequest.ts index cb814947..122b0dc2 100644 --- a/src/api/resources/articles/client/requests/UpdateArticleRequest.ts +++ b/src/api/resources/articles/client/requests/UpdateArticleRequest.ts @@ -7,14 +7,14 @@ import * as Intercom from "../../../../index"; /** * @example * { - * article_id: "123", + * article_id: 1, * title: "Christmas is here!", * body: "

New gifts in store for the jolly season

" * } * * @example * { - * article_id: "123", + * article_id: 1, * title: "Christmas is here!", * body: "

New gifts in store for the jolly season

" * } @@ -23,7 +23,7 @@ export interface UpdateArticleRequest { /** * The unique identifier for the article which is given by Intercom. */ - article_id: string; + article_id: number; /** The title of the article.For multilingual articles, this will be the title of the default language's content. */ title?: string; /** The description of the article. For multilingual articles, this will be the description of the default language's content. */ @@ -37,7 +37,7 @@ export interface UpdateArticleRequest { /** The id of the article's parent collection or section. An article without this field stands alone. */ parent_id?: string; /** The type of parent, which can either be a `collection` or `section`. */ - parent_type?: UpdateArticleRequest.ParentType; + parent_type?: string; translated_content?: Intercom.ArticleTranslatedContent; } @@ -50,12 +50,4 @@ export namespace UpdateArticleRequest { Published: "published", Draft: "draft", } as const; - /** - * The type of parent, which can either be a `collection` or `section`. - */ - export type ParentType = "collection" | "section"; - export const ParentType = { - Collection: "collection", - Section: "section", - } as const; } diff --git a/src/api/resources/articles/client/requests/index.ts b/src/api/resources/articles/client/requests/index.ts index 48ca8171..b62b1048 100644 --- a/src/api/resources/articles/client/requests/index.ts +++ b/src/api/resources/articles/client/requests/index.ts @@ -1,5 +1,4 @@ export { type ListArticlesRequest } from "./ListArticlesRequest"; -export { type CreateArticleRequest } from "./CreateArticleRequest"; export { type FindArticleRequest } from "./FindArticleRequest"; export { type UpdateArticleRequest } from "./UpdateArticleRequest"; export { type DeleteArticleRequest } from "./DeleteArticleRequest"; diff --git a/src/api/resources/articles/types/ArticleListItem.ts b/src/api/resources/articles/types/ArticleListItem.ts index 1c180206..3f8c6d91 100644 --- a/src/api/resources/articles/types/ArticleListItem.ts +++ b/src/api/resources/articles/types/ArticleListItem.ts @@ -37,8 +37,8 @@ export interface ArticleListItem { /** The type of parent, which can either be a `collection` or `section`. */ parent_type?: string; /** The default locale of the help center. This field is only returned for multilingual help centers. */ - default_locale: string; - translated_content: Intercom.ArticleTranslatedContent; + default_locale?: string; + translated_content?: Intercom.ArticleTranslatedContent; } export namespace ArticleListItem { diff --git a/src/api/resources/articles/types/ArticleSearchHighlights.ts b/src/api/resources/articles/types/ArticleSearchHighlights.ts index 0dd36d50..5e1f607b 100644 --- a/src/api/resources/articles/types/ArticleSearchHighlights.ts +++ b/src/api/resources/articles/types/ArticleSearchHighlights.ts @@ -7,11 +7,11 @@ */ export interface ArticleSearchHighlights { /** The ID of the corresponding article. */ - article_id: string; + article_id?: string; /** An Article title highlighted. */ - highlighted_title: ArticleSearchHighlights.HighlightedTitle.Item[]; + highlighted_title?: ArticleSearchHighlights.HighlightedTitle.Item[]; /** An Article description and body text highlighted. */ - highlighted_summary: ArticleSearchHighlights.HighlightedSummary.Item[][]; + highlighted_summary?: ArticleSearchHighlights.HighlightedSummary.Item[][]; } export namespace ArticleSearchHighlights { diff --git a/src/api/resources/articles/types/SearchArticlesResponse.ts b/src/api/resources/articles/types/ArticleSearchResponse.ts similarity index 80% rename from src/api/resources/articles/types/SearchArticlesResponse.ts rename to src/api/resources/articles/types/ArticleSearchResponse.ts index dbf3330a..81bf5e37 100644 --- a/src/api/resources/articles/types/SearchArticlesResponse.ts +++ b/src/api/resources/articles/types/ArticleSearchResponse.ts @@ -7,17 +7,17 @@ import * as Intercom from "../../../index"; /** * The results of an Article search */ -export interface SearchArticlesResponse { +export interface ArticleSearchResponse { /** The type of the object - `list`. */ - type: "list"; + type?: "list"; /** The total number of Articles matching the search query */ - total_count: number; + total_count?: number; /** An object containing the results of the search. */ - data: SearchArticlesResponse.Data; + data?: ArticleSearchResponse.Data; pages?: Intercom.CursorPages; } -export namespace SearchArticlesResponse { +export namespace ArticleSearchResponse { /** * An object containing the results of the search. */ diff --git a/src/api/resources/articles/types/InternalArticle.ts b/src/api/resources/articles/types/InternalArticle.ts new file mode 100644 index 00000000..77f01768 --- /dev/null +++ b/src/api/resources/articles/types/InternalArticle.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Intercom from "../../../index"; + +/** + * The Internal Articles API is a central place to gather all information and take actions on your internal articles. + */ +export type InternalArticle = Intercom.InternalArticleListItem; diff --git a/src/api/resources/articles/types/index.ts b/src/api/resources/articles/types/index.ts index a9b4ea42..a916b2c1 100644 --- a/src/api/resources/articles/types/index.ts +++ b/src/api/resources/articles/types/index.ts @@ -1,4 +1,5 @@ export * from "./Article"; +export * from "./InternalArticle"; export * from "./ArticleListItem"; export * from "./ArticleSearchHighlights"; -export * from "./SearchArticlesResponse"; +export * from "./ArticleSearchResponse"; diff --git a/src/api/resources/awayStatusReasons/client/Client.ts b/src/api/resources/awayStatusReasons/client/Client.ts new file mode 100644 index 00000000..0e2d52f2 --- /dev/null +++ b/src/api/resources/awayStatusReasons/client/Client.ts @@ -0,0 +1,170 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Intercom from "../../../index"; +import urlJoin from "url-join"; +import * as errors from "../../../../errors/index"; + +export declare namespace AwayStatusReasons { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Intercom-Version header */ + version?: + | "1.0" + | "1.1" + | "1.2" + | "1.3" + | "1.4" + | "2.0" + | "2.1" + | "2.2" + | "2.3" + | "2.4" + | "2.5" + | "2.6" + | "2.7" + | "2.8" + | "2.9" + | "2.10" + | "2.11" + | "Unstable"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Additional headers to include in the request. */ + headers?: Record; + /** Override the Intercom-Version header */ + version?: + | "1.0" + | "1.1" + | "1.2" + | "1.3" + | "1.4" + | "2.0" + | "2.1" + | "2.2" + | "2.3" + | "2.4" + | "2.5" + | "2.6" + | "2.7" + | "2.8" + | "2.9" + | "2.10" + | "2.11" + | "Unstable"; + } +} + +/** + * Everything about your Away Status Reasons + */ +export class AwayStatusReasons { + constructor(protected readonly _options: AwayStatusReasons.Options = {}) {} + + /** + * Returns a list of all away status reasons configured for the workspace, including deleted ones. + * + * @param {AwayStatusReasons.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Intercom.UnauthorizedError} + * + * @example + * await client.awayStatusReasons.listAwayStatusReasons() + */ + public listAwayStatusReasons( + requestOptions?: AwayStatusReasons.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__listAwayStatusReasons(requestOptions)); + } + + private async __listAwayStatusReasons( + requestOptions?: AwayStatusReasons.RequestOptions, + ): Promise> { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + "away_status_reasons", + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "intercom-client", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", + "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 20000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { data: _response.body as Intercom.AwayStatusReason[], rawResponse: _response.rawResponse }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 401: + throw new Intercom.UnauthorizedError( + _response.error.body as Intercom.Error_, + _response.rawResponse, + ); + default: + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.IntercomTimeoutError("Timeout exceeded when calling GET /away_status_reasons."); + case "unknown": + throw new errors.IntercomError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["INTERCOM_API_KEY"]; + if (bearer == null) { + throw new errors.IntercomError({ + message: + "Please specify a bearer by either passing it in to the constructor or initializing a INTERCOM_API_KEY environment variable", + }); + } + + return `Bearer ${bearer}`; + } +} diff --git a/src/api/resources/awayStatusReasons/client/index.ts b/src/api/resources/awayStatusReasons/client/index.ts new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/src/api/resources/awayStatusReasons/client/index.ts @@ -0,0 +1 @@ +export {}; diff --git a/src/api/resources/awayStatusReasons/index.ts b/src/api/resources/awayStatusReasons/index.ts new file mode 100644 index 00000000..5ec76921 --- /dev/null +++ b/src/api/resources/awayStatusReasons/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/calls/client/Client.ts b/src/api/resources/calls/client/Client.ts new file mode 100644 index 00000000..d84a6e50 --- /dev/null +++ b/src/api/resources/calls/client/Client.ts @@ -0,0 +1,540 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Intercom from "../../../index"; +import urlJoin from "url-join"; +import * as errors from "../../../../errors/index"; + +export declare namespace Calls { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Intercom-Version header */ + version?: + | "1.0" + | "1.1" + | "1.2" + | "1.3" + | "1.4" + | "2.0" + | "2.1" + | "2.2" + | "2.3" + | "2.4" + | "2.5" + | "2.6" + | "2.7" + | "2.8" + | "2.9" + | "2.10" + | "2.11" + | "Unstable"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Additional headers to include in the request. */ + headers?: Record; + /** Override the Intercom-Version header */ + version?: + | "1.0" + | "1.1" + | "1.2" + | "1.3" + | "1.4" + | "2.0" + | "2.1" + | "2.2" + | "2.3" + | "2.4" + | "2.5" + | "2.6" + | "2.7" + | "2.8" + | "2.9" + | "2.10" + | "2.11" + | "Unstable"; + } +} + +export class Calls { + constructor(protected readonly _options: Calls.Options = {}) {} + + /** + * Retrieve a paginated list of calls. + * + * @param {Intercom.ListCallsRequest} request + * @param {Calls.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Intercom.UnauthorizedError} + * + * @example + * await client.calls.listCalls() + */ + public listCalls( + request: Intercom.ListCallsRequest = {}, + requestOptions?: Calls.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__listCalls(request, requestOptions)); + } + + private async __listCalls( + request: Intercom.ListCallsRequest = {}, + requestOptions?: Calls.RequestOptions, + ): Promise> { + const { page, per_page: perPage } = request; + const _queryParams: Record = {}; + if (page != null) { + _queryParams["page"] = page.toString(); + } + + if (perPage != null) { + _queryParams["per_page"] = perPage.toString(); + } + + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + "calls", + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "intercom-client", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", + "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 20000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { data: _response.body as Intercom.CallList, rawResponse: _response.rawResponse }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 401: + throw new Intercom.UnauthorizedError( + _response.error.body as Intercom.Error_, + _response.rawResponse, + ); + default: + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.IntercomTimeoutError("Timeout exceeded when calling GET /calls."); + case "unknown": + throw new errors.IntercomError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + } + + /** + * Retrieve a single call by id. + * + * @param {Intercom.ShowCallRequest} request + * @param {Calls.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Intercom.UnauthorizedError} + * @throws {@link Intercom.NotFoundError} + * + * @example + * await client.calls.showCall({ + * call_id: "call_id" + * }) + */ + public showCall( + request: Intercom.ShowCallRequest, + requestOptions?: Calls.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__showCall(request, requestOptions)); + } + + private async __showCall( + request: Intercom.ShowCallRequest, + requestOptions?: Calls.RequestOptions, + ): Promise> { + const { call_id: callId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `calls/${encodeURIComponent(callId)}`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "intercom-client", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", + "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 20000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { data: _response.body as Intercom.Call, rawResponse: _response.rawResponse }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 401: + throw new Intercom.UnauthorizedError( + _response.error.body as Intercom.Error_, + _response.rawResponse, + ); + case 404: + throw new Intercom.NotFoundError(_response.error.body as unknown, _response.rawResponse); + default: + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.IntercomTimeoutError("Timeout exceeded when calling GET /calls/{call_id}."); + case "unknown": + throw new errors.IntercomError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + } + + /** + * Redirects to a signed URL for the call's recording if it exists. + * + * @param {Intercom.ShowCallRecordingRequest} request + * @param {Calls.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Intercom.UnauthorizedError} + * @throws {@link Intercom.NotFoundError} + * + * @example + * await client.calls.showCallRecording({ + * call_id: "call_id" + * }) + */ + public showCallRecording( + request: Intercom.ShowCallRecordingRequest, + requestOptions?: Calls.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__showCallRecording(request, requestOptions)); + } + + private async __showCallRecording( + request: Intercom.ShowCallRecordingRequest, + requestOptions?: Calls.RequestOptions, + ): Promise> { + const { call_id: callId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `calls/${encodeURIComponent(callId)}/recording`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "intercom-client", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", + "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 20000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { data: undefined, rawResponse: _response.rawResponse }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 401: + throw new Intercom.UnauthorizedError( + _response.error.body as Intercom.Error_, + _response.rawResponse, + ); + case 404: + throw new Intercom.NotFoundError(_response.error.body as unknown, _response.rawResponse); + default: + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.IntercomTimeoutError("Timeout exceeded when calling GET /calls/{call_id}/recording."); + case "unknown": + throw new errors.IntercomError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + } + + /** + * Returns the transcript for the specified call as a downloadable text file. + * + * @param {Intercom.ShowCallTranscriptRequest} request + * @param {Calls.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Intercom.NotFoundError} + * + * @example + * await client.calls.showCallTranscript({ + * call_id: "call_id" + * }) + */ + public showCallTranscript( + request: Intercom.ShowCallTranscriptRequest, + requestOptions?: Calls.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__showCallTranscript(request, requestOptions)); + } + + private async __showCallTranscript( + request: Intercom.ShowCallTranscriptRequest, + requestOptions?: Calls.RequestOptions, + ): Promise> { + const { call_id: callId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `calls/${encodeURIComponent(callId)}/transcript`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "intercom-client", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", + "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + responseType: "text", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 20000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { data: _response.body as string, rawResponse: _response.rawResponse }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 404: + throw new Intercom.NotFoundError(_response.error.body as unknown, _response.rawResponse); + default: + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.IntercomTimeoutError("Timeout exceeded when calling GET /calls/{call_id}/transcript."); + case "unknown": + throw new errors.IntercomError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + } + + /** + * Retrieve calls by a list of conversation ids and include transcripts when available. + * A maximum of 20 `conversation_ids` can be provided. If none are provided or more than 20 are provided, a 400 error is returned. + * + * @param {Intercom.ListCallsWithTranscriptsRequest} request + * @param {Calls.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Intercom.BadRequestError} + * @throws {@link Intercom.UnauthorizedError} + * + * @example + * await client.calls.listCallsWithTranscripts({ + * conversation_ids: ["64619700005694", "64619700005695"] + * }) + */ + public listCallsWithTranscripts( + request: Intercom.ListCallsWithTranscriptsRequest, + requestOptions?: Calls.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__listCallsWithTranscripts(request, requestOptions)); + } + + private async __listCallsWithTranscripts( + request: Intercom.ListCallsWithTranscriptsRequest, + requestOptions?: Calls.RequestOptions, + ): Promise> { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + "calls/search", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "intercom-client", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", + "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: request, + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 20000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { + data: _response.body as Intercom.ListCallsWithTranscriptsResponse, + rawResponse: _response.rawResponse, + }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Intercom.BadRequestError(_response.error.body as unknown, _response.rawResponse); + case 401: + throw new Intercom.UnauthorizedError( + _response.error.body as Intercom.Error_, + _response.rawResponse, + ); + default: + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.IntercomTimeoutError("Timeout exceeded when calling POST /calls/search."); + case "unknown": + throw new errors.IntercomError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["INTERCOM_API_KEY"]; + if (bearer == null) { + throw new errors.IntercomError({ + message: + "Please specify a bearer by either passing it in to the constructor or initializing a INTERCOM_API_KEY environment variable", + }); + } + + return `Bearer ${bearer}`; + } +} diff --git a/src/api/resources/calls/client/index.ts b/src/api/resources/calls/client/index.ts new file mode 100644 index 00000000..415726b7 --- /dev/null +++ b/src/api/resources/calls/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/calls/client/requests/ListCallsRequest.ts b/src/api/resources/calls/client/requests/ListCallsRequest.ts new file mode 100644 index 00000000..344ffdc6 --- /dev/null +++ b/src/api/resources/calls/client/requests/ListCallsRequest.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * {} + */ +export interface ListCallsRequest { + /** + * The page of results to fetch. Defaults to first page + */ + page?: number; + /** + * How many results to display per page. Defaults to 25. Max 25. + */ + per_page?: number; +} diff --git a/src/api/resources/calls/client/requests/ListCallsWithTranscriptsRequest.ts b/src/api/resources/calls/client/requests/ListCallsWithTranscriptsRequest.ts new file mode 100644 index 00000000..634fceb6 --- /dev/null +++ b/src/api/resources/calls/client/requests/ListCallsWithTranscriptsRequest.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * conversation_ids: ["64619700005694", "64619700005695"] + * } + */ +export interface ListCallsWithTranscriptsRequest { + /** A list of conversation ids to fetch calls for. Maximum 20. */ + conversation_ids: string[]; +} diff --git a/src/api/resources/calls/client/requests/ShowCallRecordingRequest.ts b/src/api/resources/calls/client/requests/ShowCallRecordingRequest.ts new file mode 100644 index 00000000..a8b8bea1 --- /dev/null +++ b/src/api/resources/calls/client/requests/ShowCallRecordingRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * call_id: "call_id" + * } + */ +export interface ShowCallRecordingRequest { + /** + * The id of the call + */ + call_id: string; +} diff --git a/src/api/resources/calls/client/requests/ShowCallRequest.ts b/src/api/resources/calls/client/requests/ShowCallRequest.ts new file mode 100644 index 00000000..8e7b1653 --- /dev/null +++ b/src/api/resources/calls/client/requests/ShowCallRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * call_id: "call_id" + * } + */ +export interface ShowCallRequest { + /** + * The id of the call to retrieve + */ + call_id: string; +} diff --git a/src/api/resources/calls/client/requests/ShowCallTranscriptRequest.ts b/src/api/resources/calls/client/requests/ShowCallTranscriptRequest.ts new file mode 100644 index 00000000..f0c92540 --- /dev/null +++ b/src/api/resources/calls/client/requests/ShowCallTranscriptRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * call_id: "call_id" + * } + */ +export interface ShowCallTranscriptRequest { + /** + * The id of the call + */ + call_id: string; +} diff --git a/src/api/resources/calls/client/requests/index.ts b/src/api/resources/calls/client/requests/index.ts new file mode 100644 index 00000000..c186bb96 --- /dev/null +++ b/src/api/resources/calls/client/requests/index.ts @@ -0,0 +1,5 @@ +export { type ListCallsRequest } from "./ListCallsRequest"; +export { type ShowCallRequest } from "./ShowCallRequest"; +export { type ShowCallRecordingRequest } from "./ShowCallRecordingRequest"; +export { type ShowCallTranscriptRequest } from "./ShowCallTranscriptRequest"; +export { type ListCallsWithTranscriptsRequest } from "./ListCallsWithTranscriptsRequest"; diff --git a/src/api/resources/calls/index.ts b/src/api/resources/calls/index.ts new file mode 100644 index 00000000..c9240f83 --- /dev/null +++ b/src/api/resources/calls/index.ts @@ -0,0 +1,2 @@ +export * from "./types"; +export * from "./client"; diff --git a/src/api/resources/calls/types/Call.ts b/src/api/resources/calls/types/Call.ts new file mode 100644 index 00000000..0bc1253c --- /dev/null +++ b/src/api/resources/calls/types/Call.ts @@ -0,0 +1,42 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Intercom from "../../../index"; + +/** + * Represents a phone call in Intercom + */ +export interface Call { + /** String representing the object's type. Always has the value `call`. */ + type?: string; + /** The id of the call. */ + id?: string; + /** The id of the conversation associated with the call, if any. */ + conversation_id?: string; + /** The id of the admin associated with the call, if any. */ + admin_id?: string; + /** The id of the contact associated with the call, if any. */ + contact_id?: string; + /** The current state of the call. */ + state?: string; + initiated_at?: Intercom.Datetime; + answered_at?: Intercom.Datetime; + ended_at?: Intercom.Datetime; + created_at?: Intercom.Datetime; + updated_at?: Intercom.Datetime; + /** API URL to download or redirect to the call recording if available. */ + recording_url?: string; + /** The type of call. */ + call_type?: string; + /** The direction of the call. */ + direction?: string; + /** The reason for the call end, if applicable. */ + ended_reason?: string; + /** The phone number involved in the call, in E.164 format. */ + phone?: string; + /** API URL to the AI Agent (Fin) call recording if available. */ + fin_recording_url?: string; + /** API URL to the AI Agent (Fin) call transcript if available. */ + fin_transcription_url?: string; +} diff --git a/src/api/resources/calls/types/ListCallsWithTranscriptsResponse.ts b/src/api/resources/calls/types/ListCallsWithTranscriptsResponse.ts new file mode 100644 index 00000000..c0aa7f4f --- /dev/null +++ b/src/api/resources/calls/types/ListCallsWithTranscriptsResponse.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Intercom from "../../../index"; + +export interface ListCallsWithTranscriptsResponse { + type?: string; + data?: ListCallsWithTranscriptsResponse.Data.Item[]; +} + +export namespace ListCallsWithTranscriptsResponse { + export type Data = Data.Item[]; + + export namespace Data { + export interface Item extends Intercom.Call { + /** The call transcript if available, otherwise an empty array. */ + transcript?: Record[]; + /** The status of the transcript if available. */ + transcript_status?: string; + } + } +} diff --git a/src/api/resources/calls/types/index.ts b/src/api/resources/calls/types/index.ts new file mode 100644 index 00000000..bd1a1dd3 --- /dev/null +++ b/src/api/resources/calls/types/index.ts @@ -0,0 +1,2 @@ +export * from "./ListCallsWithTranscriptsResponse"; +export * from "./Call"; diff --git a/src/api/resources/companies/client/Client.ts b/src/api/resources/companies/client/Client.ts index 5ac7d49b..785fa132 100644 --- a/src/api/resources/companies/client/Client.ts +++ b/src/api/resources/companies/client/Client.ts @@ -151,8 +151,8 @@ export class Companies { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -227,19 +227,16 @@ export class Companies { * company_id: "company_remote_id", * remote_created_at: 1374138000 * }) - * - * @example - * await client.companies.createOrUpdate() */ public createOrUpdate( - request: Intercom.CreateOrUpdateCompanyRequest = {}, + request?: Intercom.CreateOrUpdateCompanyRequest, requestOptions?: Companies.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__createOrUpdate(request, requestOptions)); } private async __createOrUpdate( - request: Intercom.CreateOrUpdateCompanyRequest = {}, + request?: Intercom.CreateOrUpdateCompanyRequest, requestOptions?: Companies.RequestOptions, ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ @@ -254,8 +251,8 @@ export class Companies { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -263,7 +260,7 @@ export class Companies { }, contentType: "application/json", requestType: "json", - body: request, + body: request != null ? request : undefined, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 20000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -345,8 +342,8 @@ export class Companies { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -439,8 +436,8 @@ export class Companies { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -529,8 +526,8 @@ export class Companies { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -606,16 +603,7 @@ export class Companies { request: Intercom.ListAttachedContactsRequest, requestOptions?: Companies.RequestOptions, ): Promise> { - const { company_id: companyId, page, per_page: perPage } = request; - const _queryParams: Record = {}; - if (page != null) { - _queryParams["page"] = page.toString(); - } - - if (perPage != null) { - _queryParams["per_page"] = perPage.toString(); - } - + const { company_id: companyId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.baseUrl)) ?? @@ -628,15 +616,14 @@ export class Companies { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, ...requestOptions?.headers, }, contentType: "application/json", - queryParameters: _queryParams, requestType: "json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 20000, maxRetries: requestOptions?.maxRetries, @@ -721,8 +708,8 @@ export class Companies { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -825,8 +812,8 @@ export class Companies { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -919,7 +906,9 @@ export class Companies { requestOptions?: Companies.RequestOptions, ): Promise> { const list = core.HttpResponsePromise.interceptFunction( - async (request: Intercom.ScrollCompaniesRequest): Promise> => { + async ( + request: Intercom.ScrollCompaniesRequest, + ): Promise> => { const { scroll_param: scrollParam } = request; const _queryParams: Record = {}; if (scrollParam != null) { @@ -937,8 +926,8 @@ export class Companies { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -953,7 +942,10 @@ export class Companies { abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return { data: _response.body as Intercom.CompanyScroll, rawResponse: _response.rawResponse }; + return { + data: _response.body as Intercom.CompanyScroll | undefined, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { switch (_response.error.statusCode) { @@ -988,7 +980,7 @@ export class Companies { }, ); const dataWithRawResponse = await list(request).withRawResponse(); - return new core.Pageable({ + return new core.Pageable({ response: dataWithRawResponse.data, rawResponse: dataWithRawResponse.rawResponse, hasNextPage: (response) => response?.scroll_param != null, @@ -1011,19 +1003,19 @@ export class Companies { * * @example * await client.companies.attachContact({ - * contact_id: "contact_id", - * id: "667d608d8a68186f43bafd70" + * contact_id: 1, + * id: "6762f09a1bb69f9f2193bb34" * }) * * @example * await client.companies.attachContact({ - * contact_id: "contact_id", + * contact_id: 1, * id: "58a430d35458202d41b1e65b" * }) * * @example * await client.companies.attachContact({ - * contact_id: "contact_id", + * contact_id: 1, * id: "123" * }) */ @@ -1051,8 +1043,8 @@ export class Companies { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -1147,8 +1139,8 @@ export class Companies { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, diff --git a/src/api/resources/companies/client/requests/AttachContactToCompanyRequest.ts b/src/api/resources/companies/client/requests/AttachContactToCompanyRequest.ts index 17a7d4b3..9b992198 100644 --- a/src/api/resources/companies/client/requests/AttachContactToCompanyRequest.ts +++ b/src/api/resources/companies/client/requests/AttachContactToCompanyRequest.ts @@ -5,19 +5,19 @@ /** * @example * { - * contact_id: "contact_id", - * id: "667d608d8a68186f43bafd70" + * contact_id: 1, + * id: "6762f09a1bb69f9f2193bb34" * } * * @example * { - * contact_id: "contact_id", + * contact_id: 1, * id: "58a430d35458202d41b1e65b" * } * * @example * { - * contact_id: "contact_id", + * contact_id: 1, * id: "123" * } */ @@ -25,7 +25,7 @@ export interface AttachContactToCompanyRequest { /** * The unique identifier for the contact which is given by Intercom */ - contact_id: string; + contact_id: number; /** The unique identifier for the company which is given by Intercom */ id: string; } diff --git a/src/api/resources/companies/client/requests/ListAttachedContactsRequest.ts b/src/api/resources/companies/client/requests/ListAttachedContactsRequest.ts index af7ff8a7..6c7ad6dc 100644 --- a/src/api/resources/companies/client/requests/ListAttachedContactsRequest.ts +++ b/src/api/resources/companies/client/requests/ListAttachedContactsRequest.ts @@ -13,12 +13,4 @@ export interface ListAttachedContactsRequest { * The unique identifier for the company which is given by Intercom */ company_id: string; - /** - * The page of results to fetch. Defaults to first page - */ - page?: number; - /** - * How many results to return per page. Defaults to 15 - */ - per_page?: number; } diff --git a/src/api/resources/companies/client/requests/index.ts b/src/api/resources/companies/client/requests/index.ts index 6e45efe4..02ade1ec 100644 --- a/src/api/resources/companies/client/requests/index.ts +++ b/src/api/resources/companies/client/requests/index.ts @@ -1,5 +1,4 @@ export { type RetrieveCompanyRequest } from "./RetrieveCompanyRequest"; -export { type CreateOrUpdateCompanyRequest } from "./CreateOrUpdateCompanyRequest"; export { type FindCompanyRequest } from "./FindCompanyRequest"; export { type UpdateCompanyRequest } from "./UpdateCompanyRequest"; export { type DeleteCompanyRequest } from "./DeleteCompanyRequest"; diff --git a/src/api/resources/companies/types/Company.ts b/src/api/resources/companies/types/Company.ts index 2de7fd36..1062b160 100644 --- a/src/api/resources/companies/types/Company.ts +++ b/src/api/resources/companies/types/Company.ts @@ -18,19 +18,19 @@ export interface Company { /** The company id you have defined for the company. */ company_id: string; /** The time the company was created by you. */ - remote_created_at: number; + remote_created_at?: number; /** The time the company was added in Intercom. */ created_at: number; /** The last time the company was updated. */ updated_at: number; /** The time the company last recorded making a request. */ - last_request_at: number; + last_request_at?: number; /** The number of employees in the company. */ - size: number; + size?: number; /** The URL for the company website. */ - website: string; + website?: string; /** The industry that the company operates in. */ - industry: string; + industry?: string; /** How much revenue the company generates for your business. */ monthly_spend: number; /** How many sessions the company has recorded. */ @@ -48,7 +48,7 @@ export interface Company { export namespace Company { export interface Plan { /** Value is always "plan" */ - type?: "plan"; + type?: string; /** The id of the plan */ id?: string; /** The name of the plan */ diff --git a/src/api/resources/contacts/client/Client.ts b/src/api/resources/contacts/client/Client.ts index 894de6c9..7512a282 100644 --- a/src/api/resources/contacts/client/Client.ts +++ b/src/api/resources/contacts/client/Client.ts @@ -117,8 +117,8 @@ export class Contacts { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -226,8 +226,8 @@ export class Contacts { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -324,8 +324,8 @@ export class Contacts { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -431,8 +431,8 @@ export class Contacts { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -525,8 +525,8 @@ export class Contacts { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -617,8 +617,8 @@ export class Contacts { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -685,14 +685,14 @@ export class Contacts { public find( request: Intercom.FindContactRequest, requestOptions?: Contacts.RequestOptions, - ): core.HttpResponsePromise { + ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__find(request, requestOptions)); } private async __find( request: Intercom.FindContactRequest, requestOptions?: Contacts.RequestOptions, - ): Promise> { + ): Promise> { const { contact_id: contactId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( @@ -706,8 +706,8 @@ export class Contacts { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -720,7 +720,7 @@ export class Contacts { abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return { data: _response.body as Intercom.Contact, rawResponse: _response.rawResponse }; + return { data: _response.body as Intercom.ContactsFindResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { @@ -759,6 +759,12 @@ export class Contacts { /** * You can update an existing contact (ie. user or lead). * + * {% admonition type="info" %} + * This endpoint handles both **contact updates** and **custom object associations**. + * + * See _`update a contact with an association to a custom object instance`_ in the request/response examples to see the custom object association format. + * {% /admonition %} + * * @param {Intercom.UpdateContactRequest} request * @param {Contacts.RequestOptions} requestOptions - Request-specific configuration. * @@ -770,18 +776,28 @@ export class Contacts { * email: "joebloggs@intercom.io", * name: "joe bloggs" * }) + * + * @example + * await client.contacts.update({ + * contact_id: "63a07ddf05a32042dffac965", + * custom_attributes: { + * "order": [ + * "21" + * ] + * } + * }) */ public update( request: Intercom.UpdateContactRequest, requestOptions?: Contacts.RequestOptions, - ): core.HttpResponsePromise { + ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__update(request, requestOptions)); } private async __update( request: Intercom.UpdateContactRequest, requestOptions?: Contacts.RequestOptions, - ): Promise> { + ): Promise> { const { contact_id: contactId, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( @@ -795,8 +811,8 @@ export class Contacts { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -810,7 +826,7 @@ export class Contacts { abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return { data: _response.body as Intercom.Contact, rawResponse: _response.rawResponse }; + return { data: _response.body as Intercom.ContactsUpdateResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { @@ -883,8 +899,8 @@ export class Contacts { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -943,21 +959,21 @@ export class Contacts { * * @example * await client.contacts.mergeLeadInUser({ - * from: "667d60ac8a68186f43bafdbb", - * into: "667d60ac8a68186f43bafdbc" + * from: "6762f0d51bb69f9f2193bb7f", + * into: "6762f0d51bb69f9f2193bb80" * }) */ public mergeLeadInUser( - request: Intercom.MergeContactsRequest, + request: Intercom.MergeContactsRequest = {}, requestOptions?: Contacts.RequestOptions, - ): core.HttpResponsePromise { + ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__mergeLeadInUser(request, requestOptions)); } private async __mergeLeadInUser( - request: Intercom.MergeContactsRequest, + request: Intercom.MergeContactsRequest = {}, requestOptions?: Contacts.RequestOptions, - ): Promise> { + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.baseUrl)) ?? @@ -970,8 +986,8 @@ export class Contacts { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -985,7 +1001,10 @@ export class Contacts { abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return { data: _response.body as Intercom.Contact, rawResponse: _response.rawResponse }; + return { + data: _response.body as Intercom.ContactsMergeLeadInUserResponse, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { @@ -1160,8 +1179,8 @@ export class Contacts { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -1268,8 +1287,8 @@ export class Contacts { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -1346,14 +1365,14 @@ export class Contacts { public create( request: Intercom.CreateContactRequest, requestOptions?: Contacts.RequestOptions, - ): core.HttpResponsePromise { + ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions)); } private async __create( request: Intercom.CreateContactRequest, requestOptions?: Contacts.RequestOptions, - ): Promise> { + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.baseUrl)) ?? @@ -1366,8 +1385,8 @@ export class Contacts { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -1381,7 +1400,7 @@ export class Contacts { abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return { data: _response.body as Intercom.Contact, rawResponse: _response.rawResponse }; + return { data: _response.body as Intercom.ContactsCreateResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { @@ -1417,6 +1436,98 @@ export class Contacts { } } + /** + * You can fetch the details of a single contact by external ID. Note that this endpoint only supports users and not leads. + * + * @param {Intercom.ShowContactByExternalIdRequest} request + * @param {Contacts.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Intercom.UnauthorizedError} + * + * @example + * await client.contacts.showContactByExternalId({ + * external_id: "cdd29344-5e0c-4ef0-ac56-f9ba2979bc27" + * }) + */ + public showContactByExternalId( + request: Intercom.ShowContactByExternalIdRequest, + requestOptions?: Contacts.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__showContactByExternalId(request, requestOptions)); + } + + private async __showContactByExternalId( + request: Intercom.ShowContactByExternalIdRequest, + requestOptions?: Contacts.RequestOptions, + ): Promise> { + const { external_id: externalId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `contacts/find_by_external_id/${encodeURIComponent(externalId)}`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "intercom-client", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", + "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 20000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { + data: _response.body as Intercom.ShowContactByExternalIdResponse, + rawResponse: _response.rawResponse, + }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 401: + throw new Intercom.UnauthorizedError( + _response.error.body as Intercom.Error_, + _response.rawResponse, + ); + default: + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.IntercomTimeoutError( + "Timeout exceeded when calling GET /contacts/find_by_external_id/{external_id}.", + ); + case "unknown": + throw new errors.IntercomError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + } + /** * You can archive a single contact. * @@ -1452,8 +1563,8 @@ export class Contacts { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -1531,8 +1642,8 @@ export class Contacts { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -1575,6 +1686,85 @@ export class Contacts { } } + /** + * Block a single contact.
**Note:** conversations of the contact will also be archived during the process.
More details in [FAQ How do I block Inbox spam?](https://www.intercom.com/help/en/articles/8838656-inbox-faqs) + * + * @param {Intercom.BlockContactRequest} request + * @param {Contacts.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.contacts.blockContact({ + * contact_id: "63a07ddf05a32042dffac965" + * }) + */ + public blockContact( + request: Intercom.BlockContactRequest, + requestOptions?: Contacts.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__blockContact(request, requestOptions)); + } + + private async __blockContact( + request: Intercom.BlockContactRequest, + requestOptions?: Contacts.RequestOptions, + ): Promise> { + const { contact_id: contactId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `contacts/${encodeURIComponent(contactId)}/block`, + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "intercom-client", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", + "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 20000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { data: _response.body as Intercom.ContactBlocked, rawResponse: _response.rawResponse }; + } + + if (_response.error.reason === "status-code") { + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.IntercomTimeoutError( + "Timeout exceeded when calling POST /contacts/{contact_id}/block.", + ); + case "unknown": + throw new errors.IntercomError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + } + protected async _getAuthorizationHeader(): Promise { const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["INTERCOM_API_KEY"]; if (bearer == null) { diff --git a/src/api/resources/contacts/client/requests/ArchiveContactRequest.ts b/src/api/resources/contacts/client/requests/ArchiveContactRequest.ts index 1e5452c4..7d7260df 100644 --- a/src/api/resources/contacts/client/requests/ArchiveContactRequest.ts +++ b/src/api/resources/contacts/client/requests/ArchiveContactRequest.ts @@ -10,7 +10,7 @@ */ export interface ArchiveContactRequest { /** - * id + * contact_id */ contact_id: string; } diff --git a/src/api/resources/contacts/client/requests/BlockContactRequest.ts b/src/api/resources/contacts/client/requests/BlockContactRequest.ts new file mode 100644 index 00000000..da1a04de --- /dev/null +++ b/src/api/resources/contacts/client/requests/BlockContactRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * contact_id: "63a07ddf05a32042dffac965" + * } + */ +export interface BlockContactRequest { + /** + * contact_id + */ + contact_id: string; +} diff --git a/src/api/resources/contacts/client/requests/DeleteContactRequest.ts b/src/api/resources/contacts/client/requests/DeleteContactRequest.ts index 559cfeb9..674b0b36 100644 --- a/src/api/resources/contacts/client/requests/DeleteContactRequest.ts +++ b/src/api/resources/contacts/client/requests/DeleteContactRequest.ts @@ -10,7 +10,7 @@ */ export interface DeleteContactRequest { /** - * id + * contact_id */ contact_id: string; } diff --git a/src/api/resources/contacts/client/requests/FindContactRequest.ts b/src/api/resources/contacts/client/requests/FindContactRequest.ts index 3eed3e85..8d6ddd9a 100644 --- a/src/api/resources/contacts/client/requests/FindContactRequest.ts +++ b/src/api/resources/contacts/client/requests/FindContactRequest.ts @@ -10,7 +10,7 @@ */ export interface FindContactRequest { /** - * id + * contact_id */ contact_id: string; } diff --git a/src/api/resources/contacts/client/requests/MergeContactsRequest.ts b/src/api/resources/contacts/client/requests/MergeContactsRequest.ts index 704efeb1..a9009e6a 100644 --- a/src/api/resources/contacts/client/requests/MergeContactsRequest.ts +++ b/src/api/resources/contacts/client/requests/MergeContactsRequest.ts @@ -5,13 +5,13 @@ /** * @example * { - * from: "667d60ac8a68186f43bafdbb", - * into: "667d60ac8a68186f43bafdbc" + * from: "6762f0d51bb69f9f2193bb7f", + * into: "6762f0d51bb69f9f2193bb80" * } */ export interface MergeContactsRequest { /** The unique identifier for the contact to merge away from. Must be a lead. */ - from: string; + from?: string; /** The unique identifier for the contact to merge into. Must be a user. */ - into: string; + into?: string; } diff --git a/src/api/resources/contacts/client/requests/ShowContactByExternalIdRequest.ts b/src/api/resources/contacts/client/requests/ShowContactByExternalIdRequest.ts new file mode 100644 index 00000000..af3dff76 --- /dev/null +++ b/src/api/resources/contacts/client/requests/ShowContactByExternalIdRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * external_id: "cdd29344-5e0c-4ef0-ac56-f9ba2979bc27" + * } + */ +export interface ShowContactByExternalIdRequest { + /** + * The external ID of the user that you want to retrieve + */ + external_id: string; +} diff --git a/src/api/resources/contacts/client/requests/UnarchiveContactRequest.ts b/src/api/resources/contacts/client/requests/UnarchiveContactRequest.ts index f014d7d2..a4bada3f 100644 --- a/src/api/resources/contacts/client/requests/UnarchiveContactRequest.ts +++ b/src/api/resources/contacts/client/requests/UnarchiveContactRequest.ts @@ -10,7 +10,7 @@ */ export interface UnarchiveContactRequest { /** - * id + * contact_id */ contact_id: string; } diff --git a/src/api/resources/contacts/client/requests/UpdateContactRequest.ts b/src/api/resources/contacts/client/requests/UpdateContactRequest.ts index 109178e2..e1806c65 100644 --- a/src/api/resources/contacts/client/requests/UpdateContactRequest.ts +++ b/src/api/resources/contacts/client/requests/UpdateContactRequest.ts @@ -9,6 +9,16 @@ * email: "joebloggs@intercom.io", * name: "joe bloggs" * } + * + * @example + * { + * contact_id: "63a07ddf05a32042dffac965", + * custom_attributes: { + * "order": [ + * "21" + * ] + * } + * } */ export interface UpdateContactRequest { /** diff --git a/src/api/resources/contacts/client/requests/index.ts b/src/api/resources/contacts/client/requests/index.ts index 1e895632..496fbd43 100644 --- a/src/api/resources/contacts/client/requests/index.ts +++ b/src/api/resources/contacts/client/requests/index.ts @@ -9,5 +9,7 @@ export { type UpdateContactRequest } from "./UpdateContactRequest"; export { type DeleteContactRequest } from "./DeleteContactRequest"; export { type MergeContactsRequest } from "./MergeContactsRequest"; export { type ListContactsRequest } from "./ListContactsRequest"; +export { type ShowContactByExternalIdRequest } from "./ShowContactByExternalIdRequest"; export { type ArchiveContactRequest } from "./ArchiveContactRequest"; export { type UnarchiveContactRequest } from "./UnarchiveContactRequest"; +export { type BlockContactRequest } from "./BlockContactRequest"; diff --git a/src/api/resources/contacts/types/Contact.ts b/src/api/resources/contacts/types/Contact.ts index a9bed2d3..220d7ae1 100644 --- a/src/api/resources/contacts/types/Contact.ts +++ b/src/api/resources/contacts/types/Contact.ts @@ -5,41 +5,39 @@ import * as Intercom from "../../../index"; /** - * Contact are the objects that represent your leads and users in Intercom. + * Contacts represent your leads and users in Intercom. */ export interface Contact { /** The type of object. */ type?: "contact"; /** The unique identifier for the contact which is given by Intercom. */ - id: string; + id?: string; /** The unique identifier for the contact which is provided by the Client. */ external_id?: string; /** The id of the workspace which the contact belongs to. */ - workspace_id: string; + workspace_id?: string; /** The role of the contact. */ - role: string; + role?: string; /** The contact's email. */ email?: string; /** The contact's email domain. */ email_domain?: string; /** The contacts phone. */ phone?: string; - /** The contacts phone number normalized to the E164 format */ - formatted_phone?: string; /** The contacts name. */ name?: string; /** The id of an admin that has been assigned account ownership of the contact. */ owner_id?: number; /** Whether the contact has had an email sent to them hard bounce. */ - has_hard_bounced: boolean; + has_hard_bounced?: boolean; /** Whether the contact has marked an email sent to them as spam. */ - marked_email_as_spam: boolean; + marked_email_as_spam?: boolean; /** Whether the contact is unsubscribed from emails. */ - unsubscribed_from_emails: boolean; + unsubscribed_from_emails?: boolean; /** (UNIX timestamp) The time when the contact was created. */ - created_at: number; + created_at?: number; /** (UNIX timestamp) The time when the contact was last updated. */ - updated_at: number; + updated_at?: number; /** (UNIX timestamp) The time specified for when a contact signed up. */ signed_up_at?: number; /** (UNIX timestamp) The time when the contact was last seen (either where the Intercom Messenger was installed or when specified manually). */ @@ -93,6 +91,6 @@ export interface Contact { tags?: Intercom.ContactTags; notes?: Intercom.ContactNotes; companies?: Intercom.ContactCompanies; - location: Intercom.ContactLocation; - social_profiles: Intercom.ContactSocialProfiles; + location?: Intercom.ContactLocation; + social_profiles?: Intercom.ContactSocialProfiles; } diff --git a/src/api/resources/contacts/types/ContactsCreateResponse.ts b/src/api/resources/contacts/types/ContactsCreateResponse.ts new file mode 100644 index 00000000..2c1a0919 --- /dev/null +++ b/src/api/resources/contacts/types/ContactsCreateResponse.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Intercom from "../../../index"; + +export interface ContactsCreateResponse extends Intercom.Contact { + /** If the user has enabled push messaging. */ + enabled_push_messaging?: boolean; +} diff --git a/src/api/resources/contacts/types/ContactsFindResponse.ts b/src/api/resources/contacts/types/ContactsFindResponse.ts new file mode 100644 index 00000000..85c1c2ca --- /dev/null +++ b/src/api/resources/contacts/types/ContactsFindResponse.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Intercom from "../../../index"; + +export interface ContactsFindResponse extends Intercom.Contact { + /** If the user has enabled push messaging. */ + enabled_push_messaging?: boolean; +} diff --git a/src/api/resources/contacts/types/ContactsMergeLeadInUserResponse.ts b/src/api/resources/contacts/types/ContactsMergeLeadInUserResponse.ts new file mode 100644 index 00000000..6b61a200 --- /dev/null +++ b/src/api/resources/contacts/types/ContactsMergeLeadInUserResponse.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Intercom from "../../../index"; + +export interface ContactsMergeLeadInUserResponse extends Intercom.Contact { + /** If the user has enabled push messaging. */ + enabled_push_messaging?: boolean; +} diff --git a/src/api/resources/contacts/types/ContactsUpdateResponse.ts b/src/api/resources/contacts/types/ContactsUpdateResponse.ts new file mode 100644 index 00000000..d8258d42 --- /dev/null +++ b/src/api/resources/contacts/types/ContactsUpdateResponse.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Intercom from "../../../index"; + +export interface ContactsUpdateResponse extends Intercom.Contact { + /** If the user has enabled push messaging. */ + enabled_push_messaging?: boolean; +} diff --git a/src/api/resources/contacts/types/ShowContactByExternalIdResponse.ts b/src/api/resources/contacts/types/ShowContactByExternalIdResponse.ts new file mode 100644 index 00000000..edb285d4 --- /dev/null +++ b/src/api/resources/contacts/types/ShowContactByExternalIdResponse.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Intercom from "../../../index"; + +export interface ShowContactByExternalIdResponse extends Intercom.Contact { + /** If the user has enabled push messaging. */ + enabled_push_messaging?: boolean; +} diff --git a/src/api/resources/contacts/types/index.ts b/src/api/resources/contacts/types/index.ts index b538eafc..1591d69d 100644 --- a/src/api/resources/contacts/types/index.ts +++ b/src/api/resources/contacts/types/index.ts @@ -1 +1,6 @@ +export * from "./ContactsFindResponse"; +export * from "./ContactsUpdateResponse"; +export * from "./ContactsMergeLeadInUserResponse"; +export * from "./ContactsCreateResponse"; +export * from "./ShowContactByExternalIdResponse"; export * from "./Contact"; diff --git a/src/api/resources/conversations/client/Client.ts b/src/api/resources/conversations/client/Client.ts index d24ccbfd..e3211eb7 100644 --- a/src/api/resources/conversations/client/Client.ts +++ b/src/api/resources/conversations/client/Client.ts @@ -100,7 +100,7 @@ export class Conversations { const list = core.HttpResponsePromise.interceptFunction( async ( request: Intercom.ListConversationsRequest, - ): Promise> => { + ): Promise> => { const { per_page: perPage, starting_after: startingAfter } = request; const _queryParams: Record = {}; if (perPage != null) { @@ -121,8 +121,8 @@ export class Conversations { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -137,10 +137,7 @@ export class Conversations { abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return { - data: _response.body as Intercom.PaginatedConversationResponse, - rawResponse: _response.rawResponse, - }; + return { data: _response.body as Intercom.ConversationList, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { switch (_response.error.statusCode) { @@ -180,7 +177,7 @@ export class Conversations { }, ); const dataWithRawResponse = await list(request).withRawResponse(); - return new core.Pageable({ + return new core.Pageable({ response: dataWithRawResponse.data, rawResponse: dataWithRawResponse.rawResponse, hasNextPage: (response) => response?.pages?.next?.starting_after != null, @@ -213,7 +210,7 @@ export class Conversations { * await client.conversations.create({ * from: { * type: "user", - * id: "667d60d18a68186f43bafddd" + * id: "6762f11b1bb69f9f2193bba3" * }, * body: "Hello there" * }) @@ -250,8 +247,8 @@ export class Conversations { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -326,7 +323,7 @@ export class Conversations { * * @example * await client.conversations.find({ - * conversation_id: "123", + * conversation_id: 1, * display_as: "plaintext" * }) */ @@ -341,12 +338,20 @@ export class Conversations { request: Intercom.FindConversationRequest, requestOptions?: Conversations.RequestOptions, ): Promise> { - const { conversation_id: conversationId, display_as: displayAs } = request; + const { + conversation_id: conversationId, + display_as: displayAs, + include_translations: includeTranslations, + } = request; const _queryParams: Record = {}; if (displayAs != null) { _queryParams["display_as"] = displayAs; } + if (includeTranslations != null) { + _queryParams["include_translations"] = includeTranslations.toString(); + } + const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.baseUrl)) ?? @@ -359,8 +364,8 @@ export class Conversations { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -424,6 +429,12 @@ export class Conversations { * If you want to reply to a coveration or take an action such as assign, unassign, open, close or snooze, take a look at the reply and manage endpoints. * {% /admonition %} * + * {% admonition type="info" %} + * This endpoint handles both **conversation updates** and **custom object associations**. + * + * See _`update a conversation with an association to a custom object instance`_ in the request/response examples to see the custom object association format. + * {% /admonition %} + * * @param {Intercom.UpdateConversationRequest} request * @param {Conversations.RequestOptions} requestOptions - Request-specific configuration. * @@ -433,14 +444,24 @@ export class Conversations { * * @example * await client.conversations.update({ - * conversation_id: "123", + * conversation_id: 1, * display_as: "plaintext", * read: true, + * title: "new conversation title", * custom_attributes: { * "issue_type": "Billing", * "priority": "High" * } * }) + * + * @example + * await client.conversations.update({ + * conversation_id: 1, + * display_as: "plaintext", + * custom_attributes: { + * "order": {} + * } + * }) */ public update( request: Intercom.UpdateConversationRequest, @@ -471,8 +492,8 @@ export class Conversations { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -529,6 +550,98 @@ export class Conversations { } } + /** + * You can delete a single conversation. + * + * @param {Intercom.DeleteConversationRequest} request + * @param {Conversations.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Intercom.UnauthorizedError} + * @throws {@link Intercom.ForbiddenError} + * + * @example + * await client.conversations.deleteConversation({ + * conversation_id: 1 + * }) + */ + public deleteConversation( + request: Intercom.DeleteConversationRequest, + requestOptions?: Conversations.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__deleteConversation(request, requestOptions)); + } + + private async __deleteConversation( + request: Intercom.DeleteConversationRequest, + requestOptions?: Conversations.RequestOptions, + ): Promise> { + const { conversation_id: conversationId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `conversations/${encodeURIComponent(conversationId)}`, + ), + method: "DELETE", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "intercom-client", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", + "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 20000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { data: _response.body as Intercom.ConversationDeleted, rawResponse: _response.rawResponse }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 401: + throw new Intercom.UnauthorizedError( + _response.error.body as Intercom.Error_, + _response.rawResponse, + ); + case 403: + throw new Intercom.ForbiddenError(_response.error.body as Intercom.Error_, _response.rawResponse); + default: + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.IntercomTimeoutError( + "Timeout exceeded when calling DELETE /conversations/{conversation_id}.", + ); + case "unknown": + throw new errors.IntercomError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + } + /** * You can search for multiple conversations by the value of their attributes in order to fetch exactly which ones you want. * @@ -551,7 +664,7 @@ export class Conversations { * * ### Accepted Fields * - * Most keys listed as part of the The conversation model is searchable, whether writeable or not. The value you search for has to match the accepted type, otherwise the query will fail (ie. as `created_at` accepts a date, the `value` cannot be a string such as `"foorbar"`). + * Most keys listed in the conversation model are searchable, whether writeable or not. The value you search for has to match the accepted type, otherwise the query will fail (ie. as `created_at` accepts a date, the `value` cannot be a string such as `"foorbar"`). * The `source.body` field is unique as the search will not be performed against the entire value, but instead against every element of the value separately. For example, when searching for a conversation with a `"I need support"` body - the query should contain a `=` operator with the value `"support"` for such conversation to be returned. A query with a `=` operator and a `"need support"` value will not yield a result. * * | Field | Type | @@ -653,9 +766,7 @@ export class Conversations { requestOptions?: Conversations.RequestOptions, ): Promise> { const list = core.HttpResponsePromise.interceptFunction( - async ( - request: Intercom.SearchRequest, - ): Promise> => { + async (request: Intercom.SearchRequest): Promise> => { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.baseUrl)) ?? @@ -668,8 +779,8 @@ export class Conversations { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -684,10 +795,7 @@ export class Conversations { abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return { - data: _response.body as Intercom.PaginatedConversationResponse, - rawResponse: _response.rawResponse, - }; + return { data: _response.body as Intercom.ConversationList, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { throw new errors.IntercomError({ @@ -716,7 +824,7 @@ export class Conversations { }, ); const dataWithRawResponse = await list(request).withRawResponse(); - return new core.Pageable({ + return new core.Pageable({ response: dataWithRawResponse.data, rawResponse: dataWithRawResponse.rawResponse, hasNextPage: (response) => response?.pages?.next?.starting_after != null, @@ -746,7 +854,7 @@ export class Conversations { * message_type: "comment", * type: "user", * body: "Thanks again :)", - * intercom_user_id: "667d60f18a68186f43bafdf4" + * intercom_user_id: "6762f1571bb69f9f2193bbbb" * } * }) * @@ -765,10 +873,31 @@ export class Conversations { * await client.conversations.reply({ * conversation_id: "123 or \"last\"", * body: { + * message_type: "quick_reply", + * type: "admin", + * admin_id: "3156780", + * reply_options: [{ + * text: "Yes", + * uuid: "a5e1c524-5ddd-4c3e-9328-6bca5d6e3edb" + * }, { + * text: "No", + * uuid: "f4a98af1-be56-4948-a57e-e1a83f8484c6" + * }] + * } + * }) + * + * @example + * await client.conversations.reply({ + * conversation_id: "123 or \"last\"", + * body: { * message_type: "comment", * type: "user", - * body: "Thanks again :)", - * intercom_user_id: "667d60f78a68186f43bafdf7" + * body: "body", + * reply_options: [{ + * text: "Yes", + * uuid: "a5e1c524-5ddd-4c3e-9328-6bca5d6e3edb" + * }], + * intercom_user_id: "6762f1621bb69f9f2193bbbe" * } * }) * @@ -779,7 +908,7 @@ export class Conversations { * message_type: "comment", * type: "user", * body: "Thanks again :)", - * intercom_user_id: "667d60f98a68186f43bafdf8" + * intercom_user_id: "6762f1661bb69f9f2193bbbf" * } * }) */ @@ -807,8 +936,8 @@ export class Conversations { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -942,8 +1071,8 @@ export class Conversations { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -999,107 +1128,6 @@ export class Conversations { } } - /** - * {% admonition type="danger" name="Deprecation of Run Assignment Rules" %} - * Run assignment rules is now deprecated in version 2.12 and future versions and will be permanently removed on December 31, 2026. After this date, any requests made to this endpoint will fail. - * {% /admonition %} - * You can let a conversation be automatically assigned following assignment rules. - * {% admonition type="warning" name="When using workflows" %} - * It is not possible to use this endpoint with Workflows. - * {% /admonition %} - * - * @param {Intercom.AutoAssignConversationRequest} request - * @param {Conversations.RequestOptions} requestOptions - Request-specific configuration. - * - * @throws {@link Intercom.UnauthorizedError} - * @throws {@link Intercom.ForbiddenError} - * @throws {@link Intercom.NotFoundError} - * - * @example - * await client.conversations.runAssignmentRules({ - * conversation_id: "123" - * }) - */ - public runAssignmentRules( - request: Intercom.AutoAssignConversationRequest, - requestOptions?: Conversations.RequestOptions, - ): core.HttpResponsePromise { - return core.HttpResponsePromise.fromPromise(this.__runAssignmentRules(request, requestOptions)); - } - - private async __runAssignmentRules( - request: Intercom.AutoAssignConversationRequest, - requestOptions?: Conversations.RequestOptions, - ): Promise> { - const { conversation_id: conversationId } = request; - const _response = await (this._options.fetcher ?? core.fetcher)({ - url: urlJoin( - (await core.Supplier.get(this._options.baseUrl)) ?? - (await core.Supplier.get(this._options.environment)) ?? - environments.IntercomEnvironment.UsProduction, - `conversations/${encodeURIComponent(conversationId)}/run_assignment_rules`, - ), - method: "POST", - headers: { - Authorization: await this._getAuthorizationHeader(), - "X-Fern-Language": "JavaScript", - "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", - "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", - "X-Fern-Runtime": core.RUNTIME.type, - "X-Fern-Runtime-Version": core.RUNTIME.version, - ...requestOptions?.headers, - }, - contentType: "application/json", - requestType: "json", - timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 20000, - maxRetries: requestOptions?.maxRetries, - abortSignal: requestOptions?.abortSignal, - }); - if (_response.ok) { - return { data: _response.body as Intercom.Conversation, rawResponse: _response.rawResponse }; - } - - if (_response.error.reason === "status-code") { - switch (_response.error.statusCode) { - case 401: - throw new Intercom.UnauthorizedError( - _response.error.body as Intercom.Error_, - _response.rawResponse, - ); - case 403: - throw new Intercom.ForbiddenError(_response.error.body as Intercom.Error_, _response.rawResponse); - case 404: - throw new Intercom.NotFoundError(_response.error.body as unknown, _response.rawResponse); - default: - throw new errors.IntercomError({ - statusCode: _response.error.statusCode, - body: _response.error.body, - rawResponse: _response.rawResponse, - }); - } - } - - switch (_response.error.reason) { - case "non-json": - throw new errors.IntercomError({ - statusCode: _response.error.statusCode, - body: _response.error.rawBody, - rawResponse: _response.rawResponse, - }); - case "timeout": - throw new errors.IntercomTimeoutError( - "Timeout exceeded when calling POST /conversations/{conversation_id}/run_assignment_rules.", - ); - case "unknown": - throw new errors.IntercomError({ - message: _response.error.errorMessage, - rawResponse: _response.rawResponse, - }); - } - } - /** * You can add participants who are contacts to a conversation, on behalf of either another contact or an admin. * @@ -1119,7 +1147,7 @@ export class Conversations { * conversation_id: "123", * admin_id: "12345", * customer: { - * intercom_user_id: "667d61168a68186f43bafe0d" + * intercom_user_id: "6762f19b1bb69f9f2193bbd4" * } * }) * @@ -1128,7 +1156,7 @@ export class Conversations { * conversation_id: "123", * admin_id: "12345", * customer: { - * intercom_user_id: "667d61188a68186f43bafe0e" + * intercom_user_id: "6762f19e1bb69f9f2193bbd5" * } * }) */ @@ -1156,8 +1184,8 @@ export class Conversations { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -1259,8 +1287,8 @@ export class Conversations { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -1368,8 +1396,8 @@ export class Conversations { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -1431,27 +1459,27 @@ export class Conversations { * * @example * await client.conversations.convertToTicket({ - * conversation_id: "123", - * ticket_type_id: "79" + * conversation_id: 1, + * ticket_type_id: "53" * }) * * @example * await client.conversations.convertToTicket({ - * conversation_id: "123", - * ticket_type_id: "80" + * conversation_id: 1, + * ticket_type_id: "54" * }) */ public convertToTicket( request: Intercom.ConvertConversationToTicketRequest, requestOptions?: Conversations.RequestOptions, - ): core.HttpResponsePromise { + ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__convertToTicket(request, requestOptions)); } private async __convertToTicket( request: Intercom.ConvertConversationToTicketRequest, requestOptions?: Conversations.RequestOptions, - ): Promise> { + ): Promise> { const { conversation_id: conversationId, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( @@ -1465,8 +1493,8 @@ export class Conversations { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -1480,7 +1508,7 @@ export class Conversations { abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return { data: _response.body as Intercom.Ticket, rawResponse: _response.rawResponse }; + return { data: _response.body as Intercom.Ticket | undefined, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { @@ -1515,6 +1543,83 @@ export class Conversations { } } + /** + * @param {Intercom.AutoAssignConversationRequest} request + * @param {Conversations.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.conversations.runAssignmentRules({ + * conversation_id: "conversation_id" + * }) + */ + public runAssignmentRules( + request: Intercom.AutoAssignConversationRequest, + requestOptions?: Conversations.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__runAssignmentRules(request, requestOptions)); + } + + private async __runAssignmentRules( + request: Intercom.AutoAssignConversationRequest, + requestOptions?: Conversations.RequestOptions, + ): Promise> { + const { conversation_id: conversationId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `conversations/${encodeURIComponent(conversationId)}/run_assignment_rules`, + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "intercom-client", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", + "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 20000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { data: undefined, rawResponse: _response.rawResponse }; + } + + if (_response.error.reason === "status-code") { + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.IntercomTimeoutError( + "Timeout exceeded when calling POST /conversations/{conversation_id}/run_assignment_rules.", + ); + case "unknown": + throw new errors.IntercomError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + } + protected async _getAuthorizationHeader(): Promise { const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["INTERCOM_API_KEY"]; if (bearer == null) { diff --git a/src/api/resources/conversations/client/requests/AttachContactToConversationRequest.ts b/src/api/resources/conversations/client/requests/AttachContactToConversationRequest.ts index 852c6c2f..ce3256c5 100644 --- a/src/api/resources/conversations/client/requests/AttachContactToConversationRequest.ts +++ b/src/api/resources/conversations/client/requests/AttachContactToConversationRequest.ts @@ -10,7 +10,7 @@ import * as Intercom from "../../../../index"; * conversation_id: "123", * admin_id: "12345", * customer: { - * intercom_user_id: "667d61168a68186f43bafe0d" + * intercom_user_id: "6762f19b1bb69f9f2193bbd4" * } * } * @@ -19,7 +19,7 @@ import * as Intercom from "../../../../index"; * conversation_id: "123", * admin_id: "12345", * customer: { - * intercom_user_id: "667d61188a68186f43bafe0e" + * intercom_user_id: "6762f19e1bb69f9f2193bbd5" * } * } */ diff --git a/src/api/resources/conversations/client/requests/AutoAssignConversationRequest.ts b/src/api/resources/conversations/client/requests/AutoAssignConversationRequest.ts index b5f6e0c6..58868f46 100644 --- a/src/api/resources/conversations/client/requests/AutoAssignConversationRequest.ts +++ b/src/api/resources/conversations/client/requests/AutoAssignConversationRequest.ts @@ -5,12 +5,9 @@ /** * @example * { - * conversation_id: "123" + * conversation_id: "conversation_id" * } */ export interface AutoAssignConversationRequest { - /** - * The identifier for the conversation as given by Intercom. - */ conversation_id: string; } diff --git a/src/api/resources/conversations/client/requests/ConvertConversationToTicketRequest.ts b/src/api/resources/conversations/client/requests/ConvertConversationToTicketRequest.ts index ce9e3abc..fea33071 100644 --- a/src/api/resources/conversations/client/requests/ConvertConversationToTicketRequest.ts +++ b/src/api/resources/conversations/client/requests/ConvertConversationToTicketRequest.ts @@ -7,21 +7,21 @@ import * as Intercom from "../../../../index"; /** * @example * { - * conversation_id: "123", - * ticket_type_id: "79" + * conversation_id: 1, + * ticket_type_id: "53" * } * * @example * { - * conversation_id: "123", - * ticket_type_id: "80" + * conversation_id: 1, + * ticket_type_id: "54" * } */ export interface ConvertConversationToTicketRequest { /** * The id of the conversation to target */ - conversation_id: string; + conversation_id: number; /** The ID of the type of ticket you want to convert the conversation to */ ticket_type_id: string; attributes?: Intercom.TicketRequestCustomAttributes; diff --git a/src/api/resources/conversations/client/requests/CreateConversationRequest.ts b/src/api/resources/conversations/client/requests/CreateConversationRequest.ts index 4c82a814..93ec0636 100644 --- a/src/api/resources/conversations/client/requests/CreateConversationRequest.ts +++ b/src/api/resources/conversations/client/requests/CreateConversationRequest.ts @@ -7,7 +7,7 @@ * { * from: { * type: "user", - * id: "667d60d18a68186f43bafddd" + * id: "6762f11b1bb69f9f2193bba3" * }, * body: "Hello there" * } diff --git a/src/api/resources/conversations/client/requests/DeleteConversationRequest.ts b/src/api/resources/conversations/client/requests/DeleteConversationRequest.ts new file mode 100644 index 00000000..7af79b78 --- /dev/null +++ b/src/api/resources/conversations/client/requests/DeleteConversationRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * conversation_id: 1 + * } + */ +export interface DeleteConversationRequest { + /** + * id + */ + conversation_id: number; +} diff --git a/src/api/resources/conversations/client/requests/FindConversationRequest.ts b/src/api/resources/conversations/client/requests/FindConversationRequest.ts index 094cfa53..a5d7996c 100644 --- a/src/api/resources/conversations/client/requests/FindConversationRequest.ts +++ b/src/api/resources/conversations/client/requests/FindConversationRequest.ts @@ -5,7 +5,7 @@ /** * @example * { - * conversation_id: "123", + * conversation_id: 1, * display_as: "plaintext" * } */ @@ -13,9 +13,13 @@ export interface FindConversationRequest { /** * The id of the conversation to target */ - conversation_id: string; + conversation_id: number; /** * Set to plaintext to retrieve conversation messages in plain text. */ display_as?: string; + /** + * If set to true, conversation parts will be translated to the detected language of the conversation. + */ + include_translations?: boolean; } diff --git a/src/api/resources/conversations/client/requests/ReplyToConversationRequest.ts b/src/api/resources/conversations/client/requests/ReplyToConversationRequest.ts index e9ae5970..46f4d088 100644 --- a/src/api/resources/conversations/client/requests/ReplyToConversationRequest.ts +++ b/src/api/resources/conversations/client/requests/ReplyToConversationRequest.ts @@ -12,7 +12,7 @@ import * as Intercom from "../../../../index"; * message_type: "comment", * type: "user", * body: "Thanks again :)", - * intercom_user_id: "667d60f18a68186f43bafdf4" + * intercom_user_id: "6762f1571bb69f9f2193bbbb" * } * } * @@ -31,10 +31,31 @@ import * as Intercom from "../../../../index"; * { * conversation_id: "123 or \"last\"", * body: { + * message_type: "quick_reply", + * type: "admin", + * admin_id: "3156780", + * reply_options: [{ + * text: "Yes", + * uuid: "a5e1c524-5ddd-4c3e-9328-6bca5d6e3edb" + * }, { + * text: "No", + * uuid: "f4a98af1-be56-4948-a57e-e1a83f8484c6" + * }] + * } + * } + * + * @example + * { + * conversation_id: "123 or \"last\"", + * body: { * message_type: "comment", * type: "user", - * body: "Thanks again :)", - * intercom_user_id: "667d60f78a68186f43bafdf7" + * body: "body", + * reply_options: [{ + * text: "Yes", + * uuid: "a5e1c524-5ddd-4c3e-9328-6bca5d6e3edb" + * }], + * intercom_user_id: "6762f1621bb69f9f2193bbbe" * } * } * @@ -45,7 +66,7 @@ import * as Intercom from "../../../../index"; * message_type: "comment", * type: "user", * body: "Thanks again :)", - * intercom_user_id: "667d60f98a68186f43bafdf8" + * intercom_user_id: "6762f1661bb69f9f2193bbbf" * } * } * @@ -56,7 +77,7 @@ import * as Intercom from "../../../../index"; * message_type: "comment", * type: "user", * body: "Thanks again :)", - * intercom_user_id: "667d60f18a68186f43bafdf4" + * intercom_user_id: "6762f1571bb69f9f2193bbbb" * } * } * @@ -67,7 +88,7 @@ import * as Intercom from "../../../../index"; * message_type: "comment", * type: "user", * body: "Thanks again :)", - * intercom_user_id: "667d60f18a68186f43bafdf4" + * intercom_user_id: "6762f1571bb69f9f2193bbbb" * } * } * @@ -78,7 +99,7 @@ import * as Intercom from "../../../../index"; * message_type: "comment", * type: "user", * body: "Thanks again :)", - * intercom_user_id: "667d60f18a68186f43bafdf4" + * intercom_user_id: "6762f1571bb69f9f2193bbbb" * } * } */ diff --git a/src/api/resources/conversations/client/requests/UpdateConversationRequest.ts b/src/api/resources/conversations/client/requests/UpdateConversationRequest.ts index 0590a00c..f271c40b 100644 --- a/src/api/resources/conversations/client/requests/UpdateConversationRequest.ts +++ b/src/api/resources/conversations/client/requests/UpdateConversationRequest.ts @@ -7,9 +7,10 @@ import * as Intercom from "../../../../index"; /** * @example * { - * conversation_id: "123", + * conversation_id: 1, * display_as: "plaintext", * read: true, + * title: "new conversation title", * custom_attributes: { * "issue_type": "Billing", * "priority": "High" @@ -18,9 +19,19 @@ import * as Intercom from "../../../../index"; * * @example * { - * conversation_id: "123", + * conversation_id: 1, + * display_as: "plaintext", + * custom_attributes: { + * "order": {} + * } + * } + * + * @example + * { + * conversation_id: 1, * display_as: "plaintext", * read: true, + * title: "new conversation title", * custom_attributes: { * "issue_type": "Billing", * "priority": "High" @@ -31,12 +42,16 @@ export interface UpdateConversationRequest { /** * The id of the conversation to target */ - conversation_id: string; + conversation_id: number; /** * Set to plaintext to retrieve conversation messages in plain text. */ display_as?: string; /** Mark a conversation as read within Intercom. */ read?: boolean; + /** The title given to the conversation */ + title?: string; custom_attributes?: Intercom.CustomAttributes; + /** The ID of the company that the conversation is associated with. The unique identifier for the company which is given by Intercom. Set to nil to remove company. */ + company_id?: string; } diff --git a/src/api/resources/conversations/client/requests/index.ts b/src/api/resources/conversations/client/requests/index.ts index fa317731..ab473c06 100644 --- a/src/api/resources/conversations/client/requests/index.ts +++ b/src/api/resources/conversations/client/requests/index.ts @@ -2,9 +2,10 @@ export { type ListConversationsRequest } from "./ListConversationsRequest"; export { type CreateConversationRequest } from "./CreateConversationRequest"; export { type FindConversationRequest } from "./FindConversationRequest"; export { type UpdateConversationRequest } from "./UpdateConversationRequest"; +export { type DeleteConversationRequest } from "./DeleteConversationRequest"; export { type ReplyToConversationRequest } from "./ReplyToConversationRequest"; export { type ManageConversationPartsRequest } from "./ManageConversationPartsRequest"; -export { type AutoAssignConversationRequest } from "./AutoAssignConversationRequest"; export { type AttachContactToConversationRequest } from "./AttachContactToConversationRequest"; export { type DetachContactFromConversationRequest } from "./DetachContactFromConversationRequest"; export { type ConvertConversationToTicketRequest } from "./ConvertConversationToTicketRequest"; +export { type AutoAssignConversationRequest } from "./AutoAssignConversationRequest"; diff --git a/src/api/resources/conversations/types/Conversation.ts b/src/api/resources/conversations/types/Conversation.ts index 3e08c1b6..9d52e1e5 100644 --- a/src/api/resources/conversations/types/Conversation.ts +++ b/src/api/resources/conversations/types/Conversation.ts @@ -9,37 +9,39 @@ import * as Intercom from "../../../index"; */ export interface Conversation { /** Always conversation. */ - type?: "conversation"; + type?: string; /** The id representing the conversation. */ - id: string; + id?: string; /** The title given to the conversation. */ title?: string; /** The time the conversation was created. */ - created_at: number; + created_at?: number; /** The last time the conversation was updated. */ - updated_at: number; + updated_at?: number; /** The last time a Contact responded to an Admin. In other words, the time a customer started waiting for a response. Set to null if last reply is from an Admin. */ waiting_since?: number; /** If set this is the time in the future when this conversation will be marked as open. i.e. it will be in a snoozed state until this time. i.e. it will be in a snoozed state until this time. */ snoozed_until?: number; /** Indicates whether a conversation is open (true) or closed (false). */ - open: boolean; + open?: boolean; /** Can be set to "open", "closed" or "snoozed". */ - state: Conversation.State; + state?: Conversation.State; /** Indicates whether a conversation has been read. */ - read: boolean; + read?: boolean; /** If marked as priority, it will return priority or else not_priority. */ priority?: Conversation.Priority; /** The id of the admin assigned to the conversation. If it's not assigned to an admin it will return null. */ admin_assignee_id?: number; /** The id of the team assigned to the conversation. If it's not assigned to a team it will return null. */ team_assignee_id?: string; + /** The ID of the company that the conversation is associated with. The unique identifier for the company which is given by Intercom. */ + company_id?: string; tags?: Intercom.Tags; conversation_rating?: Intercom.ConversationRating; - source: Intercom.ConversationSource; - contacts: Intercom.ConversationContacts; - teammates: Intercom.ConversationTeammates; - custom_attributes: Intercom.CustomAttributes; + source?: Intercom.ConversationSource; + contacts?: Intercom.ConversationContacts; + teammates?: Intercom.ConversationTeammates; + custom_attributes?: Intercom.CustomAttributes; first_contact_reply?: Intercom.ConversationFirstContactReply; sla_applied?: Intercom.SlaApplied; statistics?: Intercom.ConversationStatistics; diff --git a/src/api/resources/customChannelEvents/client/Client.ts b/src/api/resources/customChannelEvents/client/Client.ts new file mode 100644 index 00000000..a20e0ae3 --- /dev/null +++ b/src/api/resources/customChannelEvents/client/Client.ts @@ -0,0 +1,535 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Intercom from "../../../index"; +import urlJoin from "url-join"; +import * as errors from "../../../../errors/index"; + +export declare namespace CustomChannelEvents { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Intercom-Version header */ + version?: + | "1.0" + | "1.1" + | "1.2" + | "1.3" + | "1.4" + | "2.0" + | "2.1" + | "2.2" + | "2.3" + | "2.4" + | "2.5" + | "2.6" + | "2.7" + | "2.8" + | "2.9" + | "2.10" + | "2.11" + | "Unstable"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Additional headers to include in the request. */ + headers?: Record; + /** Override the Intercom-Version header */ + version?: + | "1.0" + | "1.1" + | "1.2" + | "1.3" + | "1.4" + | "2.0" + | "2.1" + | "2.2" + | "2.3" + | "2.4" + | "2.5" + | "2.6" + | "2.7" + | "2.8" + | "2.9" + | "2.10" + | "2.11" + | "Unstable"; + } +} + +/** + * With the "Custom Channel" integration, you can bring Fin and Intercom capabilities to your own platform via API, enabling powerful custom integrations. + * + * Intercom treats your integration like any other Intercom channel, allowing your application and Intercom to exchange events seamlessly. This makes it possible, for example, for your users to interact with Fin directly within your own application’s UI. + * + * > **Note:** "Fin over API" is currently under managed availability. Please reach out to your accounts team to discuss access and tailored, hands-on support. + */ +export class CustomChannelEvents { + constructor(protected readonly _options: CustomChannelEvents.Options = {}) {} + + /** + * Notifies Intercom that a new conversation was created in your custom channel/platform. This triggers conversation creation and workflow automations within Intercom for your custom channel integration. + * > **Note:** This endpoint is currently under managed availability. Please reach out to your accounts team to discuss access and tailored, hands-on support. + * + * @param {Intercom.CustomChannelBaseEvent} request + * @param {CustomChannelEvents.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Intercom.BadRequestError} + * @throws {@link Intercom.UnauthorizedError} + * @throws {@link Intercom.NotFoundError} + * @throws {@link Intercom.UnprocessableEntityError} + * + * @example + * await client.customChannelEvents.notifyNewConversation({ + * event_id: "event_id", + * external_conversation_id: "external_conversation_id", + * contact: { + * type: "user", + * external_id: "external_id", + * name: undefined, + * email: undefined + * } + * }) + */ + public notifyNewConversation( + request: Intercom.CustomChannelBaseEvent, + requestOptions?: CustomChannelEvents.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__notifyNewConversation(request, requestOptions)); + } + + private async __notifyNewConversation( + request: Intercom.CustomChannelBaseEvent, + requestOptions?: CustomChannelEvents.RequestOptions, + ): Promise> { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + "custom_channel_events/notify_new_conversation", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "intercom-client", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", + "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: request, + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 20000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { + data: _response.body as Intercom.CustomChannelNotificationResponse, + rawResponse: _response.rawResponse, + }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Intercom.BadRequestError(_response.error.body as unknown, _response.rawResponse); + case 401: + throw new Intercom.UnauthorizedError( + _response.error.body as Intercom.Error_, + _response.rawResponse, + ); + case 404: + throw new Intercom.NotFoundError(_response.error.body as unknown, _response.rawResponse); + case 422: + throw new Intercom.UnprocessableEntityError(_response.error.body as unknown, _response.rawResponse); + default: + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.IntercomTimeoutError( + "Timeout exceeded when calling POST /custom_channel_events/notify_new_conversation.", + ); + case "unknown": + throw new errors.IntercomError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + } + + /** + * Notifies Intercom that a new message was sent in a conversation on your custom channel/platform. This allows Intercom to process the message and trigger any relevant workflow automations. + * > **Note:** This endpoint is currently under managed availability. Please reach out to your accounts team to discuss access and tailored, hands-on support. + * + * @param {Intercom.NotifyNewMessageRequest} request + * @param {CustomChannelEvents.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Intercom.BadRequestError} + * @throws {@link Intercom.UnauthorizedError} + * @throws {@link Intercom.NotFoundError} + * @throws {@link Intercom.UnprocessableEntityError} + * + * @example + * await client.customChannelEvents.notifyNewMessage({ + * body: "body", + * event_id: "event_id", + * external_conversation_id: "external_conversation_id", + * contact: { + * type: "user", + * external_id: "external_id", + * name: undefined, + * email: undefined + * } + * }) + */ + public notifyNewMessage( + request: Intercom.NotifyNewMessageRequest, + requestOptions?: CustomChannelEvents.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__notifyNewMessage(request, requestOptions)); + } + + private async __notifyNewMessage( + request: Intercom.NotifyNewMessageRequest, + requestOptions?: CustomChannelEvents.RequestOptions, + ): Promise> { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + "custom_channel_events/notify_new_message", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "intercom-client", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", + "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: request, + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 20000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { + data: _response.body as Intercom.CustomChannelNotificationResponse, + rawResponse: _response.rawResponse, + }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Intercom.BadRequestError(_response.error.body as unknown, _response.rawResponse); + case 401: + throw new Intercom.UnauthorizedError( + _response.error.body as Intercom.Error_, + _response.rawResponse, + ); + case 404: + throw new Intercom.NotFoundError(_response.error.body as unknown, _response.rawResponse); + case 422: + throw new Intercom.UnprocessableEntityError(_response.error.body as unknown, _response.rawResponse); + default: + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.IntercomTimeoutError( + "Timeout exceeded when calling POST /custom_channel_events/notify_new_message.", + ); + case "unknown": + throw new errors.IntercomError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + } + + /** + * Notifies Intercom that a user selected a quick reply option in your custom channel/platform. This allows Intercom to process the response and trigger any relevant workflow automations. + * > **Note:** This endpoint is currently under managed availability. Please reach out to your accounts team to discuss access and tailored, hands-on support. + * + * @param {Intercom.NotifyQuickReplySelectedRequest} request + * @param {CustomChannelEvents.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Intercom.BadRequestError} + * @throws {@link Intercom.UnauthorizedError} + * @throws {@link Intercom.NotFoundError} + * @throws {@link Intercom.UnprocessableEntityError} + * + * @example + * await client.customChannelEvents.notifyQuickReplySelected({ + * event_id: "evt_67890", + * external_conversation_id: "conv_13579", + * contact: { + * type: "user", + * external_id: "user_003", + * name: "Alice Example", + * email: "alice@example.com" + * }, + * quick_reply_option_id: "1234" + * }) + */ + public notifyQuickReplySelected( + request: Intercom.NotifyQuickReplySelectedRequest, + requestOptions?: CustomChannelEvents.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__notifyQuickReplySelected(request, requestOptions)); + } + + private async __notifyQuickReplySelected( + request: Intercom.NotifyQuickReplySelectedRequest, + requestOptions?: CustomChannelEvents.RequestOptions, + ): Promise> { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + "custom_channel_events/notify_quick_reply_selected", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "intercom-client", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", + "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: request, + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 20000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { + data: _response.body as Intercom.CustomChannelNotificationResponse, + rawResponse: _response.rawResponse, + }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Intercom.BadRequestError(_response.error.body as unknown, _response.rawResponse); + case 401: + throw new Intercom.UnauthorizedError( + _response.error.body as Intercom.Error_, + _response.rawResponse, + ); + case 404: + throw new Intercom.NotFoundError(_response.error.body as unknown, _response.rawResponse); + case 422: + throw new Intercom.UnprocessableEntityError(_response.error.body as unknown, _response.rawResponse); + default: + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.IntercomTimeoutError( + "Timeout exceeded when calling POST /custom_channel_events/notify_quick_reply_selected.", + ); + case "unknown": + throw new errors.IntercomError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + } + + /** + * Notifies Intercom that a user provided a response to an attribute collector in your custom channel/platform. This allows Intercom to process the attribute and trigger any relevant workflow automations. + * > **Note:** This endpoint is currently under managed availability. Please reach out to your accounts team to discuss access and tailored, hands-on support. + * + * @param {Intercom.NotifyAttributeCollectedRequest} request + * @param {CustomChannelEvents.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Intercom.BadRequestError} + * @throws {@link Intercom.UnauthorizedError} + * @throws {@link Intercom.NotFoundError} + * @throws {@link Intercom.UnprocessableEntityError} + * + * @example + * await client.customChannelEvents.notifyAttributeCollected({ + * attribute: { + * id: "id", + * value: "value" + * }, + * event_id: "event_id", + * external_conversation_id: "external_conversation_id", + * contact: { + * type: "user", + * external_id: "external_id", + * name: undefined, + * email: undefined + * } + * }) + */ + public notifyAttributeCollected( + request: Intercom.NotifyAttributeCollectedRequest, + requestOptions?: CustomChannelEvents.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__notifyAttributeCollected(request, requestOptions)); + } + + private async __notifyAttributeCollected( + request: Intercom.NotifyAttributeCollectedRequest, + requestOptions?: CustomChannelEvents.RequestOptions, + ): Promise> { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + "custom_channel_events/notify_attribute_collected", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "intercom-client", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", + "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: request, + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 20000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { + data: _response.body as Intercom.CustomChannelNotificationResponse, + rawResponse: _response.rawResponse, + }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Intercom.BadRequestError(_response.error.body as unknown, _response.rawResponse); + case 401: + throw new Intercom.UnauthorizedError( + _response.error.body as Intercom.Error_, + _response.rawResponse, + ); + case 404: + throw new Intercom.NotFoundError(_response.error.body as unknown, _response.rawResponse); + case 422: + throw new Intercom.UnprocessableEntityError(_response.error.body as unknown, _response.rawResponse); + default: + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.IntercomTimeoutError( + "Timeout exceeded when calling POST /custom_channel_events/notify_attribute_collected.", + ); + case "unknown": + throw new errors.IntercomError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["INTERCOM_API_KEY"]; + if (bearer == null) { + throw new errors.IntercomError({ + message: + "Please specify a bearer by either passing it in to the constructor or initializing a INTERCOM_API_KEY environment variable", + }); + } + + return `Bearer ${bearer}`; + } +} diff --git a/src/api/resources/customChannelEvents/client/index.ts b/src/api/resources/customChannelEvents/client/index.ts new file mode 100644 index 00000000..415726b7 --- /dev/null +++ b/src/api/resources/customChannelEvents/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/customChannelEvents/client/requests/NotifyAttributeCollectedRequest.ts b/src/api/resources/customChannelEvents/client/requests/NotifyAttributeCollectedRequest.ts new file mode 100644 index 00000000..4fbc9a24 --- /dev/null +++ b/src/api/resources/customChannelEvents/client/requests/NotifyAttributeCollectedRequest.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Intercom from "../../../../index"; + +/** + * @example + * { + * attribute: { + * id: "id", + * value: "value" + * }, + * event_id: "event_id", + * external_conversation_id: "external_conversation_id", + * contact: { + * type: "user", + * external_id: "external_id", + * name: undefined, + * email: undefined + * } + * } + */ +export interface NotifyAttributeCollectedRequest extends Intercom.CustomChannelBaseEvent { + attribute: Intercom.CustomChannelAttribute; +} diff --git a/src/api/resources/customChannelEvents/client/requests/NotifyNewMessageRequest.ts b/src/api/resources/customChannelEvents/client/requests/NotifyNewMessageRequest.ts new file mode 100644 index 00000000..8f399d84 --- /dev/null +++ b/src/api/resources/customChannelEvents/client/requests/NotifyNewMessageRequest.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Intercom from "../../../../index"; + +/** + * @example + * { + * body: "body", + * event_id: "event_id", + * external_conversation_id: "external_conversation_id", + * contact: { + * type: "user", + * external_id: "external_id", + * name: undefined, + * email: undefined + * } + * } + */ +export interface NotifyNewMessageRequest extends Intercom.CustomChannelBaseEvent { + /** The message content sent by the user. */ + body: string; +} diff --git a/src/api/resources/customChannelEvents/client/requests/NotifyQuickReplySelectedRequest.ts b/src/api/resources/customChannelEvents/client/requests/NotifyQuickReplySelectedRequest.ts new file mode 100644 index 00000000..99e088b7 --- /dev/null +++ b/src/api/resources/customChannelEvents/client/requests/NotifyQuickReplySelectedRequest.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Intercom from "../../../../index"; + +/** + * @example + * { + * event_id: "evt_67890", + * external_conversation_id: "conv_13579", + * contact: { + * type: "user", + * external_id: "user_003", + * name: "Alice Example", + * email: "alice@example.com" + * }, + * quick_reply_option_id: "1234" + * } + */ +export interface NotifyQuickReplySelectedRequest extends Intercom.CustomChannelBaseEvent { + /** Id of the selected quick reply option. */ + quick_reply_option_id: string; +} diff --git a/src/api/resources/customChannelEvents/client/requests/index.ts b/src/api/resources/customChannelEvents/client/requests/index.ts new file mode 100644 index 00000000..007800f3 --- /dev/null +++ b/src/api/resources/customChannelEvents/client/requests/index.ts @@ -0,0 +1,3 @@ +export { type NotifyNewMessageRequest } from "./NotifyNewMessageRequest"; +export { type NotifyQuickReplySelectedRequest } from "./NotifyQuickReplySelectedRequest"; +export { type NotifyAttributeCollectedRequest } from "./NotifyAttributeCollectedRequest"; diff --git a/src/api/resources/customChannelEvents/index.ts b/src/api/resources/customChannelEvents/index.ts new file mode 100644 index 00000000..5ec76921 --- /dev/null +++ b/src/api/resources/customChannelEvents/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/customObjectInstances/client/Client.ts b/src/api/resources/customObjectInstances/client/Client.ts new file mode 100644 index 00000000..417380fe --- /dev/null +++ b/src/api/resources/customObjectInstances/client/Client.ts @@ -0,0 +1,589 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Intercom from "../../../index"; +import urlJoin from "url-join"; +import * as errors from "../../../../errors/index"; + +export declare namespace CustomObjectInstances { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Intercom-Version header */ + version?: + | "1.0" + | "1.1" + | "1.2" + | "1.3" + | "1.4" + | "2.0" + | "2.1" + | "2.2" + | "2.3" + | "2.4" + | "2.5" + | "2.6" + | "2.7" + | "2.8" + | "2.9" + | "2.10" + | "2.11" + | "Unstable"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Additional headers to include in the request. */ + headers?: Record; + /** Override the Intercom-Version header */ + version?: + | "1.0" + | "1.1" + | "1.2" + | "1.3" + | "1.4" + | "2.0" + | "2.1" + | "2.2" + | "2.3" + | "2.4" + | "2.5" + | "2.6" + | "2.7" + | "2.8" + | "2.9" + | "2.10" + | "2.11" + | "Unstable"; + } +} + +/** + * Everything about your Custom Object instances. + * {% admonition type="warning" name="Permission Requirements" %} + * From now on, to access this endpoint, you need additional permissions. Please head over to the [Developer Hub](https://app.intercom.com/a/apps/_/developer-hub) app package authentication settings to configure the required permissions. + * {% /admonition %} + */ +export class CustomObjectInstances { + constructor(protected readonly _options: CustomObjectInstances.Options = {}) {} + + /** + * Fetch a Custom Object Instance by external_id. + * + * @param {Intercom.GetCustomObjectInstancesByExternalIdRequest} request + * @param {CustomObjectInstances.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Intercom.UnauthorizedError} + * @throws {@link Intercom.NotFoundError} + * + * @example + * await client.customObjectInstances.getCustomObjectInstancesByExternalId({ + * custom_object_type_identifier: "Order", + * external_id: "external_id" + * }) + */ + public getCustomObjectInstancesByExternalId( + request: Intercom.GetCustomObjectInstancesByExternalIdRequest, + requestOptions?: CustomObjectInstances.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise( + this.__getCustomObjectInstancesByExternalId(request, requestOptions), + ); + } + + private async __getCustomObjectInstancesByExternalId( + request: Intercom.GetCustomObjectInstancesByExternalIdRequest, + requestOptions?: CustomObjectInstances.RequestOptions, + ): Promise> { + const { custom_object_type_identifier: customObjectTypeIdentifier, external_id: externalId } = request; + const _queryParams: Record = {}; + _queryParams["external_id"] = externalId; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `custom_object_instances/${encodeURIComponent(customObjectTypeIdentifier)}`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "intercom-client", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", + "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 20000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { + data: _response.body as Intercom.CustomObjectInstance | undefined, + rawResponse: _response.rawResponse, + }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 401: + throw new Intercom.UnauthorizedError( + _response.error.body as Intercom.Error_, + _response.rawResponse, + ); + case 404: + throw new Intercom.NotFoundError(_response.error.body as unknown, _response.rawResponse); + default: + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.IntercomTimeoutError( + "Timeout exceeded when calling GET /custom_object_instances/{custom_object_type_identifier}.", + ); + case "unknown": + throw new errors.IntercomError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + } + + /** + * Create or update a custom object instance + * + * @param {Intercom.CreateOrUpdateCustomObjectInstanceRequest} request + * @param {CustomObjectInstances.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Intercom.UnauthorizedError} + * @throws {@link Intercom.NotFoundError} + * + * @example + * await client.customObjectInstances.createCustomObjectInstances({ + * custom_object_type_identifier: "Order", + * external_id: "123", + * external_created_at: 1392036272, + * external_updated_at: 1392036272, + * custom_attributes: { + * "order_number": "ORDER-12345", + * "total_amount": "custom_attributes" + * } + * }) + */ + public createCustomObjectInstances( + request: Intercom.CreateOrUpdateCustomObjectInstanceRequest, + requestOptions?: CustomObjectInstances.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__createCustomObjectInstances(request, requestOptions)); + } + + private async __createCustomObjectInstances( + request: Intercom.CreateOrUpdateCustomObjectInstanceRequest, + requestOptions?: CustomObjectInstances.RequestOptions, + ): Promise> { + const { custom_object_type_identifier: customObjectTypeIdentifier, ..._body } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `custom_object_instances/${encodeURIComponent(customObjectTypeIdentifier)}`, + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "intercom-client", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", + "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: _body, + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 20000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { + data: _response.body as Intercom.CustomObjectInstance | undefined, + rawResponse: _response.rawResponse, + }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 401: + throw new Intercom.UnauthorizedError( + _response.error.body as Intercom.Error_, + _response.rawResponse, + ); + case 404: + throw new Intercom.NotFoundError(_response.error.body as unknown, _response.rawResponse); + default: + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.IntercomTimeoutError( + "Timeout exceeded when calling POST /custom_object_instances/{custom_object_type_identifier}.", + ); + case "unknown": + throw new errors.IntercomError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + } + + /** + * Delete a single Custom Object instance by external_id. + * + * @param {Intercom.DeleteCustomObjectInstancesByIdRequest} request + * @param {CustomObjectInstances.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Intercom.UnauthorizedError} + * @throws {@link Intercom.NotFoundError} + * + * @example + * await client.customObjectInstances.deleteCustomObjectInstancesById({ + * custom_object_type_identifier: "Order", + * external_id: "external_id" + * }) + */ + public deleteCustomObjectInstancesById( + request: Intercom.DeleteCustomObjectInstancesByIdRequest, + requestOptions?: CustomObjectInstances.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__deleteCustomObjectInstancesById(request, requestOptions)); + } + + private async __deleteCustomObjectInstancesById( + request: Intercom.DeleteCustomObjectInstancesByIdRequest, + requestOptions?: CustomObjectInstances.RequestOptions, + ): Promise> { + const { custom_object_type_identifier: customObjectTypeIdentifier, external_id: externalId } = request; + const _queryParams: Record = {}; + _queryParams["external_id"] = externalId; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `custom_object_instances/${encodeURIComponent(customObjectTypeIdentifier)}`, + ), + method: "DELETE", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "intercom-client", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", + "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 20000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { data: _response.body as Intercom.CustomObjectInstanceDeleted, rawResponse: _response.rawResponse }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 401: + throw new Intercom.UnauthorizedError( + _response.error.body as Intercom.Error_, + _response.rawResponse, + ); + case 404: + throw new Intercom.NotFoundError(_response.error.body as unknown, _response.rawResponse); + default: + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.IntercomTimeoutError( + "Timeout exceeded when calling DELETE /custom_object_instances/{custom_object_type_identifier}.", + ); + case "unknown": + throw new errors.IntercomError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + } + + /** + * Fetch a Custom Object Instance by id. + * + * @param {Intercom.GetCustomObjectInstancesByIdRequest} request + * @param {CustomObjectInstances.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Intercom.UnauthorizedError} + * @throws {@link Intercom.NotFoundError} + * + * @example + * await client.customObjectInstances.getCustomObjectInstancesById({ + * custom_object_type_identifier: "Order", + * custom_object_instance_id: "custom_object_instance_id" + * }) + */ + public getCustomObjectInstancesById( + request: Intercom.GetCustomObjectInstancesByIdRequest, + requestOptions?: CustomObjectInstances.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__getCustomObjectInstancesById(request, requestOptions)); + } + + private async __getCustomObjectInstancesById( + request: Intercom.GetCustomObjectInstancesByIdRequest, + requestOptions?: CustomObjectInstances.RequestOptions, + ): Promise> { + const { + custom_object_type_identifier: customObjectTypeIdentifier, + custom_object_instance_id: customObjectInstanceId, + } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `custom_object_instances/${encodeURIComponent(customObjectTypeIdentifier)}/${encodeURIComponent(customObjectInstanceId)}`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "intercom-client", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", + "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 20000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { + data: _response.body as Intercom.CustomObjectInstance | undefined, + rawResponse: _response.rawResponse, + }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 401: + throw new Intercom.UnauthorizedError( + _response.error.body as Intercom.Error_, + _response.rawResponse, + ); + case 404: + throw new Intercom.NotFoundError(_response.error.body as unknown, _response.rawResponse); + default: + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.IntercomTimeoutError( + "Timeout exceeded when calling GET /custom_object_instances/{custom_object_type_identifier}/{custom_object_instance_id}.", + ); + case "unknown": + throw new errors.IntercomError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + } + + /** + * Delete a single Custom Object instance using the Intercom defined id. + * + * @param {Intercom.DeleteCustomObjectInstancesByExternalIdRequest} request + * @param {CustomObjectInstances.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Intercom.UnauthorizedError} + * @throws {@link Intercom.NotFoundError} + * + * @example + * await client.customObjectInstances.deleteCustomObjectInstancesByExternalId({ + * custom_object_type_identifier: "Order", + * custom_object_instance_id: "custom_object_instance_id" + * }) + */ + public deleteCustomObjectInstancesByExternalId( + request: Intercom.DeleteCustomObjectInstancesByExternalIdRequest, + requestOptions?: CustomObjectInstances.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise( + this.__deleteCustomObjectInstancesByExternalId(request, requestOptions), + ); + } + + private async __deleteCustomObjectInstancesByExternalId( + request: Intercom.DeleteCustomObjectInstancesByExternalIdRequest, + requestOptions?: CustomObjectInstances.RequestOptions, + ): Promise> { + const { + custom_object_type_identifier: customObjectTypeIdentifier, + custom_object_instance_id: customObjectInstanceId, + } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `custom_object_instances/${encodeURIComponent(customObjectTypeIdentifier)}/${encodeURIComponent(customObjectInstanceId)}`, + ), + method: "DELETE", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "intercom-client", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", + "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 20000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { data: _response.body as Intercom.CustomObjectInstanceDeleted, rawResponse: _response.rawResponse }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 401: + throw new Intercom.UnauthorizedError( + _response.error.body as Intercom.Error_, + _response.rawResponse, + ); + case 404: + throw new Intercom.NotFoundError(_response.error.body as unknown, _response.rawResponse); + default: + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.IntercomTimeoutError( + "Timeout exceeded when calling DELETE /custom_object_instances/{custom_object_type_identifier}/{custom_object_instance_id}.", + ); + case "unknown": + throw new errors.IntercomError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["INTERCOM_API_KEY"]; + if (bearer == null) { + throw new errors.IntercomError({ + message: + "Please specify a bearer by either passing it in to the constructor or initializing a INTERCOM_API_KEY environment variable", + }); + } + + return `Bearer ${bearer}`; + } +} diff --git a/src/api/resources/customObjectInstances/client/index.ts b/src/api/resources/customObjectInstances/client/index.ts new file mode 100644 index 00000000..415726b7 --- /dev/null +++ b/src/api/resources/customObjectInstances/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/customObjectInstances/client/requests/CreateOrUpdateCustomObjectInstanceRequest.ts b/src/api/resources/customObjectInstances/client/requests/CreateOrUpdateCustomObjectInstanceRequest.ts new file mode 100644 index 00000000..6366c551 --- /dev/null +++ b/src/api/resources/customObjectInstances/client/requests/CreateOrUpdateCustomObjectInstanceRequest.ts @@ -0,0 +1,31 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * custom_object_type_identifier: "Order", + * external_id: "123", + * external_created_at: 1392036272, + * external_updated_at: 1392036272, + * custom_attributes: { + * "order_number": "ORDER-12345", + * "total_amount": "custom_attributes" + * } + * } + */ +export interface CreateOrUpdateCustomObjectInstanceRequest { + /** + * The unique identifier of the custom object type that defines the structure of the custom object instance. + */ + custom_object_type_identifier: string; + /** A unique identifier for the Custom Object instance in the external system it originated from. */ + external_id?: string; + /** The time when the Custom Object instance was created in the external system it originated from. */ + external_created_at?: number; + /** The time when the Custom Object instance was last updated in the external system it originated from. */ + external_updated_at?: number; + /** The custom attributes which are set for the Custom Object instance. */ + custom_attributes?: Record; +} diff --git a/src/api/resources/customObjectInstances/client/requests/DeleteCustomObjectInstancesByExternalIdRequest.ts b/src/api/resources/customObjectInstances/client/requests/DeleteCustomObjectInstancesByExternalIdRequest.ts new file mode 100644 index 00000000..7a90d161 --- /dev/null +++ b/src/api/resources/customObjectInstances/client/requests/DeleteCustomObjectInstancesByExternalIdRequest.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * custom_object_type_identifier: "Order", + * custom_object_instance_id: "custom_object_instance_id" + * } + */ +export interface DeleteCustomObjectInstancesByExternalIdRequest { + /** + * The unique identifier of the custom object type that defines the structure of the custom object instance. + */ + custom_object_type_identifier: string; + /** + * The Intercom defined id of the custom object instance + */ + custom_object_instance_id: string; +} diff --git a/src/api/resources/customObjectInstances/client/requests/DeleteCustomObjectInstancesByIdRequest.ts b/src/api/resources/customObjectInstances/client/requests/DeleteCustomObjectInstancesByIdRequest.ts new file mode 100644 index 00000000..b14cf673 --- /dev/null +++ b/src/api/resources/customObjectInstances/client/requests/DeleteCustomObjectInstancesByIdRequest.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * custom_object_type_identifier: "Order", + * external_id: "external_id" + * } + */ +export interface DeleteCustomObjectInstancesByIdRequest { + /** + * The unique identifier of the custom object type that defines the structure of the custom object instance. + */ + custom_object_type_identifier: string; + external_id: string; +} diff --git a/src/api/resources/customObjectInstances/client/requests/GetCustomObjectInstancesByExternalIdRequest.ts b/src/api/resources/customObjectInstances/client/requests/GetCustomObjectInstancesByExternalIdRequest.ts new file mode 100644 index 00000000..5ca2f7d0 --- /dev/null +++ b/src/api/resources/customObjectInstances/client/requests/GetCustomObjectInstancesByExternalIdRequest.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * custom_object_type_identifier: "Order", + * external_id: "external_id" + * } + */ +export interface GetCustomObjectInstancesByExternalIdRequest { + /** + * The unique identifier of the custom object type that defines the structure of the custom object instance. + */ + custom_object_type_identifier: string; + external_id: string; +} diff --git a/src/api/resources/customObjectInstances/client/requests/GetCustomObjectInstancesByIdRequest.ts b/src/api/resources/customObjectInstances/client/requests/GetCustomObjectInstancesByIdRequest.ts new file mode 100644 index 00000000..6466d907 --- /dev/null +++ b/src/api/resources/customObjectInstances/client/requests/GetCustomObjectInstancesByIdRequest.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * custom_object_type_identifier: "Order", + * custom_object_instance_id: "custom_object_instance_id" + * } + */ +export interface GetCustomObjectInstancesByIdRequest { + /** + * The unique identifier of the custom object type that defines the structure of the custom object instance. + */ + custom_object_type_identifier: string; + /** + * The id or external_id of the custom object instance + */ + custom_object_instance_id: string; +} diff --git a/src/api/resources/customObjectInstances/client/requests/index.ts b/src/api/resources/customObjectInstances/client/requests/index.ts new file mode 100644 index 00000000..5382e3d2 --- /dev/null +++ b/src/api/resources/customObjectInstances/client/requests/index.ts @@ -0,0 +1,5 @@ +export { type GetCustomObjectInstancesByExternalIdRequest } from "./GetCustomObjectInstancesByExternalIdRequest"; +export { type CreateOrUpdateCustomObjectInstanceRequest } from "./CreateOrUpdateCustomObjectInstanceRequest"; +export { type DeleteCustomObjectInstancesByIdRequest } from "./DeleteCustomObjectInstancesByIdRequest"; +export { type GetCustomObjectInstancesByIdRequest } from "./GetCustomObjectInstancesByIdRequest"; +export { type DeleteCustomObjectInstancesByExternalIdRequest } from "./DeleteCustomObjectInstancesByExternalIdRequest"; diff --git a/src/api/resources/customObjectInstances/index.ts b/src/api/resources/customObjectInstances/index.ts new file mode 100644 index 00000000..c9240f83 --- /dev/null +++ b/src/api/resources/customObjectInstances/index.ts @@ -0,0 +1,2 @@ +export * from "./types"; +export * from "./client"; diff --git a/src/api/resources/customObjectInstances/types/CustomObjectInstance.ts b/src/api/resources/customObjectInstances/types/CustomObjectInstance.ts new file mode 100644 index 00000000..aab4a843 --- /dev/null +++ b/src/api/resources/customObjectInstances/types/CustomObjectInstance.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * A Custom Object Instance represents an instance of a custom object type. This allows you to create and set custom attributes to store data about your customers that is not already captured by Intercom. The parent object includes recommended default attributes and you can add your own custom attributes. + */ +export interface CustomObjectInstance { + /** The Intercom defined id representing the custom object instance. */ + id?: string; + /** The id you have defined for the custom object instance. */ + external_id?: string; + /** The time when the Custom Object instance was created in the external system it originated from. */ + external_created_at?: number; + /** The time when the Custom Object instance was last updated in the external system it originated from. */ + external_updated_at?: number; + /** The time the attribute was created as a UTC Unix timestamp */ + created_at?: number; + /** The time the attribute was last updated as a UTC Unix timestamp */ + updated_at?: number; + /** The identifier of the custom object type that defines the structure of the custom object instance. */ + type?: string; + /** The custom attributes you have set on the custom object instance. */ + custom_attributes?: Record; +} diff --git a/src/api/resources/customObjectInstances/types/index.ts b/src/api/resources/customObjectInstances/types/index.ts new file mode 100644 index 00000000..d5c782f8 --- /dev/null +++ b/src/api/resources/customObjectInstances/types/index.ts @@ -0,0 +1 @@ +export * from "./CustomObjectInstance"; diff --git a/src/api/resources/dataAttributes/client/Client.ts b/src/api/resources/dataAttributes/client/Client.ts index cd6b4d7e..b165d307 100644 --- a/src/api/resources/dataAttributes/client/Client.ts +++ b/src/api/resources/dataAttributes/client/Client.ts @@ -119,8 +119,8 @@ export class DataAttributes { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -181,46 +181,19 @@ export class DataAttributes { * * @example * await client.dataAttributes.create({ - * name: "Mithril Shirt", - * model: "company", * data_type: "string" * }) * * @example * await client.dataAttributes.create({ - * name: "The One Ring", - * model: "contact", * data_type: "integer" * }) * * @example * await client.dataAttributes.create({ - * name: "!nv@l!d n@me", - * model: "company", - * data_type: "string" - * }) - * - * @example - * await client.dataAttributes.create({ - * name: "The One Ring", - * model: "company", - * data_type: "string" - * }) - * - * @example - * await client.dataAttributes.create({ - * name: "The Second Ring", - * model: "company", - * data_type: "string" - * }) - * - * @example - * await client.dataAttributes.create({ - * name: "My Data Attribute", - * model: "contact", - * data_type: "string", - * description: "Just a plain old ring", - * options: ["options"] + * options: [{ + * value: "1-10" + * }] * }) */ public create( @@ -246,8 +219,8 @@ export class DataAttributes { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -317,33 +290,35 @@ export class DataAttributes { * * @example * await client.dataAttributes.update({ - * data_attribute_id: "1", - * archived: false, - * description: "Just a plain old ring", - * options: [{ - * value: "1-10" - * }, { - * value: "11-20" - * }] + * data_attribute_id: 1, + * body: { + * options: [{ + * value: "1-10" + * }, { + * value: "11-20" + * }] + * } * }) * * @example * await client.dataAttributes.update({ - * data_attribute_id: "1", - * archived: false, - * description: "Too few options", - * options: [{ - * value: "value" - * }, { - * value: "value" - * }] + * data_attribute_id: 1, + * body: { + * options: [{ + * value: "1-10" + * }, { + * value: "11-50" + * }] + * } * }) * * @example * await client.dataAttributes.update({ - * data_attribute_id: "1", - * archived: true, - * description: "Trying to archieve" + * data_attribute_id: 1, + * body: { + * "description": "Trying to archieve", + * "archived": true + * } * }) */ public update( @@ -357,7 +332,7 @@ export class DataAttributes { request: Intercom.UpdateDataAttributeRequest, requestOptions?: DataAttributes.RequestOptions, ): Promise> { - const { data_attribute_id: dataAttributeId, ..._body } = request; + const { data_attribute_id: dataAttributeId, body: _body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.baseUrl)) ?? @@ -370,8 +345,8 @@ export class DataAttributes { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, diff --git a/src/api/resources/dataAttributes/client/requests/CreateDataAttributeRequest.ts b/src/api/resources/dataAttributes/client/requests/CreateDataAttributeRequest.ts deleted file mode 100644 index d0856471..00000000 --- a/src/api/resources/dataAttributes/client/requests/CreateDataAttributeRequest.ts +++ /dev/null @@ -1,86 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -/** - * @example - * { - * name: "Mithril Shirt", - * model: "company", - * data_type: "string" - * } - * - * @example - * { - * name: "The One Ring", - * model: "contact", - * data_type: "integer" - * } - * - * @example - * { - * name: "!nv@l!d n@me", - * model: "company", - * data_type: "string" - * } - * - * @example - * { - * name: "The One Ring", - * model: "company", - * data_type: "string" - * } - * - * @example - * { - * name: "The Second Ring", - * model: "company", - * data_type: "string" - * } - * - * @example - * { - * name: "My Data Attribute", - * model: "contact", - * data_type: "string", - * description: "Just a plain old ring", - * options: ["options"] - * } - */ -export interface CreateDataAttributeRequest { - /** The name of the data attribute. */ - name: string; - /** The model that the data attribute belongs to. */ - model: CreateDataAttributeRequest.Model; - /** The type of data stored for this attribute. */ - data_type: CreateDataAttributeRequest.DataType; - /** The readable description you see in the UI for the attribute. */ - description?: string; - /** To create list attributes. Provide a set of hashes with `value` as the key of the options you want to make. `data_type` must be `string`. */ - options?: string[]; - /** Can this attribute be updated by the Messenger */ - messenger_writable?: boolean; -} - -export namespace CreateDataAttributeRequest { - /** - * The model that the data attribute belongs to. - */ - export type Model = "contact" | "company"; - export const Model = { - Contact: "contact", - Company: "company", - } as const; - /** - * The type of data stored for this attribute. - */ - export type DataType = "string" | "integer" | "float" | "boolean" | "datetime" | "date"; - export const DataType = { - String: "string", - Integer: "integer", - Float: "float", - Boolean: "boolean", - Datetime: "datetime", - Date: "date", - } as const; -} diff --git a/src/api/resources/dataAttributes/client/requests/UpdateDataAttributeRequest.ts b/src/api/resources/dataAttributes/client/requests/UpdateDataAttributeRequest.ts index 5ea8b95d..d63f9b24 100644 --- a/src/api/resources/dataAttributes/client/requests/UpdateDataAttributeRequest.ts +++ b/src/api/resources/dataAttributes/client/requests/UpdateDataAttributeRequest.ts @@ -2,71 +2,58 @@ * This file was auto-generated by Fern from our API Definition. */ +import * as Intercom from "../../../../index"; + /** * @example * { - * data_attribute_id: "1", - * archived: false, - * description: "Just a plain old ring", - * options: [{ - * value: "1-10" - * }, { - * value: "11-20" - * }] + * data_attribute_id: 1, + * body: { + * options: [{ + * value: "1-10" + * }, { + * value: "11-20" + * }] + * } * } * * @example * { - * data_attribute_id: "1", - * archived: false, - * description: "Too few options", - * options: [{ - * value: "value" - * }, { - * value: "value" - * }] + * data_attribute_id: 1, + * body: { + * options: [{ + * value: "1-10" + * }, { + * value: "11-50" + * }] + * } * } * * @example * { - * data_attribute_id: "1", - * archived: false, - * description: "Just a plain old ring", - * options: [{ - * value: "1-10" - * }, { - * value: "11-20" - * }] + * data_attribute_id: 1, + * body: { + * options: [{ + * value: "1-10" + * }, { + * value: "11-20" + * }] + * } * } * * @example * { - * data_attribute_id: "1", - * archived: true, - * description: "Trying to archieve" + * data_attribute_id: 1, + * body: { + * "description": "Trying to archieve", + * "archived": true + * } * } */ export interface UpdateDataAttributeRequest { /** * The data attribute id */ - data_attribute_id: string; - /** Whether the attribute is to be archived or not. */ - archived?: boolean; - /** The readable description you see in the UI for the attribute. */ - description?: string; - /** To create list attributes. Provide a set of hashes with `value` as the key of the options you want to make. `data_type` must be `string`. */ - options?: UpdateDataAttributeRequest.Options.Item[]; - /** Can this attribute be updated by the Messenger */ - messenger_writable?: boolean; -} - -export namespace UpdateDataAttributeRequest { - export type Options = Options.Item[]; - - export namespace Options { - export interface Item { - value: string; - } - } + data_attribute_id: number; + body: Intercom.UpdateDataAttributeRequestBody; } diff --git a/src/api/resources/dataAttributes/client/requests/index.ts b/src/api/resources/dataAttributes/client/requests/index.ts index 6a7a0de5..1c202159 100644 --- a/src/api/resources/dataAttributes/client/requests/index.ts +++ b/src/api/resources/dataAttributes/client/requests/index.ts @@ -1,3 +1,2 @@ export { type ListDataAttributesRequest } from "./ListDataAttributesRequest"; -export { type CreateDataAttributeRequest } from "./CreateDataAttributeRequest"; export { type UpdateDataAttributeRequest } from "./UpdateDataAttributeRequest"; diff --git a/src/api/resources/dataAttributes/types/DataAttribute.ts b/src/api/resources/dataAttributes/types/DataAttribute.ts index 1ce04881..360854ba 100644 --- a/src/api/resources/dataAttributes/types/DataAttribute.ts +++ b/src/api/resources/dataAttributes/types/DataAttribute.ts @@ -19,7 +19,7 @@ export interface DataAttribute { /** Readable name of the attribute (i.e. name you see in the UI) */ label: string; /** Readable description of the attribute. */ - description: string; + description?: string; /** The data type of the attribute. */ data_type: DataAttribute.DataType; /** List of predefined options for attribute value. */ diff --git a/src/api/resources/dataExport/client/Client.ts b/src/api/resources/dataExport/client/Client.ts index 72d82c09..5121989c 100644 --- a/src/api/resources/dataExport/client/Client.ts +++ b/src/api/resources/dataExport/client/Client.ts @@ -75,6 +75,187 @@ export declare namespace DataExport { export class DataExport { constructor(protected readonly _options: DataExport.Options = {}) {} + /** + * @param {Intercom.ExportReportingDataRequest} request + * @param {DataExport.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Intercom.NotFoundError} + * + * @example + * await client.dataExport.exportReportingData({ + * job_identifier: "job_identifier", + * app_id: "app_id", + * client_id: "client_id" + * }) + */ + public exportReportingData( + request: Intercom.ExportReportingDataRequest, + requestOptions?: DataExport.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__exportReportingData(request, requestOptions)); + } + + private async __exportReportingData( + request: Intercom.ExportReportingDataRequest, + requestOptions?: DataExport.RequestOptions, + ): Promise> { + const { job_identifier: jobIdentifier, app_id: appId, client_id: clientId } = request; + const _queryParams: Record = {}; + _queryParams["app_id"] = appId; + _queryParams["client_id"] = clientId; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `export/reporting_data/${encodeURIComponent(jobIdentifier)}`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "intercom-client", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", + "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 20000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { + data: _response.body as Intercom.DataExportExportReportingDataResponse, + rawResponse: _response.rawResponse, + }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 404: + throw new Intercom.NotFoundError(_response.error.body as unknown, _response.rawResponse); + default: + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.IntercomTimeoutError( + "Timeout exceeded when calling GET /export/reporting_data/{job_identifier}.", + ); + case "unknown": + throw new errors.IntercomError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + } + + /** + * @param {Intercom.DownloadReportingDataExportRequest} request + * @param {DataExport.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Intercom.NotFoundError} + * + * @example + * await client.dataExport.downloadReportingDataExport({ + * job_identifier: "job_identifier", + * app_id: "app_id" + * }) + */ + public downloadReportingDataExport( + request: Intercom.DownloadReportingDataExportRequest, + requestOptions?: DataExport.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__downloadReportingDataExport(request, requestOptions)); + } + + private async __downloadReportingDataExport( + request: Intercom.DownloadReportingDataExportRequest, + requestOptions?: DataExport.RequestOptions, + ): Promise> { + const { job_identifier: jobIdentifier, app_id: appId } = request; + const _queryParams: Record = {}; + _queryParams["app_id"] = appId; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `download/reporting_data/${encodeURIComponent(jobIdentifier)}`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "intercom-client", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", + "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 20000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { data: undefined, rawResponse: _response.rawResponse }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 404: + throw new Intercom.NotFoundError(_response.error.body as unknown, _response.rawResponse); + default: + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.IntercomTimeoutError( + "Timeout exceeded when calling GET /download/reporting_data/{job_identifier}.", + ); + case "unknown": + throw new errors.IntercomError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + } + /** * To create your export job, you need to send a `POST` request to the export endpoint `https://api.intercom.io/export/content/data`. * @@ -97,8 +278,8 @@ export class DataExport { * * @example * await client.dataExport.create({ - * created_at_after: 1719474967, - * created_at_before: 1719492967 + * created_at_after: 1734519776, + * created_at_before: 1734537776 * }) */ public create( @@ -124,8 +305,8 @@ export class DataExport { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -206,8 +387,8 @@ export class DataExport { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -285,8 +466,8 @@ export class DataExport { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -370,8 +551,8 @@ export class DataExport { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, diff --git a/src/api/resources/dataExport/client/requests/CreateDataExportRequest.ts b/src/api/resources/dataExport/client/requests/CreateDataExportRequest.ts index d8b4e380..8a36151f 100644 --- a/src/api/resources/dataExport/client/requests/CreateDataExportRequest.ts +++ b/src/api/resources/dataExport/client/requests/CreateDataExportRequest.ts @@ -5,8 +5,8 @@ /** * @example * { - * created_at_after: 1719474967, - * created_at_before: 1719492967 + * created_at_after: 1734519776, + * created_at_before: 1734537776 * } */ export interface CreateDataExportRequest { diff --git a/src/api/resources/dataExport/client/requests/DownloadReportingDataExportRequest.ts b/src/api/resources/dataExport/client/requests/DownloadReportingDataExportRequest.ts new file mode 100644 index 00000000..6cdbd2d7 --- /dev/null +++ b/src/api/resources/dataExport/client/requests/DownloadReportingDataExportRequest.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * job_identifier: "job_identifier", + * app_id: "app_id" + * } + */ +export interface DownloadReportingDataExportRequest { + job_identifier: string; + app_id: string; +} diff --git a/src/api/resources/dataExport/client/requests/ExportReportingDataRequest.ts b/src/api/resources/dataExport/client/requests/ExportReportingDataRequest.ts new file mode 100644 index 00000000..1895cfc9 --- /dev/null +++ b/src/api/resources/dataExport/client/requests/ExportReportingDataRequest.ts @@ -0,0 +1,30 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * job_identifier: "job_identifier", + * app_id: "app_id", + * client_id: "client_id" + * } + * + * @example + * { + * job_identifier: "job_identifier", + * app_id: "app_id", + * client_id: "client_id" + * } + */ +export interface ExportReportingDataRequest { + /** + * Unique identifier of the job. + */ + job_identifier: string; + /** + * The Intercom defined code of the workspace the company is associated to. + */ + app_id: string; + client_id: string; +} diff --git a/src/api/resources/dataExport/client/requests/index.ts b/src/api/resources/dataExport/client/requests/index.ts index fa7821f6..798f21d3 100644 --- a/src/api/resources/dataExport/client/requests/index.ts +++ b/src/api/resources/dataExport/client/requests/index.ts @@ -1,3 +1,5 @@ +export { type ExportReportingDataRequest } from "./ExportReportingDataRequest"; +export { type DownloadReportingDataExportRequest } from "./DownloadReportingDataExportRequest"; export { type CreateDataExportRequest } from "./CreateDataExportRequest"; export { type FindDataExportRequest } from "./FindDataExportRequest"; export { type CancelDataExportRequest } from "./CancelDataExportRequest"; diff --git a/src/api/resources/dataExport/types/DataExport.ts b/src/api/resources/dataExport/types/DataExport.ts index fbb48fc4..bd19f8c9 100644 --- a/src/api/resources/dataExport/types/DataExport.ts +++ b/src/api/resources/dataExport/types/DataExport.ts @@ -7,13 +7,13 @@ */ export interface DataExport { /** The identifier for your job. */ - job_identifier: string; + job_identfier?: string; /** The current state of your job. */ - status: DataExport.Status; + status?: DataExport.Status; /** The time after which you will not be able to access the data. */ - download_expires_at: string; + download_expires_at?: string; /** The location where you can download your data. */ - download_url: string; + download_url?: string; } export namespace DataExport { diff --git a/src/api/resources/dataExport/types/DataExportExportReportingDataResponse.ts b/src/api/resources/dataExport/types/DataExportExportReportingDataResponse.ts new file mode 100644 index 00000000..3ef25e42 --- /dev/null +++ b/src/api/resources/dataExport/types/DataExportExportReportingDataResponse.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface DataExportExportReportingDataResponse { + job_identifier?: string; + status?: string; + download_url?: string; + download_expires_at?: string; +} diff --git a/src/api/resources/dataExport/types/index.ts b/src/api/resources/dataExport/types/index.ts index 7cea751a..e8e549f9 100644 --- a/src/api/resources/dataExport/types/index.ts +++ b/src/api/resources/dataExport/types/index.ts @@ -1 +1,2 @@ +export * from "./DataExportExportReportingDataResponse"; export * from "./DataExport"; diff --git a/src/api/resources/events/client/Client.ts b/src/api/resources/events/client/Client.ts index a51cd863..2932122b 100644 --- a/src/api/resources/events/client/Client.ts +++ b/src/api/resources/events/client/Client.ts @@ -151,8 +151,8 @@ export class Events { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -280,8 +280,8 @@ export class Events { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -365,8 +365,8 @@ export class Events { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, diff --git a/src/api/resources/export/client/Client.ts b/src/api/resources/export/client/Client.ts new file mode 100644 index 00000000..22b8b095 --- /dev/null +++ b/src/api/resources/export/client/Client.ts @@ -0,0 +1,262 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Intercom from "../../../index"; +import urlJoin from "url-join"; +import * as errors from "../../../../errors/index"; + +export declare namespace Export { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Intercom-Version header */ + version?: + | "1.0" + | "1.1" + | "1.2" + | "1.3" + | "1.4" + | "2.0" + | "2.1" + | "2.2" + | "2.3" + | "2.4" + | "2.5" + | "2.6" + | "2.7" + | "2.8" + | "2.9" + | "2.10" + | "2.11" + | "Unstable"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Additional headers to include in the request. */ + headers?: Record; + /** Override the Intercom-Version header */ + version?: + | "1.0" + | "1.1" + | "1.2" + | "1.3" + | "1.4" + | "2.0" + | "2.1" + | "2.2" + | "2.3" + | "2.4" + | "2.5" + | "2.6" + | "2.7" + | "2.8" + | "2.9" + | "2.10" + | "2.11" + | "Unstable"; + } +} + +export class Export { + constructor(protected readonly _options: Export.Options = {}) {} + + /** + * @param {Intercom.PostExportReportingDataEnqueueRequest} request + * @param {Export.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Intercom.BadRequestError} + * @throws {@link Intercom.UnauthorizedError} + * @throws {@link Intercom.TooManyRequestsError} + * + * @example + * await client.export.enqueueANewReportingDataExportJob({ + * dataset_id: "conversation", + * attribute_ids: ["conversation_id", "conversation_started_at"], + * start_time: 1717490000, + * end_time: 1717510000 + * }) + */ + public enqueueANewReportingDataExportJob( + request: Intercom.PostExportReportingDataEnqueueRequest, + requestOptions?: Export.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__enqueueANewReportingDataExportJob(request, requestOptions)); + } + + private async __enqueueANewReportingDataExportJob( + request: Intercom.PostExportReportingDataEnqueueRequest, + requestOptions?: Export.RequestOptions, + ): Promise> { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + "export/reporting_data/enqueue", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "intercom-client", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", + "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: request, + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 20000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { + data: _response.body as Intercom.PostExportReportingDataEnqueueResponse, + rawResponse: _response.rawResponse, + }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Intercom.BadRequestError(_response.error.body as unknown, _response.rawResponse); + case 401: + throw new Intercom.UnauthorizedError( + _response.error.body as Intercom.Error_, + _response.rawResponse, + ); + case 429: + throw new Intercom.TooManyRequestsError( + _response.error.body as Intercom.Error_, + _response.rawResponse, + ); + default: + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.IntercomTimeoutError( + "Timeout exceeded when calling POST /export/reporting_data/enqueue.", + ); + case "unknown": + throw new errors.IntercomError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + } + + /** + * @param {Export.RequestOptions} requestOptions - Request-specific configuration. + * + * @example + * await client.export.listAvailableDatasetsAndAttributes() + */ + public listAvailableDatasetsAndAttributes( + requestOptions?: Export.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__listAvailableDatasetsAndAttributes(requestOptions)); + } + + private async __listAvailableDatasetsAndAttributes( + requestOptions?: Export.RequestOptions, + ): Promise> { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + "export/reporting_data/get_datasets", + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "intercom-client", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", + "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 20000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { + data: _response.body as Intercom.GetExportReportingDataGetDatasetsResponse, + rawResponse: _response.rawResponse, + }; + } + + if (_response.error.reason === "status-code") { + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.IntercomTimeoutError( + "Timeout exceeded when calling GET /export/reporting_data/get_datasets.", + ); + case "unknown": + throw new errors.IntercomError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["INTERCOM_API_KEY"]; + if (bearer == null) { + throw new errors.IntercomError({ + message: + "Please specify a bearer by either passing it in to the constructor or initializing a INTERCOM_API_KEY environment variable", + }); + } + + return `Bearer ${bearer}`; + } +} diff --git a/src/api/resources/export/client/index.ts b/src/api/resources/export/client/index.ts new file mode 100644 index 00000000..415726b7 --- /dev/null +++ b/src/api/resources/export/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/export/client/requests/PostExportReportingDataEnqueueRequest.ts b/src/api/resources/export/client/requests/PostExportReportingDataEnqueueRequest.ts new file mode 100644 index 00000000..3a4d33e1 --- /dev/null +++ b/src/api/resources/export/client/requests/PostExportReportingDataEnqueueRequest.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * dataset_id: "conversation", + * attribute_ids: ["conversation_id", "conversation_started_at"], + * start_time: 1717490000, + * end_time: 1717510000 + * } + */ +export interface PostExportReportingDataEnqueueRequest { + dataset_id: string; + attribute_ids: string[]; + start_time: number; + end_time: number; +} diff --git a/src/api/resources/export/client/requests/index.ts b/src/api/resources/export/client/requests/index.ts new file mode 100644 index 00000000..bcda81be --- /dev/null +++ b/src/api/resources/export/client/requests/index.ts @@ -0,0 +1 @@ +export { type PostExportReportingDataEnqueueRequest } from "./PostExportReportingDataEnqueueRequest"; diff --git a/src/api/resources/export/index.ts b/src/api/resources/export/index.ts new file mode 100644 index 00000000..c9240f83 --- /dev/null +++ b/src/api/resources/export/index.ts @@ -0,0 +1,2 @@ +export * from "./types"; +export * from "./client"; diff --git a/src/api/resources/export/types/GetExportReportingDataGetDatasetsResponse.ts b/src/api/resources/export/types/GetExportReportingDataGetDatasetsResponse.ts new file mode 100644 index 00000000..ab8c3ba6 --- /dev/null +++ b/src/api/resources/export/types/GetExportReportingDataGetDatasetsResponse.ts @@ -0,0 +1,33 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface GetExportReportingDataGetDatasetsResponse { + type?: string; + data?: GetExportReportingDataGetDatasetsResponse.Data.Item[]; +} + +export namespace GetExportReportingDataGetDatasetsResponse { + export type Data = Data.Item[]; + + export namespace Data { + export interface Item { + id?: string; + name?: string; + description?: string; + default_time_attribute_id?: string; + attributes?: Item.Attributes.Item[]; + } + + export namespace Item { + export type Attributes = Attributes.Item[]; + + export namespace Attributes { + export interface Item { + id?: string; + name?: string; + } + } + } + } +} diff --git a/src/api/resources/export/types/PostExportReportingDataEnqueueResponse.ts b/src/api/resources/export/types/PostExportReportingDataEnqueueResponse.ts new file mode 100644 index 00000000..55a28e65 --- /dev/null +++ b/src/api/resources/export/types/PostExportReportingDataEnqueueResponse.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface PostExportReportingDataEnqueueResponse { + job_identifier?: string; + status?: string; + download_url?: string; + download_expires_at?: string; +} diff --git a/src/api/resources/export/types/index.ts b/src/api/resources/export/types/index.ts new file mode 100644 index 00000000..cc8706ee --- /dev/null +++ b/src/api/resources/export/types/index.ts @@ -0,0 +1,2 @@ +export * from "./PostExportReportingDataEnqueueResponse"; +export * from "./GetExportReportingDataGetDatasetsResponse"; diff --git a/src/api/resources/helpCenter/types/Collection.ts b/src/api/resources/helpCenter/types/Collection.ts index 5394f881..0a9e2fcd 100644 --- a/src/api/resources/helpCenter/types/Collection.ts +++ b/src/api/resources/helpCenter/types/Collection.ts @@ -27,7 +27,7 @@ export interface Collection { /** The order of the section in relation to others sections within a collection. Values go from `0` upwards. `0` is the default if there's no order. */ order: number; /** The default locale of the help center. This field is only returned for multilingual help centers. */ - default_locale: string; + default_locale?: string; translated_content?: Intercom.GroupTranslatedContent; /** The id of the parent collection. If `null` then it is the first level collection. */ parent_id?: string; diff --git a/src/api/resources/helpCenter/types/HelpCenter.ts b/src/api/resources/helpCenter/types/HelpCenter.ts index acf3993d..9a8a55c5 100644 --- a/src/api/resources/helpCenter/types/HelpCenter.ts +++ b/src/api/resources/helpCenter/types/HelpCenter.ts @@ -7,17 +7,21 @@ */ export interface HelpCenter { /** The unique identifier for the Help Center which is given by Intercom. */ - id: string; + id?: string; /** The id of the workspace which the Help Center belongs to. */ - workspace_id: string; + workspace_id?: string; /** The time when the Help Center was created. */ - created_at: number; + created_at?: number; /** The time when the Help Center was last updated. */ updated_at?: number; /** The identifier of the Help Center. This is used in the URL of the Help Center. */ - identifier: string; + identifier?: string; /** Whether the Help Center is turned on or not. This is controlled in your Help Center settings. */ - website_turned_on: boolean; + website_turned_on?: boolean; /** The display name of the Help Center only seen by teammates. */ - display_name: string; + display_name?: string; + /** The URL for the help center, if you have a custom domain then this will show the URL using the custom domain. */ + url?: string; + /** Custom domain configured for the help center */ + custom_domain?: string; } diff --git a/src/api/resources/helpCenter/types/HelpCenterList.ts b/src/api/resources/helpCenter/types/HelpCenterList.ts index f2d362f7..60fda132 100644 --- a/src/api/resources/helpCenter/types/HelpCenterList.ts +++ b/src/api/resources/helpCenter/types/HelpCenterList.ts @@ -9,7 +9,7 @@ import * as Intercom from "../../../index"; */ export interface HelpCenterList { /** The type of the object - `list`. */ - type: "list"; + type?: "list"; /** An array of Help Center objects */ - data: Intercom.HelpCenter[]; + data?: Intercom.HelpCenter[]; } diff --git a/src/api/resources/helpCenters/client/Client.ts b/src/api/resources/helpCenters/client/Client.ts index f8a1cf28..81a1393b 100644 --- a/src/api/resources/helpCenters/client/Client.ts +++ b/src/api/resources/helpCenters/client/Client.ts @@ -90,7 +90,7 @@ export class HelpCenters { * * @example * await client.helpCenters.find({ - * help_center_id: "123" + * help_center_id: 1 * }) */ public find( @@ -117,8 +117,8 @@ export class HelpCenters { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -210,8 +210,8 @@ export class HelpCenters { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, diff --git a/src/api/resources/helpCenters/client/requests/FindHelpCenterRequest.ts b/src/api/resources/helpCenters/client/requests/FindHelpCenterRequest.ts index 2be74aba..19c60713 100644 --- a/src/api/resources/helpCenters/client/requests/FindHelpCenterRequest.ts +++ b/src/api/resources/helpCenters/client/requests/FindHelpCenterRequest.ts @@ -5,12 +5,12 @@ /** * @example * { - * help_center_id: "123" + * help_center_id: 1 * } */ export interface FindHelpCenterRequest { /** - * The unique identifier for the Help Center which is given by Intercom. + * The unique identifier for the collection which is given by Intercom. */ - help_center_id: string; + help_center_id: number; } diff --git a/src/api/resources/helpCenters/resources/collections/client/Client.ts b/src/api/resources/helpCenters/resources/collections/client/Client.ts index b123a0c1..69870e08 100644 --- a/src/api/resources/helpCenters/resources/collections/client/Client.ts +++ b/src/api/resources/helpCenters/resources/collections/client/Client.ts @@ -113,8 +113,8 @@ export class Collections { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -222,8 +222,8 @@ export class Collections { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -286,7 +286,7 @@ export class Collections { * * @example * await client.helpCenters.collections.find({ - * collection_id: "123" + * collection_id: 1 * }) */ public find( @@ -313,8 +313,8 @@ export class Collections { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -378,7 +378,7 @@ export class Collections { * * @example * await client.helpCenters.collections.update({ - * collection_id: "123", + * collection_id: 1, * name: "Update collection name" * }) */ @@ -406,8 +406,8 @@ export class Collections { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -472,7 +472,7 @@ export class Collections { * * @example * await client.helpCenters.collections.delete({ - * collection_id: "123" + * collection_id: 1 * }) */ public delete( @@ -499,8 +499,8 @@ export class Collections { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, diff --git a/src/api/resources/helpCenters/resources/collections/client/requests/DeleteCollectionRequest.ts b/src/api/resources/helpCenters/resources/collections/client/requests/DeleteCollectionRequest.ts index 8dbdb625..b5961b1a 100644 --- a/src/api/resources/helpCenters/resources/collections/client/requests/DeleteCollectionRequest.ts +++ b/src/api/resources/helpCenters/resources/collections/client/requests/DeleteCollectionRequest.ts @@ -5,12 +5,12 @@ /** * @example * { - * collection_id: "123" + * collection_id: 1 * } */ export interface DeleteCollectionRequest { /** * The unique identifier for the collection which is given by Intercom. */ - collection_id: string; + collection_id: number; } diff --git a/src/api/resources/helpCenters/resources/collections/client/requests/FindCollectionRequest.ts b/src/api/resources/helpCenters/resources/collections/client/requests/FindCollectionRequest.ts index 6c44a759..0d00b346 100644 --- a/src/api/resources/helpCenters/resources/collections/client/requests/FindCollectionRequest.ts +++ b/src/api/resources/helpCenters/resources/collections/client/requests/FindCollectionRequest.ts @@ -5,12 +5,12 @@ /** * @example * { - * collection_id: "123" + * collection_id: 1 * } */ export interface FindCollectionRequest { /** * The unique identifier for the collection which is given by Intercom. */ - collection_id: string; + collection_id: number; } diff --git a/src/api/resources/helpCenters/resources/collections/client/requests/UpdateCollectionRequest.ts b/src/api/resources/helpCenters/resources/collections/client/requests/UpdateCollectionRequest.ts index 69bf333a..7918291c 100644 --- a/src/api/resources/helpCenters/resources/collections/client/requests/UpdateCollectionRequest.ts +++ b/src/api/resources/helpCenters/resources/collections/client/requests/UpdateCollectionRequest.ts @@ -7,13 +7,13 @@ import * as Intercom from "../../../../../../index"; /** * @example * { - * collection_id: "123", + * collection_id: 1, * name: "Update collection name" * } * * @example * { - * collection_id: "123", + * collection_id: 1, * name: "Update collection name" * } */ @@ -21,7 +21,7 @@ export interface UpdateCollectionRequest { /** * The unique identifier for the collection which is given by Intercom. */ - collection_id: string; + collection_id: number; /** The name of the collection. For multilingual collections, this will be the name of the default language's content. */ name?: string; /** The description of the collection. For multilingual collections, this will be the description of the default language's content. */ diff --git a/src/api/resources/index.ts b/src/api/resources/index.ts index 7761ecb9..962b6200 100644 --- a/src/api/resources/index.ts +++ b/src/api/resources/index.ts @@ -1,7 +1,15 @@ export * as admins from "./admins"; export * from "./admins/types"; +export * as aiContent from "./aiContent"; +export * from "./aiContent/types"; export * as articles from "./articles"; export * from "./articles/types"; +export * as export_ from "./export"; +export * from "./export/types"; +export * as dataExport from "./dataExport"; +export * from "./dataExport/types"; +export * as internalArticles from "./internalArticles"; +export * from "./internalArticles/types"; export * as companies from "./companies"; export * from "./companies/types"; export * as contacts from "./contacts"; @@ -12,16 +20,20 @@ export * as tags from "./tags"; export * from "./tags/types"; export * as conversations from "./conversations"; export * from "./conversations/types"; +export * as customObjectInstances from "./customObjectInstances"; +export * from "./customObjectInstances/types"; export * as dataAttributes from "./dataAttributes"; export * from "./dataAttributes/types"; -export * as dataExport from "./dataExport"; -export * from "./dataExport/types"; +export * as jobs from "./jobs"; +export * from "./jobs/types"; export * as messages from "./messages"; export * from "./messages/types"; export * as segments from "./segments"; export * from "./segments/types"; export * as subscriptionTypes from "./subscriptionTypes"; export * from "./subscriptionTypes/types"; +export * as calls from "./calls"; +export * from "./calls/types"; export * as teams from "./teams"; export * from "./teams/types"; export * as tickets from "./tickets"; @@ -37,24 +49,33 @@ export * from "./dataEvents/types"; export * as news from "./news"; export * from "./news/types"; export * as unstable from "./unstable"; +export * as awayStatusReasons from "./awayStatusReasons"; export * as helpCenters from "./helpCenters"; +export * as customChannelEvents from "./customChannelEvents"; export * as events from "./events"; export * as phoneCallRedirects from "./phoneCallRedirects"; +export * as ticketStates from "./ticketStates"; export * as ticketTypes from "./ticketTypes"; export * as visitors from "./visitors"; export * from "./admins/client/requests"; +export * from "./aiContent/client/requests"; export * from "./articles/client/requests"; +export * from "./export/client/requests"; +export * from "./dataExport/client/requests"; export * from "./helpCenters/client/requests"; +export * from "./internalArticles/client/requests"; export * from "./companies/client/requests"; export * from "./contacts/client/requests"; export * from "./notes/client/requests"; export * from "./tags/client/requests"; export * from "./conversations/client/requests"; +export * from "./customChannelEvents/client/requests"; +export * from "./customObjectInstances/client/requests"; export * from "./dataAttributes/client/requests"; export * from "./events/client/requests"; -export * from "./dataExport/client/requests"; +export * from "./jobs/client/requests"; export * from "./segments/client/requests"; -export * from "./phoneCallRedirects/client/requests"; +export * from "./calls/client/requests"; export * from "./teams/client/requests"; export * from "./ticketTypes/client/requests"; export * from "./tickets/client/requests"; diff --git a/src/api/resources/internalArticles/client/Client.ts b/src/api/resources/internalArticles/client/Client.ts new file mode 100644 index 00000000..58f9fef5 --- /dev/null +++ b/src/api/resources/internalArticles/client/Client.ts @@ -0,0 +1,647 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Intercom from "../../../index"; +import urlJoin from "url-join"; +import * as errors from "../../../../errors/index"; + +export declare namespace InternalArticles { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Intercom-Version header */ + version?: + | "1.0" + | "1.1" + | "1.2" + | "1.3" + | "1.4" + | "2.0" + | "2.1" + | "2.2" + | "2.3" + | "2.4" + | "2.5" + | "2.6" + | "2.7" + | "2.8" + | "2.9" + | "2.10" + | "2.11" + | "Unstable"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Additional headers to include in the request. */ + headers?: Record; + /** Override the Intercom-Version header */ + version?: + | "1.0" + | "1.1" + | "1.2" + | "1.3" + | "1.4" + | "2.0" + | "2.1" + | "2.2" + | "2.3" + | "2.4" + | "2.5" + | "2.6" + | "2.7" + | "2.8" + | "2.9" + | "2.10" + | "2.11" + | "Unstable"; + } +} + +/** + * Everything about your Internal Articles + */ +export class InternalArticles { + constructor(protected readonly _options: InternalArticles.Options = {}) {} + + /** + * You can fetch a list of all internal articles by making a GET request to `https://api.intercom.io/internal_articles`. + * + * @param {InternalArticles.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Intercom.UnauthorizedError} + * + * @example + * await client.internalArticles.listInternalArticles() + */ + public listInternalArticles( + requestOptions?: InternalArticles.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__listInternalArticles(requestOptions)); + } + + private async __listInternalArticles( + requestOptions?: InternalArticles.RequestOptions, + ): Promise> { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + "internal_articles", + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "intercom-client", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", + "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 20000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { data: _response.body as Intercom.InternalArticleList, rawResponse: _response.rawResponse }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 401: + throw new Intercom.UnauthorizedError( + _response.error.body as Intercom.Error_, + _response.rawResponse, + ); + default: + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.IntercomTimeoutError("Timeout exceeded when calling GET /internal_articles."); + case "unknown": + throw new errors.IntercomError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + } + + /** + * You can create a new internal article by making a POST request to `https://api.intercom.io/internal_articles`. + * + * @param {Intercom.CreateInternalArticleRequest} request + * @param {InternalArticles.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Intercom.BadRequestError} + * @throws {@link Intercom.UnauthorizedError} + * + * @example + * await client.internalArticles.createInternalArticle({ + * title: "Thanks for everything", + * body: "Body of the Article", + * author_id: 991266252, + * owner_id: 991266252 + * }) + * + * @example + * await client.internalArticles.createInternalArticle({ + * title: "Thanks for everything", + * body: "Body of the Internal Article", + * author_id: 1295, + * owner_id: 1295 + * }) + */ + public createInternalArticle( + request?: Intercom.CreateInternalArticleRequest, + requestOptions?: InternalArticles.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__createInternalArticle(request, requestOptions)); + } + + private async __createInternalArticle( + request?: Intercom.CreateInternalArticleRequest, + requestOptions?: InternalArticles.RequestOptions, + ): Promise> { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + "internal_articles", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "intercom-client", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", + "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: request != null ? request : undefined, + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 20000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { data: _response.body as Intercom.InternalArticle, rawResponse: _response.rawResponse }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Intercom.BadRequestError(_response.error.body as unknown, _response.rawResponse); + case 401: + throw new Intercom.UnauthorizedError( + _response.error.body as Intercom.Error_, + _response.rawResponse, + ); + default: + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.IntercomTimeoutError("Timeout exceeded when calling POST /internal_articles."); + case "unknown": + throw new errors.IntercomError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + } + + /** + * You can fetch the details of a single internal article by making a GET request to `https://api.intercom.io/internal_articles/`. + * + * @param {Intercom.RetrieveInternalArticleRequest} request + * @param {InternalArticles.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Intercom.UnauthorizedError} + * @throws {@link Intercom.NotFoundError} + * + * @example + * await client.internalArticles.retrieveInternalArticle({ + * internal_article_id: 1 + * }) + */ + public retrieveInternalArticle( + request: Intercom.RetrieveInternalArticleRequest, + requestOptions?: InternalArticles.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__retrieveInternalArticle(request, requestOptions)); + } + + private async __retrieveInternalArticle( + request: Intercom.RetrieveInternalArticleRequest, + requestOptions?: InternalArticles.RequestOptions, + ): Promise> { + const { internal_article_id: internalArticleId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `internal_articles/${encodeURIComponent(internalArticleId)}`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "intercom-client", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", + "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 20000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { data: _response.body as Intercom.InternalArticle, rawResponse: _response.rawResponse }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 401: + throw new Intercom.UnauthorizedError( + _response.error.body as Intercom.Error_, + _response.rawResponse, + ); + case 404: + throw new Intercom.NotFoundError(_response.error.body as unknown, _response.rawResponse); + default: + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.IntercomTimeoutError( + "Timeout exceeded when calling GET /internal_articles/{internal_article_id}.", + ); + case "unknown": + throw new errors.IntercomError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + } + + /** + * You can update the details of a single internal article by making a PUT request to `https://api.intercom.io/internal_articles/`. + * + * @param {Intercom.UpdateInternalArticleRequestBody} request + * @param {InternalArticles.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Intercom.UnauthorizedError} + * @throws {@link Intercom.NotFoundError} + * + * @example + * await client.internalArticles.updateInternalArticle({ + * internal_article_id: 1, + * title: "Christmas is here!", + * body: "

New gifts in store for the jolly season

" + * }) + */ + public updateInternalArticle( + request: Intercom.UpdateInternalArticleRequestBody, + requestOptions?: InternalArticles.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__updateInternalArticle(request, requestOptions)); + } + + private async __updateInternalArticle( + request: Intercom.UpdateInternalArticleRequestBody, + requestOptions?: InternalArticles.RequestOptions, + ): Promise> { + const { internal_article_id: internalArticleId, ..._body } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `internal_articles/${encodeURIComponent(internalArticleId)}`, + ), + method: "PUT", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "intercom-client", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", + "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: _body, + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 20000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { data: _response.body as Intercom.InternalArticle, rawResponse: _response.rawResponse }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 401: + throw new Intercom.UnauthorizedError( + _response.error.body as Intercom.Error_, + _response.rawResponse, + ); + case 404: + throw new Intercom.NotFoundError(_response.error.body as unknown, _response.rawResponse); + default: + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.IntercomTimeoutError( + "Timeout exceeded when calling PUT /internal_articles/{internal_article_id}.", + ); + case "unknown": + throw new errors.IntercomError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + } + + /** + * You can delete a single internal article by making a DELETE request to `https://api.intercom.io/internal_articles/`. + * + * @param {Intercom.DeleteInternalArticleRequest} request + * @param {InternalArticles.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Intercom.UnauthorizedError} + * @throws {@link Intercom.NotFoundError} + * + * @example + * await client.internalArticles.deleteInternalArticle({ + * internal_article_id: 1 + * }) + */ + public deleteInternalArticle( + request: Intercom.DeleteInternalArticleRequest, + requestOptions?: InternalArticles.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__deleteInternalArticle(request, requestOptions)); + } + + private async __deleteInternalArticle( + request: Intercom.DeleteInternalArticleRequest, + requestOptions?: InternalArticles.RequestOptions, + ): Promise> { + const { internal_article_id: internalArticleId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `internal_articles/${encodeURIComponent(internalArticleId)}`, + ), + method: "DELETE", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "intercom-client", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", + "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 20000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { + data: _response.body as Intercom.DeletedInternalArticleObject, + rawResponse: _response.rawResponse, + }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 401: + throw new Intercom.UnauthorizedError( + _response.error.body as Intercom.Error_, + _response.rawResponse, + ); + case 404: + throw new Intercom.NotFoundError(_response.error.body as unknown, _response.rawResponse); + default: + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.IntercomTimeoutError( + "Timeout exceeded when calling DELETE /internal_articles/{internal_article_id}.", + ); + case "unknown": + throw new errors.IntercomError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + } + + /** + * You can search for internal articles by making a GET request to `https://api.intercom.io/internal_articles/search`. + * + * @param {Intercom.SearchInternalArticlesRequest} request + * @param {InternalArticles.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Intercom.UnauthorizedError} + * + * @example + * await client.internalArticles.searchInternalArticles() + */ + public searchInternalArticles( + request: Intercom.SearchInternalArticlesRequest = {}, + requestOptions?: InternalArticles.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__searchInternalArticles(request, requestOptions)); + } + + private async __searchInternalArticles( + request: Intercom.SearchInternalArticlesRequest = {}, + requestOptions?: InternalArticles.RequestOptions, + ): Promise> { + const { folder_id: folderId } = request; + const _queryParams: Record = {}; + if (folderId != null) { + _queryParams["folder_id"] = folderId; + } + + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + "internal_articles/search", + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "intercom-client", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", + "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 20000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { + data: _response.body as Intercom.InternalArticleSearchResponse, + rawResponse: _response.rawResponse, + }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 401: + throw new Intercom.UnauthorizedError( + _response.error.body as Intercom.Error_, + _response.rawResponse, + ); + default: + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.IntercomTimeoutError("Timeout exceeded when calling GET /internal_articles/search."); + case "unknown": + throw new errors.IntercomError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["INTERCOM_API_KEY"]; + if (bearer == null) { + throw new errors.IntercomError({ + message: + "Please specify a bearer by either passing it in to the constructor or initializing a INTERCOM_API_KEY environment variable", + }); + } + + return `Bearer ${bearer}`; + } +} diff --git a/src/api/resources/internalArticles/client/index.ts b/src/api/resources/internalArticles/client/index.ts new file mode 100644 index 00000000..415726b7 --- /dev/null +++ b/src/api/resources/internalArticles/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/internalArticles/client/requests/DeleteInternalArticleRequest.ts b/src/api/resources/internalArticles/client/requests/DeleteInternalArticleRequest.ts new file mode 100644 index 00000000..11c7359b --- /dev/null +++ b/src/api/resources/internalArticles/client/requests/DeleteInternalArticleRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * internal_article_id: 1 + * } + */ +export interface DeleteInternalArticleRequest { + /** + * The unique identifier for the internal article which is given by Intercom. + */ + internal_article_id: number; +} diff --git a/src/api/resources/internalArticles/client/requests/RetrieveInternalArticleRequest.ts b/src/api/resources/internalArticles/client/requests/RetrieveInternalArticleRequest.ts new file mode 100644 index 00000000..7b13877e --- /dev/null +++ b/src/api/resources/internalArticles/client/requests/RetrieveInternalArticleRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * internal_article_id: 1 + * } + */ +export interface RetrieveInternalArticleRequest { + /** + * The unique identifier for the article which is given by Intercom. + */ + internal_article_id: number; +} diff --git a/src/api/resources/internalArticles/client/requests/SearchInternalArticlesRequest.ts b/src/api/resources/internalArticles/client/requests/SearchInternalArticlesRequest.ts new file mode 100644 index 00000000..8f67cd7e --- /dev/null +++ b/src/api/resources/internalArticles/client/requests/SearchInternalArticlesRequest.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * {} + */ +export interface SearchInternalArticlesRequest { + /** + * The ID of the folder to search in. + */ + folder_id?: string; +} diff --git a/src/api/resources/internalArticles/client/requests/UpdateInternalArticleRequestBody.ts b/src/api/resources/internalArticles/client/requests/UpdateInternalArticleRequestBody.ts new file mode 100644 index 00000000..9b3c3b95 --- /dev/null +++ b/src/api/resources/internalArticles/client/requests/UpdateInternalArticleRequestBody.ts @@ -0,0 +1,33 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * internal_article_id: 1, + * title: "Christmas is here!", + * body: "

New gifts in store for the jolly season

" + * } + * + * @example + * { + * internal_article_id: 1, + * title: "Christmas is here!", + * body: "

New gifts in store for the jolly season

" + * } + */ +export interface UpdateInternalArticleRequestBody { + /** + * The unique identifier for the internal article which is given by Intercom. + */ + internal_article_id: number; + /** The title of the article. */ + title?: string; + /** The content of the article. */ + body?: string; + /** The id of the author of the article. */ + author_id?: number; + /** The id of the author of the article. */ + owner_id?: number; +} diff --git a/src/api/resources/internalArticles/client/requests/index.ts b/src/api/resources/internalArticles/client/requests/index.ts new file mode 100644 index 00000000..7620bb3a --- /dev/null +++ b/src/api/resources/internalArticles/client/requests/index.ts @@ -0,0 +1,4 @@ +export { type RetrieveInternalArticleRequest } from "./RetrieveInternalArticleRequest"; +export { type UpdateInternalArticleRequestBody } from "./UpdateInternalArticleRequestBody"; +export { type DeleteInternalArticleRequest } from "./DeleteInternalArticleRequest"; +export { type SearchInternalArticlesRequest } from "./SearchInternalArticlesRequest"; diff --git a/src/api/resources/internalArticles/index.ts b/src/api/resources/internalArticles/index.ts new file mode 100644 index 00000000..c9240f83 --- /dev/null +++ b/src/api/resources/internalArticles/index.ts @@ -0,0 +1,2 @@ +export * from "./types"; +export * from "./client"; diff --git a/src/api/resources/internalArticles/types/InternalArticleListItem.ts b/src/api/resources/internalArticles/types/InternalArticleListItem.ts new file mode 100644 index 00000000..36d72e78 --- /dev/null +++ b/src/api/resources/internalArticles/types/InternalArticleListItem.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The data returned about your internal articles when you list them. + */ +export interface InternalArticleListItem { + /** The type of object - `internal_article`. */ + type?: "internal_article"; + /** The unique identifier for the article which is given by Intercom. */ + id?: string; + /** The title of the article. */ + title?: string; + /** The body of the article in HTML. */ + body?: string; + /** The id of the owner of the article. */ + owner_id?: number; + /** The id of the author of the article. */ + author_id?: number; + /** The time when the article was created. */ + created_at?: number; + /** The time when the article was last updated. */ + updated_at?: number; + /** The default locale of the article. */ + locale?: string; +} diff --git a/src/api/resources/internalArticles/types/InternalArticleSearchResponse.ts b/src/api/resources/internalArticles/types/InternalArticleSearchResponse.ts new file mode 100644 index 00000000..1ebb79d3 --- /dev/null +++ b/src/api/resources/internalArticles/types/InternalArticleSearchResponse.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Intercom from "../../../index"; + +/** + * The results of an Internal Article search + */ +export interface InternalArticleSearchResponse { + /** The type of the object - `list`. */ + type?: "list"; + /** The total number of Internal Articles matching the search query */ + total_count?: number; + /** An object containing the results of the search. */ + data?: InternalArticleSearchResponse.Data; + pages?: Intercom.CursorPages; +} + +export namespace InternalArticleSearchResponse { + /** + * An object containing the results of the search. + */ + export interface Data { + /** An array of Internal Article objects */ + internal_articles?: Intercom.InternalArticle[]; + } +} diff --git a/src/api/resources/internalArticles/types/index.ts b/src/api/resources/internalArticles/types/index.ts new file mode 100644 index 00000000..f27b4e44 --- /dev/null +++ b/src/api/resources/internalArticles/types/index.ts @@ -0,0 +1,2 @@ +export * from "./InternalArticleListItem"; +export * from "./InternalArticleSearchResponse"; diff --git a/src/api/resources/jobs/client/Client.ts b/src/api/resources/jobs/client/Client.ts new file mode 100644 index 00000000..fe5ce426 --- /dev/null +++ b/src/api/resources/jobs/client/Client.ts @@ -0,0 +1,179 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Intercom from "../../../index"; +import urlJoin from "url-join"; +import * as errors from "../../../../errors/index"; + +export declare namespace Jobs { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Intercom-Version header */ + version?: + | "1.0" + | "1.1" + | "1.2" + | "1.3" + | "1.4" + | "2.0" + | "2.1" + | "2.2" + | "2.3" + | "2.4" + | "2.5" + | "2.6" + | "2.7" + | "2.8" + | "2.9" + | "2.10" + | "2.11" + | "Unstable"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Additional headers to include in the request. */ + headers?: Record; + /** Override the Intercom-Version header */ + version?: + | "1.0" + | "1.1" + | "1.2" + | "1.3" + | "1.4" + | "2.0" + | "2.1" + | "2.2" + | "2.3" + | "2.4" + | "2.5" + | "2.6" + | "2.7" + | "2.8" + | "2.9" + | "2.10" + | "2.11" + | "Unstable"; + } +} + +/** + * Everything about jobs + */ +export class Jobs { + constructor(protected readonly _options: Jobs.Options = {}) {} + + /** + * Retrieve the status of job execution. + * + * @param {Intercom.JobsStatusRequest} request + * @param {Jobs.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Intercom.UnauthorizedError} + * @throws {@link Intercom.NotFoundError} + * + * @example + * await client.jobs.status({ + * job_id: "job_id" + * }) + */ + public status( + request: Intercom.JobsStatusRequest, + requestOptions?: Jobs.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__status(request, requestOptions)); + } + + private async __status( + request: Intercom.JobsStatusRequest, + requestOptions?: Jobs.RequestOptions, + ): Promise> { + const { job_id: jobId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `jobs/status/${encodeURIComponent(jobId)}`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "intercom-client", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", + "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 20000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { data: _response.body as Intercom.Jobs, rawResponse: _response.rawResponse }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 401: + throw new Intercom.UnauthorizedError( + _response.error.body as Intercom.Error_, + _response.rawResponse, + ); + case 404: + throw new Intercom.NotFoundError(_response.error.body as unknown, _response.rawResponse); + default: + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.IntercomTimeoutError("Timeout exceeded when calling GET /jobs/status/{job_id}."); + case "unknown": + throw new errors.IntercomError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["INTERCOM_API_KEY"]; + if (bearer == null) { + throw new errors.IntercomError({ + message: + "Please specify a bearer by either passing it in to the constructor or initializing a INTERCOM_API_KEY environment variable", + }); + } + + return `Bearer ${bearer}`; + } +} diff --git a/src/api/resources/jobs/client/index.ts b/src/api/resources/jobs/client/index.ts new file mode 100644 index 00000000..415726b7 --- /dev/null +++ b/src/api/resources/jobs/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/jobs/client/requests/JobsStatusRequest.ts b/src/api/resources/jobs/client/requests/JobsStatusRequest.ts new file mode 100644 index 00000000..a10dc242 --- /dev/null +++ b/src/api/resources/jobs/client/requests/JobsStatusRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * job_id: "job_id" + * } + */ +export interface JobsStatusRequest { + /** + * The unique identifier for the job which is given by Intercom + */ + job_id: string; +} diff --git a/src/api/resources/jobs/client/requests/index.ts b/src/api/resources/jobs/client/requests/index.ts new file mode 100644 index 00000000..0d9f97d0 --- /dev/null +++ b/src/api/resources/jobs/client/requests/index.ts @@ -0,0 +1 @@ +export { type JobsStatusRequest } from "./JobsStatusRequest"; diff --git a/src/api/resources/jobs/index.ts b/src/api/resources/jobs/index.ts new file mode 100644 index 00000000..c9240f83 --- /dev/null +++ b/src/api/resources/jobs/index.ts @@ -0,0 +1,2 @@ +export * from "./types"; +export * from "./client"; diff --git a/src/api/resources/jobs/types/Jobs.ts b/src/api/resources/jobs/types/Jobs.ts new file mode 100644 index 00000000..e2192f11 --- /dev/null +++ b/src/api/resources/jobs/types/Jobs.ts @@ -0,0 +1,35 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Jobs are tasks that are processed asynchronously by the Intercom system after being enqueued via the API. This allows for efficient handling of operations that may take time to complete, such as data imports or exports. You can check the status of your jobs to monitor their progress and ensure they are completed successfully. + */ +export interface Jobs { + /** The type of the object */ + type?: "job"; + /** The id of the job that's currently being processed or has completed. */ + id: string; + /** API endpoint URL to check the job status. */ + url?: string; + /** The status of the job execution. */ + status?: Jobs.Status; + /** The type of resource created during job execution. */ + resource_type?: string; + /** The id of the resource created during job execution (e.g. ticket id) */ + resource_id?: string; + /** The url of the resource created during job exeuction. Use this url to fetch the resource. */ + resource_url?: string; +} + +export namespace Jobs { + /** + * The status of the job execution. + */ + export type Status = "pending" | "success" | "failed"; + export const Status = { + Pending: "pending", + Success: "success", + Failed: "failed", + } as const; +} diff --git a/src/api/resources/jobs/types/index.ts b/src/api/resources/jobs/types/index.ts new file mode 100644 index 00000000..c46ba3db --- /dev/null +++ b/src/api/resources/jobs/types/index.ts @@ -0,0 +1 @@ +export * from "./Jobs"; diff --git a/src/api/resources/messages/client/Client.ts b/src/api/resources/messages/client/Client.ts index 9fd4d027..9110b89e 100644 --- a/src/api/resources/messages/client/Client.ts +++ b/src/api/resources/messages/client/Client.ts @@ -124,7 +124,7 @@ export class Messages { * }, * to: { * type: "user", - * id: "667d616d8a68186f43bafe53" + * id: "6762f23b1bb69f9f2193bc1a" * }, * created_at: 1590000000, * create_conversation_without_contact_reply: true @@ -160,21 +160,21 @@ export class Messages { * }, * to: { * type: "user", - * id: "667d616e8a68186f43bafe55" + * id: "6762f23d1bb69f9f2193bc1c" * }, * created_at: 1590000000, * create_conversation_without_contact_reply: true * }) */ public create( - request: Intercom.CreateMessageRequest, + request?: Intercom.CreateMessageRequest, requestOptions?: Messages.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions)); } private async __create( - request: Intercom.CreateMessageRequest, + request?: Intercom.CreateMessageRequest, requestOptions?: Messages.RequestOptions, ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ @@ -189,8 +189,8 @@ export class Messages { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -198,7 +198,7 @@ export class Messages { }, contentType: "application/json", requestType: "json", - body: request, + body: request != null ? request : undefined, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 20000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/src/api/resources/messages/types/Message.ts b/src/api/resources/messages/types/Message.ts index d8bd0388..c3f0d072 100644 --- a/src/api/resources/messages/types/Message.ts +++ b/src/api/resources/messages/types/Message.ts @@ -13,13 +13,13 @@ export interface Message { /** The time the conversation was created. */ created_at: number; /** The subject of the message. Only present if message_type: email. */ - subject: string; + subject?: string; /** The message body, which may contain HTML. */ body: string; /** The type of message that was sent. Can be email, inapp, facebook or twitter. */ message_type: Message.MessageType; /** The associated conversation_id */ - conversation_id: string; + conversation_id?: string; } export namespace Message { diff --git a/src/api/resources/news/resources/feeds/client/Client.ts b/src/api/resources/news/resources/feeds/client/Client.ts index 7af908b2..8fad4779 100644 --- a/src/api/resources/news/resources/feeds/client/Client.ts +++ b/src/api/resources/news/resources/feeds/client/Client.ts @@ -88,14 +88,14 @@ export class Feeds { public listItems( request: Intercom.news.ListNewsFeedItemsRequest, requestOptions?: Feeds.RequestOptions, - ): core.HttpResponsePromise { + ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__listItems(request, requestOptions)); } private async __listItems( request: Intercom.news.ListNewsFeedItemsRequest, requestOptions?: Feeds.RequestOptions, - ): Promise> { + ): Promise> { const { newsfeed_id: newsfeedId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( @@ -109,8 +109,8 @@ export class Feeds { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -123,7 +123,7 @@ export class Feeds { abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return { data: _response.body as Intercom.PaginatedNewsItemResponse, rawResponse: _response.rawResponse }; + return { data: _response.body as Intercom.PaginatedResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { @@ -171,13 +171,13 @@ export class Feeds { * @example * await client.news.feeds.list() */ - public list(requestOptions?: Feeds.RequestOptions): core.HttpResponsePromise { + public list(requestOptions?: Feeds.RequestOptions): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__list(requestOptions)); } private async __list( requestOptions?: Feeds.RequestOptions, - ): Promise> { + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.baseUrl)) ?? @@ -190,8 +190,8 @@ export class Feeds { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -204,7 +204,7 @@ export class Feeds { abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return { data: _response.body as Intercom.PaginatedNewsfeedResponse, rawResponse: _response.rawResponse }; + return { data: _response.body as Intercom.PaginatedResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { @@ -277,8 +277,8 @@ export class Feeds { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, diff --git a/src/api/resources/news/resources/items/client/Client.ts b/src/api/resources/news/resources/items/client/Client.ts index 2dc9fa97..56e06998 100644 --- a/src/api/resources/news/resources/items/client/Client.ts +++ b/src/api/resources/news/resources/items/client/Client.ts @@ -82,13 +82,13 @@ export class Items { * @example * await client.news.items.list() */ - public list(requestOptions?: Items.RequestOptions): core.HttpResponsePromise { + public list(requestOptions?: Items.RequestOptions): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__list(requestOptions)); } private async __list( requestOptions?: Items.RequestOptions, - ): Promise> { + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.baseUrl)) ?? @@ -101,8 +101,8 @@ export class Items { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -115,7 +115,7 @@ export class Items { abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return { data: _response.body as Intercom.PaginatedNewsItemResponse, rawResponse: _response.rawResponse }; + return { data: _response.body as Intercom.PaginatedResponse, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { @@ -163,7 +163,7 @@ export class Items { * await client.news.items.create({ * title: "Halloween is here!", * body: "

New costumes in store for this spooky season

", - * sender_id: 991267734, + * sender_id: 991267834, * state: "live", * deliver_silently: true, * labels: ["Product", "Update", "New"], @@ -197,8 +197,8 @@ export class Items { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -259,7 +259,7 @@ export class Items { * * @example * await client.news.items.find({ - * news_item_id: "123" + * news_item_id: 1 * }) */ public find( @@ -286,8 +286,8 @@ export class Items { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -349,22 +349,22 @@ export class Items { * * @example * await client.news.items.update({ - * news_item_id: "123", + * news_item_id: 1, * body: { * title: "Christmas is here!", * body: "

New gifts in store for the jolly season

", - * sender_id: 991267745, + * sender_id: 991267845, * reactions: ["\uD83D\uDE1D", "\uD83D\uDE02"] * } * }) * * @example * await client.news.items.update({ - * news_item_id: "123", + * news_item_id: 1, * body: { * title: "Christmas is here!", * body: "

New gifts in store for the jolly season

", - * sender_id: 991267748, + * sender_id: 991267848, * reactions: ["\uD83D\uDE1D", "\uD83D\uDE02"] * } * }) @@ -393,8 +393,8 @@ export class Items { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -459,7 +459,7 @@ export class Items { * * @example * await client.news.items.delete({ - * news_item_id: "123" + * news_item_id: 1 * }) */ public delete( @@ -486,8 +486,8 @@ export class Items { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, diff --git a/src/api/resources/news/resources/items/client/requests/DeleteNewsItemRequest.ts b/src/api/resources/news/resources/items/client/requests/DeleteNewsItemRequest.ts index 9fc8094b..72ef06fb 100644 --- a/src/api/resources/news/resources/items/client/requests/DeleteNewsItemRequest.ts +++ b/src/api/resources/news/resources/items/client/requests/DeleteNewsItemRequest.ts @@ -5,12 +5,12 @@ /** * @example * { - * news_item_id: "123" + * news_item_id: 1 * } */ export interface DeleteNewsItemRequest { /** * The unique identifier for the news item which is given by Intercom. */ - news_item_id: string; + news_item_id: number; } diff --git a/src/api/resources/news/resources/items/client/requests/FindNewsItemRequest.ts b/src/api/resources/news/resources/items/client/requests/FindNewsItemRequest.ts index d727fbdb..9832b52d 100644 --- a/src/api/resources/news/resources/items/client/requests/FindNewsItemRequest.ts +++ b/src/api/resources/news/resources/items/client/requests/FindNewsItemRequest.ts @@ -5,12 +5,12 @@ /** * @example * { - * news_item_id: "123" + * news_item_id: 1 * } */ export interface FindNewsItemRequest { /** * The unique identifier for the news item which is given by Intercom. */ - news_item_id: string; + news_item_id: number; } diff --git a/src/api/resources/news/resources/items/client/requests/UpdateNewsItemRequest.ts b/src/api/resources/news/resources/items/client/requests/UpdateNewsItemRequest.ts index ec976bc2..9aa6be38 100644 --- a/src/api/resources/news/resources/items/client/requests/UpdateNewsItemRequest.ts +++ b/src/api/resources/news/resources/items/client/requests/UpdateNewsItemRequest.ts @@ -7,22 +7,22 @@ import * as Intercom from "../../../../../../index"; /** * @example * { - * news_item_id: "123", + * news_item_id: 1, * body: { * title: "Christmas is here!", * body: "

New gifts in store for the jolly season

", - * sender_id: 991267745, + * sender_id: 991267845, * reactions: ["\uD83D\uDE1D", "\uD83D\uDE02"] * } * } * * @example * { - * news_item_id: "123", + * news_item_id: 1, * body: { * title: "Christmas is here!", * body: "

New gifts in store for the jolly season

", - * sender_id: 991267748, + * sender_id: 991267848, * reactions: ["\uD83D\uDE1D", "\uD83D\uDE02"] * } * } @@ -31,6 +31,6 @@ export interface UpdateNewsItemRequest { /** * The unique identifier for the news item which is given by Intercom. */ - news_item_id: string; + news_item_id: number; body: Intercom.NewsItemRequest; } diff --git a/src/api/resources/news/types/NewsItem.ts b/src/api/resources/news/types/NewsItem.ts index 2addce53..4c855b66 100644 --- a/src/api/resources/news/types/NewsItem.ts +++ b/src/api/resources/news/types/NewsItem.ts @@ -8,20 +8,18 @@ import * as Intercom from "../../../index"; * A News Item is a content type in Intercom enabling you to announce product updates, company news, promotions, events and more with your customers. */ export interface NewsItem { - /** The type of object. */ - type: "news-item"; /** The unique identifier for the news item which is given by Intercom. */ - id: string; + id?: string; /** The id of the workspace which the news item belongs to. */ - workspace_id: string; + workspace_id?: string; /** The title of the news item. */ - title: string; + title?: string; /** The news item body, which may contain HTML. */ - body: string; + body?: string; /** The id of the sender of the news item. Must be a teammate on the workspace. */ - sender_id: number; + sender_id?: number; /** News items will not be visible to your users in the assigned newsfeeds until they are set live. */ - state: NewsItem.State; + state?: NewsItem.State; /** A list of newsfeed_assignments to assign to the specified newsfeed. */ newsfeed_assignments?: Intercom.NewsfeedAssignment[]; /** Label names displayed to users to categorize the news item. */ @@ -33,7 +31,7 @@ export interface NewsItem { /** When set to true, the news item will appear in the messenger newsfeed without showing a notification badge. */ deliver_silently?: boolean; /** Timestamp for when the news item was created. */ - created_at: number; + created_at?: number; /** Timestamp for when the news item was last updated. */ updated_at?: number; } diff --git a/src/api/resources/news/types/Newsfeed.ts b/src/api/resources/news/types/Newsfeed.ts index a20a9016..10dc3a1f 100644 --- a/src/api/resources/news/types/Newsfeed.ts +++ b/src/api/resources/news/types/Newsfeed.ts @@ -9,13 +9,11 @@ */ export interface Newsfeed { /** The unique identifier for the newsfeed which is given by Intercom. */ - id: string; - /** The type of object. */ - type: "newsfeed"; + id?: string; /** The name of the newsfeed. This name will never be visible to your users. */ - name: string; + name?: string; /** Timestamp for when the newsfeed was created. */ - created_at: number; + created_at?: number; /** Timestamp for when the newsfeed was last updated. */ updated_at?: number; } diff --git a/src/api/resources/news/types/NewsfeedAssignment.ts b/src/api/resources/news/types/NewsfeedAssignment.ts index 80447b20..2eb97d45 100644 --- a/src/api/resources/news/types/NewsfeedAssignment.ts +++ b/src/api/resources/news/types/NewsfeedAssignment.ts @@ -7,7 +7,7 @@ */ export interface NewsfeedAssignment { /** The unique identifier for the newsfeed which is given by Intercom. Publish dates cannot be in the future, to schedule news items use the dedicated feature in app (see this article). */ - newsfeed_id: number; + newsfeed_id?: number; /** Publish date of the news item on the newsfeed, use this field if you want to set a publish date in the past (e.g. when importing existing news items). On write, this field will be ignored if the news item state is "draft". */ - published_at: number; + published_at?: number; } diff --git a/src/api/resources/notes/client/Client.ts b/src/api/resources/notes/client/Client.ts index 44866b02..ffbb2260 100644 --- a/src/api/resources/notes/client/Client.ts +++ b/src/api/resources/notes/client/Client.ts @@ -114,8 +114,8 @@ export class Notes { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -216,8 +216,8 @@ export class Notes { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -277,7 +277,7 @@ export class Notes { * * @example * await client.notes.find({ - * note_id: "1" + * note_id: 1 * }) */ public find( @@ -304,8 +304,8 @@ export class Notes { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, diff --git a/src/api/resources/notes/client/requests/FindNoteRequest.ts b/src/api/resources/notes/client/requests/FindNoteRequest.ts index 35bff5e2..d2cb9d61 100644 --- a/src/api/resources/notes/client/requests/FindNoteRequest.ts +++ b/src/api/resources/notes/client/requests/FindNoteRequest.ts @@ -5,12 +5,12 @@ /** * @example * { - * note_id: "1" + * note_id: 1 * } */ export interface FindNoteRequest { /** * The unique identifier of a given note */ - note_id: string; + note_id: number; } diff --git a/src/api/resources/notes/types/Note.ts b/src/api/resources/notes/types/Note.ts index a2b2345d..24019a4d 100644 --- a/src/api/resources/notes/types/Note.ts +++ b/src/api/resources/notes/types/Note.ts @@ -9,17 +9,17 @@ import * as Intercom from "../../../index"; */ export interface Note { /** String representing the object's type. Always has the value `note`. */ - type: "note"; + type?: string; /** The id of the note. */ - id: string; + id?: string; /** The time the note was created. */ - created_at: number; + created_at?: number; /** Represents the contact that the note was created about. */ contact?: Note.Contact; /** Optional. Represents the Admin that created the note. */ - author: Intercom.Admin; + author?: Intercom.Admin; /** The body text of the note. */ - body: string; + body?: string; } export namespace Note { @@ -28,7 +28,7 @@ export namespace Note { */ export interface Contact { /** String representing the object's type. Always has the value `contact`. */ - type?: "contact"; + type?: string; /** The id of the contact. */ id?: string; } diff --git a/src/api/resources/phoneCallRedirects/client/Client.ts b/src/api/resources/phoneCallRedirects/client/Client.ts index 2c057d93..232fe9ad 100644 --- a/src/api/resources/phoneCallRedirects/client/Client.ts +++ b/src/api/resources/phoneCallRedirects/client/Client.ts @@ -78,7 +78,7 @@ export class PhoneCallRedirects { * * If custom attributes are specified, they will be added to the user or lead's custom data attributes. * - * @param {Intercom.CreatePhoneCallRedirectRequest} request + * @param {Intercom.CreatePhoneSwitchRequest} request * @param {PhoneCallRedirects.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.BadRequestError} @@ -104,16 +104,16 @@ export class PhoneCallRedirects { * }) */ public create( - request: Intercom.CreatePhoneCallRedirectRequest, + request?: Intercom.CreatePhoneSwitchRequest, requestOptions?: PhoneCallRedirects.RequestOptions, - ): core.HttpResponsePromise { + ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions)); } private async __create( - request: Intercom.CreatePhoneCallRedirectRequest, + request?: Intercom.CreatePhoneSwitchRequest, requestOptions?: PhoneCallRedirects.RequestOptions, - ): Promise> { + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.baseUrl)) ?? @@ -126,8 +126,8 @@ export class PhoneCallRedirects { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -135,13 +135,13 @@ export class PhoneCallRedirects { }, contentType: "application/json", requestType: "json", - body: request, + body: request != null ? request : undefined, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 20000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return { data: _response.body as Intercom.PhoneSwitch, rawResponse: _response.rawResponse }; + return { data: _response.body as Intercom.PhoneSwitch | undefined, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { diff --git a/src/api/resources/phoneCallRedirects/client/index.ts b/src/api/resources/phoneCallRedirects/client/index.ts index 415726b7..cb0ff5c3 100644 --- a/src/api/resources/phoneCallRedirects/client/index.ts +++ b/src/api/resources/phoneCallRedirects/client/index.ts @@ -1 +1 @@ -export * from "./requests"; +export {}; diff --git a/src/api/resources/phoneCallRedirects/client/requests/CreatePhoneCallRedirectRequest.ts b/src/api/resources/phoneCallRedirects/client/requests/CreatePhoneCallRedirectRequest.ts deleted file mode 100644 index 3b19efc3..00000000 --- a/src/api/resources/phoneCallRedirects/client/requests/CreatePhoneCallRedirectRequest.ts +++ /dev/null @@ -1,48 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as Intercom from "../../../../index"; - -/** - * @example - * { - * phone: "+353832345678", - * custom_attributes: { - * "issue_type": "Billing", - * "priority": "High" - * } - * } - * - * @example - * { - * phone: "+353832345678", - * custom_attributes: { - * "issue_type": "Billing", - * "priority": "High" - * } - * } - * - * @example - * { - * phone: "+353832345678", - * custom_attributes: { - * "issue_type": "Billing", - * "priority": "High" - * } - * } - * - * @example - * { - * phone: "+40241100100", - * custom_attributes: { - * "issue_type": "Billing", - * "priority": "High" - * } - * } - */ -export interface CreatePhoneCallRedirectRequest { - /** Phone number in E.164 format, that will receive the SMS to continue the conversation in the Messenger. */ - phone: string; - custom_attributes?: Intercom.CustomAttributes; -} diff --git a/src/api/resources/phoneCallRedirects/client/requests/index.ts b/src/api/resources/phoneCallRedirects/client/requests/index.ts deleted file mode 100644 index 7038d703..00000000 --- a/src/api/resources/phoneCallRedirects/client/requests/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { type CreatePhoneCallRedirectRequest } from "./CreatePhoneCallRedirectRequest"; diff --git a/src/api/resources/segments/client/Client.ts b/src/api/resources/segments/client/Client.ts index 738a10b7..f69ed70d 100644 --- a/src/api/resources/segments/client/Client.ts +++ b/src/api/resources/segments/client/Client.ts @@ -115,8 +115,8 @@ export class Segments { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -204,8 +204,8 @@ export class Segments { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, diff --git a/src/api/resources/segments/types/Segment.ts b/src/api/resources/segments/types/Segment.ts index 6612edb7..b297f427 100644 --- a/src/api/resources/segments/types/Segment.ts +++ b/src/api/resources/segments/types/Segment.ts @@ -7,17 +7,17 @@ */ export interface Segment { /** The type of object. */ - type: "segment"; + type?: "segment"; /** The unique identifier representing the segment. */ - id: string; + id?: string; /** The name of the segment. */ - name: string; + name?: string; /** The time the segment was created. */ - created_at: number; + created_at?: number; /** The time the segment was updated. */ updated_at?: number; /** Type of the contact: contact (lead) or user. */ - person_type: Segment.PersonType; + person_type?: Segment.PersonType; /** The number of items in the user segment. It's returned when `include_count=true` is included in the request. */ count?: number; } diff --git a/src/api/resources/subscriptionTypes/client/Client.ts b/src/api/resources/subscriptionTypes/client/Client.ts index abfe8aa7..740b698f 100644 --- a/src/api/resources/subscriptionTypes/client/Client.ts +++ b/src/api/resources/subscriptionTypes/client/Client.ts @@ -106,8 +106,8 @@ export class SubscriptionTypes { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, diff --git a/src/api/resources/subscriptionTypes/types/SubscriptionType.ts b/src/api/resources/subscriptionTypes/types/SubscriptionType.ts index fe1c68ff..301ce5d3 100644 --- a/src/api/resources/subscriptionTypes/types/SubscriptionType.ts +++ b/src/api/resources/subscriptionTypes/types/SubscriptionType.ts @@ -9,18 +9,18 @@ import * as Intercom from "../../../index"; */ export interface SubscriptionType { /** The type of the object - subscription */ - type: "subscription"; + type?: "subscription"; /** The unique identifier representing the subscription type. */ - id: string; + id?: string; /** The state of the subscription type. */ - state: SubscriptionType.State; - default_translation: Intercom.Translation; + state?: SubscriptionType.State; + default_translation?: Intercom.Translation; /** An array of translations objects with the localised version of the subscription type in each available locale within your translation settings. */ - translations: Intercom.Translation[]; + translations?: Intercom.Translation[]; /** Describes the type of consent. */ - consent_type: SubscriptionType.ConsentType; + consent_type?: SubscriptionType.ConsentType; /** The message types that this subscription supports - can contain `email` or `sms_message`. */ - content_types: SubscriptionType.ContentTypes.Item[]; + content_types?: SubscriptionType.ContentTypes.Item[]; } export namespace SubscriptionType { diff --git a/src/api/resources/tags/client/Client.ts b/src/api/resources/tags/client/Client.ts index db51c738..df1f9f20 100644 --- a/src/api/resources/tags/client/Client.ts +++ b/src/api/resources/tags/client/Client.ts @@ -120,8 +120,8 @@ export class Tags { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -214,8 +214,8 @@ export class Tags { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -308,8 +308,8 @@ export class Tags { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -403,8 +403,8 @@ export class Tags { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -485,8 +485,8 @@ export class Tags { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -606,8 +606,8 @@ export class Tags { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -700,8 +700,8 @@ export class Tags { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -791,8 +791,8 @@ export class Tags { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -885,8 +885,8 @@ export class Tags { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -978,8 +978,8 @@ export class Tags { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, diff --git a/src/api/resources/tags/client/requests/UntagConversationRequest.ts b/src/api/resources/tags/client/requests/UntagConversationRequest.ts index 1d730070..526c00c3 100644 --- a/src/api/resources/tags/client/requests/UntagConversationRequest.ts +++ b/src/api/resources/tags/client/requests/UntagConversationRequest.ts @@ -30,7 +30,7 @@ export interface UntagConversationRequest { */ conversation_id: string; /** - * id + * tag_id */ tag_id: string; /** The unique identifier for the admin which is given by Intercom. */ diff --git a/src/api/resources/tags/types/Tag.ts b/src/api/resources/tags/types/Tag.ts index 7002dfdb..d98f4daa 100644 --- a/src/api/resources/tags/types/Tag.ts +++ b/src/api/resources/tags/types/Tag.ts @@ -15,6 +15,6 @@ export interface Tag { /** The name of the tag */ name: string; /** The time when the tag was applied to the object */ - applied_at: number; - applied_by: Intercom.Reference; + applied_at?: number; + applied_by?: Intercom.Reference; } diff --git a/src/api/resources/tags/types/TagBasic.ts b/src/api/resources/tags/types/TagBasic.ts new file mode 100644 index 00000000..7067f78b --- /dev/null +++ b/src/api/resources/tags/types/TagBasic.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * A tag allows you to label your contacts, companies, and conversations and list them using that tag. + */ +export interface TagBasic { + /** value is "tag" */ + type?: string; + /** The id of the tag */ + id?: string; + /** The name of the tag */ + name?: string; +} diff --git a/src/api/resources/tags/types/index.ts b/src/api/resources/tags/types/index.ts index 9f251c2a..8a43d6ee 100644 --- a/src/api/resources/tags/types/index.ts +++ b/src/api/resources/tags/types/index.ts @@ -1,2 +1,3 @@ export * from "./TagsCreateRequestBody"; export * from "./Tag"; +export * from "./TagBasic"; diff --git a/src/api/resources/teams/client/Client.ts b/src/api/resources/teams/client/Client.ts index 2d523ac4..095cb272 100644 --- a/src/api/resources/teams/client/Client.ts +++ b/src/api/resources/teams/client/Client.ts @@ -102,8 +102,8 @@ export class Teams { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -190,8 +190,8 @@ export class Teams { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, diff --git a/src/api/resources/teams/types/Team.ts b/src/api/resources/teams/types/Team.ts index 698c89c9..31d3746d 100644 --- a/src/api/resources/teams/types/Team.ts +++ b/src/api/resources/teams/types/Team.ts @@ -9,12 +9,12 @@ import * as Intercom from "../../../index"; */ export interface Team { /** Value is always "team" */ - type: "team"; + type?: string; /** The id of the team */ - id: string; + id?: string; /** The name of the team */ - name: string; + name?: string; /** The list of admin IDs that are a part of the team. */ - admin_ids: number[]; + admin_ids?: number[]; admin_priority_level?: Intercom.AdminPriorityLevel; } diff --git a/src/api/resources/ticketStates/client/Client.ts b/src/api/resources/ticketStates/client/Client.ts new file mode 100644 index 00000000..d6cf40a9 --- /dev/null +++ b/src/api/resources/ticketStates/client/Client.ts @@ -0,0 +1,170 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../environments"; +import * as core from "../../../../core"; +import * as Intercom from "../../../index"; +import urlJoin from "url-join"; +import * as errors from "../../../../errors/index"; + +export declare namespace TicketStates { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Intercom-Version header */ + version?: + | "1.0" + | "1.1" + | "1.2" + | "1.3" + | "1.4" + | "2.0" + | "2.1" + | "2.2" + | "2.3" + | "2.4" + | "2.5" + | "2.6" + | "2.7" + | "2.8" + | "2.9" + | "2.10" + | "2.11" + | "Unstable"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Additional headers to include in the request. */ + headers?: Record; + /** Override the Intercom-Version header */ + version?: + | "1.0" + | "1.1" + | "1.2" + | "1.3" + | "1.4" + | "2.0" + | "2.1" + | "2.2" + | "2.3" + | "2.4" + | "2.5" + | "2.6" + | "2.7" + | "2.8" + | "2.9" + | "2.10" + | "2.11" + | "Unstable"; + } +} + +/** + * Everything about your ticket states + */ +export class TicketStates { + constructor(protected readonly _options: TicketStates.Options = {}) {} + + /** + * You can get a list of all ticket states for a workspace. + * + * @param {TicketStates.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Intercom.UnauthorizedError} + * + * @example + * await client.ticketStates.listTicketStates() + */ + public listTicketStates( + requestOptions?: TicketStates.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__listTicketStates(requestOptions)); + } + + private async __listTicketStates( + requestOptions?: TicketStates.RequestOptions, + ): Promise> { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + "ticket_states", + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "intercom-client", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", + "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 20000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { data: _response.body as Intercom.TicketStateList, rawResponse: _response.rawResponse }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 401: + throw new Intercom.UnauthorizedError( + _response.error.body as Intercom.Error_, + _response.rawResponse, + ); + default: + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.IntercomTimeoutError("Timeout exceeded when calling GET /ticket_states."); + case "unknown": + throw new errors.IntercomError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["INTERCOM_API_KEY"]; + if (bearer == null) { + throw new errors.IntercomError({ + message: + "Please specify a bearer by either passing it in to the constructor or initializing a INTERCOM_API_KEY environment variable", + }); + } + + return `Bearer ${bearer}`; + } +} diff --git a/src/api/resources/ticketStates/client/index.ts b/src/api/resources/ticketStates/client/index.ts new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/src/api/resources/ticketStates/client/index.ts @@ -0,0 +1 @@ +export {}; diff --git a/src/api/resources/ticketStates/index.ts b/src/api/resources/ticketStates/index.ts new file mode 100644 index 00000000..5ec76921 --- /dev/null +++ b/src/api/resources/ticketStates/index.ts @@ -0,0 +1 @@ +export * from "./client"; diff --git a/src/api/resources/ticketTypes/client/Client.ts b/src/api/resources/ticketTypes/client/Client.ts index f4909e81..d233d2cb 100644 --- a/src/api/resources/ticketTypes/client/Client.ts +++ b/src/api/resources/ticketTypes/client/Client.ts @@ -111,8 +111,8 @@ export class TicketTypes { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -182,16 +182,16 @@ export class TicketTypes { * }) */ public create( - request: Intercom.CreateTicketTypeRequest, + request?: Intercom.CreateTicketTypeRequest, requestOptions?: TicketTypes.RequestOptions, - ): core.HttpResponsePromise { + ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions)); } private async __create( - request: Intercom.CreateTicketTypeRequest, + request?: Intercom.CreateTicketTypeRequest, requestOptions?: TicketTypes.RequestOptions, - ): Promise> { + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.baseUrl)) ?? @@ -204,8 +204,8 @@ export class TicketTypes { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -213,13 +213,13 @@ export class TicketTypes { }, contentType: "application/json", requestType: "json", - body: request, + body: request != null ? request : undefined, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 20000, maxRetries: requestOptions?.maxRetries, abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return { data: _response.body as Intercom.TicketType, rawResponse: _response.rawResponse }; + return { data: _response.body as Intercom.TicketType | undefined, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { @@ -271,14 +271,14 @@ export class TicketTypes { public get( request: Intercom.FindTicketTypeRequest, requestOptions?: TicketTypes.RequestOptions, - ): core.HttpResponsePromise { + ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__get(request, requestOptions)); } private async __get( request: Intercom.FindTicketTypeRequest, requestOptions?: TicketTypes.RequestOptions, - ): Promise> { + ): Promise> { const { ticket_type_id: ticketTypeId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( @@ -292,8 +292,8 @@ export class TicketTypes { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -306,7 +306,7 @@ export class TicketTypes { abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return { data: _response.body as Intercom.TicketType, rawResponse: _response.rawResponse }; + return { data: _response.body as Intercom.TicketType | undefined, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { @@ -366,14 +366,14 @@ export class TicketTypes { public update( request: Intercom.UpdateTicketTypeRequest, requestOptions?: TicketTypes.RequestOptions, - ): core.HttpResponsePromise { + ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__update(request, requestOptions)); } private async __update( request: Intercom.UpdateTicketTypeRequest, requestOptions?: TicketTypes.RequestOptions, - ): Promise> { + ): Promise> { const { ticket_type_id: ticketTypeId, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( @@ -387,8 +387,8 @@ export class TicketTypes { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -402,7 +402,7 @@ export class TicketTypes { abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return { data: _response.body as Intercom.TicketType, rawResponse: _response.rawResponse }; + return { data: _response.body as Intercom.TicketType | undefined, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { diff --git a/src/api/resources/ticketTypes/client/requests/index.ts b/src/api/resources/ticketTypes/client/requests/index.ts index 7b66e378..bd61b29a 100644 --- a/src/api/resources/ticketTypes/client/requests/index.ts +++ b/src/api/resources/ticketTypes/client/requests/index.ts @@ -1,3 +1,2 @@ -export { type CreateTicketTypeRequest } from "./CreateTicketTypeRequest"; export { type FindTicketTypeRequest } from "./FindTicketTypeRequest"; export { type UpdateTicketTypeRequest } from "./UpdateTicketTypeRequest"; diff --git a/src/api/resources/ticketTypes/resources/attributes/client/Client.ts b/src/api/resources/ticketTypes/resources/attributes/client/Client.ts index 32ac1e89..6028f926 100644 --- a/src/api/resources/ticketTypes/resources/attributes/client/Client.ts +++ b/src/api/resources/ticketTypes/resources/attributes/client/Client.ts @@ -92,14 +92,14 @@ export class Attributes { public create( request: Intercom.ticketTypes.CreateTicketTypeAttributeRequest, requestOptions?: Attributes.RequestOptions, - ): core.HttpResponsePromise { + ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions)); } private async __create( request: Intercom.ticketTypes.CreateTicketTypeAttributeRequest, requestOptions?: Attributes.RequestOptions, - ): Promise> { + ): Promise> { const { ticket_type_id: ticketTypeId, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( @@ -113,8 +113,8 @@ export class Attributes { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -128,7 +128,10 @@ export class Attributes { abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return { data: _response.body as Intercom.TicketTypeAttribute, rawResponse: _response.rawResponse }; + return { + data: _response.body as Intercom.TicketTypeAttribute | undefined, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { @@ -184,14 +187,14 @@ export class Attributes { public update( request: Intercom.ticketTypes.UpdateTicketTypeAttributeRequest, requestOptions?: Attributes.RequestOptions, - ): core.HttpResponsePromise { + ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__update(request, requestOptions)); } private async __update( request: Intercom.ticketTypes.UpdateTicketTypeAttributeRequest, requestOptions?: Attributes.RequestOptions, - ): Promise> { + ): Promise> { const { ticket_type_id: ticketTypeId, attribute_id: attributeId, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( @@ -205,8 +208,8 @@ export class Attributes { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -220,7 +223,10 @@ export class Attributes { abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return { data: _response.body as Intercom.TicketTypeAttribute, rawResponse: _response.rawResponse }; + return { + data: _response.body as Intercom.TicketTypeAttribute | undefined, + rawResponse: _response.rawResponse, + }; } if (_response.error.reason === "status-code") { diff --git a/src/api/resources/tickets/client/Client.ts b/src/api/resources/tickets/client/Client.ts index a47554f7..f5a3a2b6 100644 --- a/src/api/resources/tickets/client/Client.ts +++ b/src/api/resources/tickets/client/Client.ts @@ -92,7 +92,7 @@ export class Tickets { * message_type: "comment", * type: "user", * body: "Thanks again :)", - * intercom_user_id: "667d619d8a68186f43bafe82" + * intercom_user_id: "6762f2971bb69f9f2193bc49" * } * }) * @@ -116,10 +116,10 @@ export class Tickets { * admin_id: "3156780", * reply_options: [{ * text: "Yes", - * uuid: "22d6d1f4-1a19-41d0-94c2-e54031f78aca" + * uuid: "0df48b85-9a93-4c66-a167-753eff0baaec" * }, { * text: "No", - * uuid: "fbc3dbe0-ec0c-4fb6-826d-e19127191906" + * uuid: "4f0b5145-4193-4b4f-8cad-ce19478a3938" * }] * } * }) @@ -131,7 +131,7 @@ export class Tickets { * message_type: "comment", * type: "user", * body: "Thanks again :)", - * intercom_user_id: "667d61a68a68186f43bafe85" + * intercom_user_id: "6762f2a41bb69f9f2193bc4c" * } * }) */ @@ -159,8 +159,8 @@ export class Tickets { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -226,25 +226,21 @@ export class Tickets { * await client.tickets.create({ * ticket_type_id: "1234", * contacts: [{ - * id: "667d61b78a68186f43bafe8d" - * }], - * ticket_attributes: { - * "_default_title_": "example", - * "_default_description_": "there is a problem" - * } + * id: "6762f2d81bb69f9f2193bc54" + * }] * }) */ public create( request: Intercom.CreateTicketRequest, requestOptions?: Tickets.RequestOptions, - ): core.HttpResponsePromise { + ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions)); } private async __create( request: Intercom.CreateTicketRequest, requestOptions?: Tickets.RequestOptions, - ): Promise> { + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.baseUrl)) ?? @@ -257,8 +253,8 @@ export class Tickets { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -272,7 +268,7 @@ export class Tickets { abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return { data: _response.body as Intercom.Ticket, rawResponse: _response.rawResponse }; + return { data: _response.body as Intercom.Ticket | undefined, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { @@ -308,6 +304,99 @@ export class Tickets { } } + /** + * Enqueues ticket creation for asynchronous processing, returning if the job was enqueued successfully to be processed. We attempt to perform a best-effort validation on inputs before tasks are enqueued. If the given parameters are incorrect, we won't enqueue the job. + * + * @param {Intercom.EnqueueCreateTicketRequest} request + * @param {Tickets.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Intercom.BadRequestError} + * @throws {@link Intercom.UnauthorizedError} + * + * @example + * await client.tickets.enqueueCreateTicket({ + * ticket_type_id: "1234", + * contacts: [{ + * id: "6762f2d81bb69f9f2193bc54" + * }] + * }) + */ + public enqueueCreateTicket( + request: Intercom.EnqueueCreateTicketRequest, + requestOptions?: Tickets.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__enqueueCreateTicket(request, requestOptions)); + } + + private async __enqueueCreateTicket( + request: Intercom.EnqueueCreateTicketRequest, + requestOptions?: Tickets.RequestOptions, + ): Promise> { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + "tickets/enqueue", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "intercom-client", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", + "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: request, + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 20000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { data: _response.body as Intercom.Jobs, rawResponse: _response.rawResponse }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Intercom.BadRequestError(_response.error.body as unknown, _response.rawResponse); + case 401: + throw new Intercom.UnauthorizedError( + _response.error.body as Intercom.Error_, + _response.rawResponse, + ); + default: + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.IntercomTimeoutError("Timeout exceeded when calling POST /tickets/enqueue."); + case "unknown": + throw new errors.IntercomError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + } + /** * You can fetch the details of a single ticket. * @@ -324,14 +413,14 @@ export class Tickets { public get( request: Intercom.FindTicketRequest, requestOptions?: Tickets.RequestOptions, - ): core.HttpResponsePromise { + ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__get(request, requestOptions)); } private async __get( request: Intercom.FindTicketRequest, requestOptions?: Tickets.RequestOptions, - ): Promise> { + ): Promise> { const { ticket_id: ticketId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( @@ -345,8 +434,8 @@ export class Tickets { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -359,7 +448,7 @@ export class Tickets { abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return { data: _response.body as Intercom.Ticket, rawResponse: _response.rawResponse }; + return { data: _response.body as Intercom.Ticket | undefined, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { @@ -401,6 +490,7 @@ export class Tickets { * @param {Intercom.UpdateTicketRequest} request * @param {Tickets.RequestOptions} requestOptions - Request-specific configuration. * + * @throws {@link Intercom.BadRequestError} * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.NotFoundError} * @@ -411,13 +501,11 @@ export class Tickets { * "_default_title_": "example", * "_default_description_": "there is a problem" * }, - * state: "in_progress", + * ticket_state_id: "123", * open: true, * snoozed_until: 1673609604, - * assignment: { - * admin_id: "991267883", - * assignee_id: "991267885" - * } + * admin_id: 991268011, + * assignee_id: "123" * }) * * @example @@ -427,38 +515,28 @@ export class Tickets { * "_default_title_": "example", * "_default_description_": "there is a problem" * }, - * state: "in_progress", - * assignment: { - * admin_id: "123", - * assignee_id: "991267893" - * } + * ticket_state_id: "123", + * admin_id: 991268011, + * assignee_id: "123" * }) * * @example * await client.tickets.update({ * ticket_id: "ticket_id", - * ticket_attributes: { - * "_default_title_": "example", - * "_default_description_": "there is a problem" - * }, - * state: "in_progress", - * assignment: { - * admin_id: "991267899", - * assignee_id: "456" - * } + * ticket_state_id: "123" * }) */ public update( request: Intercom.UpdateTicketRequest, requestOptions?: Tickets.RequestOptions, - ): core.HttpResponsePromise { + ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__update(request, requestOptions)); } private async __update( request: Intercom.UpdateTicketRequest, requestOptions?: Tickets.RequestOptions, - ): Promise> { + ): Promise> { const { ticket_id: ticketId, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( @@ -472,8 +550,8 @@ export class Tickets { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -487,11 +565,13 @@ export class Tickets { abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return { data: _response.body as Intercom.Ticket, rawResponse: _response.rawResponse }; + return { data: _response.body as Intercom.Ticket | undefined, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { switch (_response.error.statusCode) { + case 400: + throw new Intercom.BadRequestError(_response.error.body as unknown, _response.rawResponse); case 401: throw new Intercom.UnauthorizedError( _response.error.body as Intercom.Error_, @@ -525,6 +605,96 @@ export class Tickets { } } + /** + * You can delete a ticket using the Intercom provided ID. + * + * @param {Intercom.DeleteTicketRequest} request + * @param {Tickets.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Intercom.UnauthorizedError} + * @throws {@link Intercom.NotFoundError} + * + * @example + * await client.tickets.deleteTicket({ + * ticket_id: "ticket_id" + * }) + */ + public deleteTicket( + request: Intercom.DeleteTicketRequest, + requestOptions?: Tickets.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__deleteTicket(request, requestOptions)); + } + + private async __deleteTicket( + request: Intercom.DeleteTicketRequest, + requestOptions?: Tickets.RequestOptions, + ): Promise> { + const { ticket_id: ticketId } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `tickets/${encodeURIComponent(ticketId)}`, + ), + method: "DELETE", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "intercom-client", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", + "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 20000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { data: _response.body as Intercom.DeleteTicketResponse, rawResponse: _response.rawResponse }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 401: + throw new Intercom.UnauthorizedError( + _response.error.body as Intercom.Error_, + _response.rawResponse, + ); + case 404: + throw new Intercom.NotFoundError(_response.error.body as unknown, _response.rawResponse); + default: + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.IntercomTimeoutError("Timeout exceeded when calling DELETE /tickets/{ticket_id}."); + case "unknown": + throw new errors.IntercomError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + } + /** * You can search for multiple tickets by the value of their attributes in order to fetch exactly which ones you want. * @@ -548,6 +718,7 @@ export class Tickets { * ### Accepted Fields * * Most keys listed as part of the Ticket model are searchable, whether writeable or not. The value you search for has to match the accepted type, otherwise the query will fail (ie. as `created_at` accepts a date, the `value` cannot be a string such as `"foobar"`). + * The `source.body` field is unique as the search will not be performed against the entire value, but instead against every element of the value separately. For example, when searching for a conversation with a `"I need support"` body - the query should contain a `=` operator with the value `"support"` for such conversation to be returned. A query with a `=` operator and a `"need support"` value will not yield a result. * * | Field | Type | * | :---------------------------------------- | :--------------------------------------------------------------------------------------- | @@ -567,6 +738,13 @@ export class Tickets { * | snoozed_until | Date (UNIX timestamp) | * | ticket_attribute.{id} | String or Boolean or Date (UNIX timestamp) or Float or Integer | * + * {% admonition type="info" name="Searching by Category" %} + * When searching for tickets by the **`category`** field, specific terms must be used instead of the category names: + * * For **Customer** category tickets, use the term `request`. + * * For **Back-office** category tickets, use the term `task`. + * * For **Tracker** category tickets, use the term `tracker`. + * {% /admonition %} + * * ### Accepted Operators * * {% admonition type="info" name="Searching based on `created_at`" %} @@ -609,7 +787,7 @@ export class Tickets { public async search( request: Intercom.SearchRequest, requestOptions?: Tickets.RequestOptions, - ): Promise> { + ): Promise> { const list = core.HttpResponsePromise.interceptFunction( async (request: Intercom.SearchRequest): Promise> => { const _response = await (this._options.fetcher ?? core.fetcher)({ @@ -624,8 +802,8 @@ export class Tickets { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -667,7 +845,7 @@ export class Tickets { }, ); const dataWithRawResponse = await list(request).withRawResponse(); - return new core.Pageable({ + return new core.Pageable({ response: dataWithRawResponse.data, rawResponse: dataWithRawResponse.rawResponse, hasNextPage: (response) => response?.pages?.next?.starting_after != null, diff --git a/src/api/resources/tickets/client/requests/CreateTicketRequest.ts b/src/api/resources/tickets/client/requests/CreateTicketRequest.ts new file mode 100644 index 00000000..8c07230f --- /dev/null +++ b/src/api/resources/tickets/client/requests/CreateTicketRequest.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Intercom from "../../../../index"; + +/** + * @example + * { + * ticket_type_id: "1234", + * contacts: [{ + * id: "6762f2d81bb69f9f2193bc54" + * }] + * } + */ +export interface CreateTicketRequest extends Intercom.CreateTicketRequestBody { + /** Option to disable notifications when a Ticket is created. */ + skip_notifications?: boolean; +} diff --git a/src/api/resources/tickets/client/requests/DeleteTicketRequest.ts b/src/api/resources/tickets/client/requests/DeleteTicketRequest.ts new file mode 100644 index 00000000..04b031e0 --- /dev/null +++ b/src/api/resources/tickets/client/requests/DeleteTicketRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * ticket_id: "ticket_id" + * } + */ +export interface DeleteTicketRequest { + /** + * The unique identifier for the ticket which is given by Intercom. + */ + ticket_id: string; +} diff --git a/src/api/resources/tickets/client/requests/EnqueueCreateTicketRequest.ts b/src/api/resources/tickets/client/requests/EnqueueCreateTicketRequest.ts new file mode 100644 index 00000000..12c3e0be --- /dev/null +++ b/src/api/resources/tickets/client/requests/EnqueueCreateTicketRequest.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Intercom from "../../../../index"; + +/** + * @example + * { + * ticket_type_id: "1234", + * contacts: [{ + * id: "6762f2d81bb69f9f2193bc54" + * }] + * } + */ +export interface EnqueueCreateTicketRequest extends Intercom.CreateTicketRequestBody { + /** Option to disable notifications when a Ticket is created. */ + skip_notifications?: boolean; +} diff --git a/src/api/resources/tickets/client/requests/ReplyToTicketRequest.ts b/src/api/resources/tickets/client/requests/ReplyToTicketRequest.ts index c00dcfdd..9ecfe4b3 100644 --- a/src/api/resources/tickets/client/requests/ReplyToTicketRequest.ts +++ b/src/api/resources/tickets/client/requests/ReplyToTicketRequest.ts @@ -12,7 +12,7 @@ import * as Intercom from "../../../../index"; * message_type: "comment", * type: "user", * body: "Thanks again :)", - * intercom_user_id: "667d619d8a68186f43bafe82" + * intercom_user_id: "6762f2971bb69f9f2193bc49" * } * } * @@ -36,10 +36,10 @@ import * as Intercom from "../../../../index"; * admin_id: "3156780", * reply_options: [{ * text: "Yes", - * uuid: "22d6d1f4-1a19-41d0-94c2-e54031f78aca" + * uuid: "0df48b85-9a93-4c66-a167-753eff0baaec" * }, { * text: "No", - * uuid: "fbc3dbe0-ec0c-4fb6-826d-e19127191906" + * uuid: "4f0b5145-4193-4b4f-8cad-ce19478a3938" * }] * } * } @@ -51,7 +51,7 @@ import * as Intercom from "../../../../index"; * message_type: "comment", * type: "user", * body: "Thanks again :)", - * intercom_user_id: "667d61a68a68186f43bafe85" + * intercom_user_id: "6762f2a41bb69f9f2193bc4c" * } * } * @@ -62,7 +62,7 @@ import * as Intercom from "../../../../index"; * message_type: "comment", * type: "user", * body: "Thanks again :)", - * intercom_user_id: "667d619d8a68186f43bafe82" + * intercom_user_id: "6762f2971bb69f9f2193bc49" * } * } * @@ -73,7 +73,7 @@ import * as Intercom from "../../../../index"; * message_type: "comment", * type: "user", * body: "Thanks again :)", - * intercom_user_id: "667d619d8a68186f43bafe82" + * intercom_user_id: "6762f2971bb69f9f2193bc49" * } * } */ diff --git a/src/api/resources/tickets/client/requests/UpdateTicketRequest.ts b/src/api/resources/tickets/client/requests/UpdateTicketRequest.ts index 99555fa9..7fd931d3 100644 --- a/src/api/resources/tickets/client/requests/UpdateTicketRequest.ts +++ b/src/api/resources/tickets/client/requests/UpdateTicketRequest.ts @@ -10,13 +10,11 @@ * "_default_title_": "example", * "_default_description_": "there is a problem" * }, - * state: "in_progress", + * ticket_state_id: "123", * open: true, * snoozed_until: 1673609604, - * assignment: { - * admin_id: "991267883", - * assignee_id: "991267885" - * } + * admin_id: 991268011, + * assignee_id: "123" * } * * @example @@ -26,11 +24,9 @@ * "_default_title_": "example", * "_default_description_": "there is a problem" * }, - * state: "in_progress", - * assignment: { - * admin_id: "123", - * assignee_id: "991267893" - * } + * ticket_state_id: "123", + * admin_id: 991268011, + * assignee_id: "123" * } * * @example @@ -40,11 +36,15 @@ * "_default_title_": "example", * "_default_description_": "there is a problem" * }, - * state: "in_progress", - * assignment: { - * admin_id: "991267899", - * assignee_id: "456" - * } + * ticket_state_id: "123", + * admin_id: 991268011, + * assignee_id: "123" + * } + * + * @example + * { + * ticket_id: "ticket_id", + * ticket_state_id: "123" * } */ export interface UpdateTicketRequest { @@ -54,32 +54,18 @@ export interface UpdateTicketRequest { ticket_id: string; /** The attributes set on the ticket. */ ticket_attributes?: Record; - /** The state of the ticket. */ - state?: UpdateTicketRequest.State; + /** The ID of the ticket state associated with the ticket type. */ + ticket_state_id?: string; + /** The ID of the company that the ticket is associated with. The unique identifier for the company which is given by Intercom. Set to nil to remove company. */ + company_id?: string; /** Specify if a ticket is open. Set to false to close a ticket. Closing a ticket will also unsnooze it. */ open?: boolean; /** Specify whether the ticket is visible to users. */ is_shared?: boolean; /** The time you want the ticket to reopen. */ snoozed_until?: number; - assignment?: UpdateTicketRequest.Assignment; -} - -export namespace UpdateTicketRequest { - /** - * The state of the ticket. - */ - export type State = "in_progress" | "waiting_on_customer" | "resolved"; - export const State = { - InProgress: "in_progress", - WaitingOnCustomer: "waiting_on_customer", - Resolved: "resolved", - } as const; - - export interface Assignment { - /** The ID of the admin performing the action. */ - admin_id?: string; - /** The ID of the admin or team to which the ticket is assigned. Set this 0 to unassign it. */ - assignee_id?: string; - } + /** The ID of the admin performing ticket update. Needed for workflows execution and attributing actions to specific admins. */ + admin_id?: number; + /** The ID of the admin or team to which the ticket is assigned. Set this 0 to unassign it. */ + assignee_id?: string; } diff --git a/src/api/resources/tickets/client/requests/index.ts b/src/api/resources/tickets/client/requests/index.ts index 23ce5a7f..8d931746 100644 --- a/src/api/resources/tickets/client/requests/index.ts +++ b/src/api/resources/tickets/client/requests/index.ts @@ -1,3 +1,6 @@ export { type ReplyToTicketRequest } from "./ReplyToTicketRequest"; +export { type CreateTicketRequest } from "./CreateTicketRequest"; +export { type EnqueueCreateTicketRequest } from "./EnqueueCreateTicketRequest"; export { type FindTicketRequest } from "./FindTicketRequest"; export { type UpdateTicketRequest } from "./UpdateTicketRequest"; +export { type DeleteTicketRequest } from "./DeleteTicketRequest"; diff --git a/src/api/resources/tickets/types/DeleteTicketResponse.ts b/src/api/resources/tickets/types/DeleteTicketResponse.ts new file mode 100644 index 00000000..579725c6 --- /dev/null +++ b/src/api/resources/tickets/types/DeleteTicketResponse.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Response when a ticket is deleted. + */ +export interface DeleteTicketResponse { + /** The unique identifier for the ticket. */ + id?: string; + /** always ticket */ + object?: "ticket"; + /** Whether the ticket is deleted or not. */ + deleted?: boolean; +} diff --git a/src/api/resources/tickets/types/Ticket.ts b/src/api/resources/tickets/types/Ticket.ts index 4962e861..b5c55f83 100644 --- a/src/api/resources/tickets/types/Ticket.ts +++ b/src/api/resources/tickets/types/Ticket.ts @@ -9,18 +9,17 @@ import * as Intercom from "../../../index"; */ export interface Ticket { /** Always ticket */ - type: "ticket"; + type?: "ticket"; /** The unique identifier for the ticket which is given by Intercom. */ - id: string; + id?: string; /** The ID of the Ticket used in the Intercom Inbox and Messenger. Do not use ticket_id for API queries. */ - ticket_id: string; + ticket_id?: string; /** Category of the Ticket. */ - category: Ticket.Category; - ticket_attributes: Intercom.TicketCustomAttributes; - /** The state the ticket is currently in */ - ticket_state: Ticket.TicketState; - ticket_type: Intercom.TicketType; - contacts: Intercom.TicketContacts; + category?: Ticket.Category; + ticket_attributes?: Intercom.TicketCustomAttributes; + ticket_state?: Intercom.TicketState; + ticket_type?: Intercom.TicketType; + contacts?: Intercom.TicketContacts; /** The id representing the admin assigned to the ticket. */ admin_assignee_id?: string; /** The id representing the team assigned to the ticket. */ @@ -37,10 +36,6 @@ export interface Ticket { ticket_parts?: Intercom.TicketParts; /** Whether or not the ticket is shared with the customer. */ is_shared?: boolean; - /** The state the ticket is currently in, in a human readable form - visible in Intercom */ - ticket_state_internal_label?: string; - /** The state the ticket is currently in, in a human readable form - visible to customers, in the messenger, email and tickets portal. */ - ticket_state_external_label?: string; } export namespace Ticket { @@ -53,14 +48,4 @@ export namespace Ticket { BackOffice: "Back-office", Tracker: "Tracker", } as const; - /** - * The state the ticket is currently in - */ - export type TicketState = "submitted" | "in_progress" | "waiting_on_customer" | "resolved"; - export const TicketState = { - Submitted: "submitted", - InProgress: "in_progress", - WaitingOnCustomer: "waiting_on_customer", - Resolved: "resolved", - } as const; } diff --git a/src/api/resources/tickets/types/TicketContacts.ts b/src/api/resources/tickets/types/TicketContacts.ts index cc70ccbb..26ed1f1a 100644 --- a/src/api/resources/tickets/types/TicketContacts.ts +++ b/src/api/resources/tickets/types/TicketContacts.ts @@ -9,7 +9,7 @@ import * as Intercom from "../../../index"; */ export interface TicketContacts { /** always contact.list */ - type: "contact.list"; + type?: "contact.list"; /** The list of contacts affected by this ticket. */ - contacts: Intercom.ContactReference[]; + contacts?: Intercom.ContactReference[]; } diff --git a/src/api/resources/tickets/types/TicketPart.ts b/src/api/resources/tickets/types/TicketPart.ts index ecfb0528..3f6626f0 100644 --- a/src/api/resources/tickets/types/TicketPart.ts +++ b/src/api/resources/tickets/types/TicketPart.ts @@ -9,19 +9,19 @@ import * as Intercom from "../../../index"; */ export interface TicketPart { /** Always ticket_part */ - type: "ticket_part"; + type?: string; /** The id representing the ticket part. */ - id: string; + id?: string; /** The type of ticket part. */ - part_type: string; + part_type?: string; /** The message body, which may contain HTML. */ body?: string; /** The previous state of the ticket. */ previous_ticket_state?: TicketPart.PreviousTicketState; /** The state of the ticket. */ - ticket_state: TicketPart.TicketState; + ticket_state?: TicketPart.TicketState; /** The time the ticket part was created. */ - created_at: number; + created_at?: number; /** The last time the ticket part was updated. */ updated_at?: number; /** The id of the admin that was assigned the ticket by this ticket_part (null if there has been no change in assignment.) */ @@ -33,6 +33,10 @@ export interface TicketPart { external_id?: string; /** Whether or not the ticket part has been redacted. */ redacted?: boolean; + /** The app package code if this part was created via API. Note this field won't show if the part was not created via API. */ + app_package_code?: string; + /** The updated attribute data of the ticket part. Only present for attribute update parts. */ + updated_attribute_data?: TicketPart.UpdatedAttributeData; } export namespace TicketPart { @@ -56,4 +60,56 @@ export namespace TicketPart { WaitingOnCustomer: "waiting_on_customer", Resolved: "resolved", } as const; + + /** + * The updated attribute data of the ticket part. Only present for attribute update parts. + */ + export interface UpdatedAttributeData { + /** Information about the attribute that was updated. */ + attribute: UpdatedAttributeData.Attribute; + /** The new value of the attribute. */ + value: UpdatedAttributeData.Value; + } + + export namespace UpdatedAttributeData { + /** + * Information about the attribute that was updated. + */ + export interface Attribute { + /** The type of the object. Always 'attribute'. */ + type: "attribute"; + /** The unique identifier of the attribute. */ + id: string; + /** The human-readable name of the attribute. */ + label: string; + } + + /** + * The new value of the attribute. + */ + export interface Value { + /** The type of the object. Always 'value'. */ + type: "value"; + id: Value.Id; + label: Value.Label; + } + + export namespace Value { + export type Id = + /** + * The value for text/number/decimal/boolean/date attributes, or the ID of the list option for list attributes. */ + | string + | undefined + /** + * Array of file IDs for file attributes. */ + | number[]; + export type Label = + /** + * The display value for text/number/decimal/boolean/date/list attributes. */ + | string + /** + * Array of file names for file attributes. */ + | string[]; + } + } } diff --git a/src/api/resources/tickets/types/TicketState.ts b/src/api/resources/tickets/types/TicketState.ts new file mode 100644 index 00000000..70427191 --- /dev/null +++ b/src/api/resources/tickets/types/TicketState.ts @@ -0,0 +1,32 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * A ticket state, used to define the state of a ticket. + */ +export interface TicketState { + /** String representing the object's type. Always has the value `ticket_state`. */ + type?: string; + /** The id of the ticket state */ + id?: string; + /** The category of the ticket state */ + category?: TicketState.Category; + /** The state the ticket is currently in, in a human readable form - visible in Intercom */ + internal_label?: string; + /** The state the ticket is currently in, in a human readable form - visible to customers, in the messenger, email and tickets portal. */ + external_label?: string; +} + +export namespace TicketState { + /** + * The category of the ticket state + */ + export type Category = "submitted" | "in_progress" | "waiting_on_customer" | "resolved"; + export const Category = { + Submitted: "submitted", + InProgress: "in_progress", + WaitingOnCustomer: "waiting_on_customer", + Resolved: "resolved", + } as const; +} diff --git a/src/api/resources/tickets/types/TicketStateDetailed.ts b/src/api/resources/tickets/types/TicketStateDetailed.ts new file mode 100644 index 00000000..5886d94a --- /dev/null +++ b/src/api/resources/tickets/types/TicketStateDetailed.ts @@ -0,0 +1,48 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Intercom from "../../../index"; + +/** + * A ticket state, used to define the state of a ticket. + */ +export interface TicketStateDetailed { + /** String representing the object's type. Always has the value `ticket_state`. */ + type?: string; + /** The id of the ticket state */ + id?: string; + /** The category of the ticket state */ + category?: TicketStateDetailed.Category; + /** The state the ticket is currently in, in a human readable form - visible in Intercom */ + internal_label?: string; + /** The state the ticket is currently in, in a human readable form - visible to customers, in the messenger, email and tickets portal. */ + external_label?: string; + /** Whether the ticket state is archived */ + archived?: boolean; + /** A list of ticket types associated with a given ticket state. */ + ticket_types?: TicketStateDetailed.TicketTypes; +} + +export namespace TicketStateDetailed { + /** + * The category of the ticket state + */ + export type Category = "submitted" | "in_progress" | "waiting_on_customer" | "resolved"; + export const Category = { + Submitted: "submitted", + InProgress: "in_progress", + WaitingOnCustomer: "waiting_on_customer", + Resolved: "resolved", + } as const; + + /** + * A list of ticket types associated with a given ticket state. + */ + export interface TicketTypes { + /** String representing the object's type. Always has the value `list`. */ + type?: string; + /** A list of ticket type attributes associated with a given ticket type. */ + data?: (Intercom.TicketType | undefined)[]; + } +} diff --git a/src/api/resources/tickets/types/TicketType.ts b/src/api/resources/tickets/types/TicketType.ts index ae240f82..e80d41c1 100644 --- a/src/api/resources/tickets/types/TicketType.ts +++ b/src/api/resources/tickets/types/TicketType.ts @@ -9,24 +9,26 @@ import * as Intercom from "../../../index"; */ export interface TicketType { /** String representing the object's type. Always has the value `ticket_type`. */ - type: "ticket_type"; + type?: string; /** The id representing the ticket type. */ - id: string; + id?: string; /** Category of the Ticket Type. */ - category: TicketType.Category; + category?: TicketType.Category; /** The name of the ticket type */ - name: string; + name?: string; /** The description of the ticket type */ - description: string; + description?: string; /** The icon of the ticket type */ - icon: string; + icon?: string; /** The id of the workspace that the ticket type belongs to. */ - workspace_id: string; - ticket_type_attributes: Intercom.TicketTypeAttributeList; + workspace_id?: string; + ticket_type_attributes?: Intercom.TicketTypeAttributeList; + /** A list of ticket states associated with a given ticket type. */ + ticket_states?: TicketType.TicketStates; /** Whether the ticket type is archived or not. */ - archived: boolean; + archived?: boolean; /** The date and time the ticket type was created. */ - created_at: number; + created_at?: number; /** The date and time the ticket type was last updated. */ updated_at?: number; } @@ -41,4 +43,14 @@ export namespace TicketType { BackOffice: "Back-office", Tracker: "Tracker", } as const; + + /** + * A list of ticket states associated with a given ticket type. + */ + export interface TicketStates { + /** String representing the object's type. Always has the value `list`. */ + type?: string; + /** A list of ticket states associated with a given ticket type. */ + data?: (Intercom.TicketState | undefined)[]; + } } diff --git a/src/api/resources/tickets/types/index.ts b/src/api/resources/tickets/types/index.ts index 2bba4510..64694d62 100644 --- a/src/api/resources/tickets/types/index.ts +++ b/src/api/resources/tickets/types/index.ts @@ -1,5 +1,8 @@ export * from "./TicketsReplyRequestBody"; +export * from "./DeleteTicketResponse"; export * from "./Ticket"; export * from "./TicketContacts"; export * from "./TicketPart"; +export * from "./TicketState"; +export * from "./TicketStateDetailed"; export * from "./TicketType"; diff --git a/src/api/resources/unstable/client/Client.ts b/src/api/resources/unstable/client/Client.ts index d05f4c7f..707bcc1a 100644 --- a/src/api/resources/unstable/client/Client.ts +++ b/src/api/resources/unstable/client/Client.ts @@ -10,6 +10,7 @@ import { Articles } from "../resources/articles/client/Client"; import { AwayStatusReasons } from "../resources/awayStatusReasons/client/Client"; import { Export } from "../resources/export/client/Client"; import { HelpCenter } from "../resources/helpCenter/client/Client"; +import { InternalArticles } from "../resources/internalArticles/client/Client"; import { Companies } from "../resources/companies/client/Client"; import { Contacts } from "../resources/contacts/client/Client"; import { Notes } from "../resources/notes/client/Client"; @@ -22,16 +23,20 @@ import { DataAttributes } from "../resources/dataAttributes/client/Client"; import { DataEvents } from "../resources/dataEvents/client/Client"; import { DataExport } from "../resources/dataExport/client/Client"; import { Jobs } from "../resources/jobs/client/Client"; +import { Macros } from "../resources/macros/client/Client"; import { Messages } from "../resources/messages/client/Client"; import { News } from "../resources/news/client/Client"; import { Segments } from "../resources/segments/client/Client"; import { Switch } from "../resources/switch/client/Client"; +import { Calls } from "../resources/calls/client/Client"; import { Teams } from "../resources/teams/client/Client"; import { TicketStates } from "../resources/ticketStates/client/Client"; import { TicketTypeAttributes } from "../resources/ticketTypeAttributes/client/Client"; import { TicketTypes } from "../resources/ticketTypes/client/Client"; import { Tickets } from "../resources/tickets/client/Client"; import { Visitors } from "../resources/visitors/client/Client"; +import { Brands } from "../resources/brands/client/Client"; +import { Emails } from "../resources/emails/client/Client"; export declare namespace Unstable { export interface Options { @@ -70,6 +75,7 @@ export class Unstable { protected _awayStatusReasons: AwayStatusReasons | undefined; protected _export: Export | undefined; protected _helpCenter: HelpCenter | undefined; + protected _internalArticles: InternalArticles | undefined; protected _companies: Companies | undefined; protected _contacts: Contacts | undefined; protected _notes: Notes | undefined; @@ -82,16 +88,20 @@ export class Unstable { protected _dataEvents: DataEvents | undefined; protected _dataExport: DataExport | undefined; protected _jobs: Jobs | undefined; + protected _macros: Macros | undefined; protected _messages: Messages | undefined; protected _news: News | undefined; protected _segments: Segments | undefined; protected _switch: Switch | undefined; + protected _calls: Calls | undefined; protected _teams: Teams | undefined; protected _ticketStates: TicketStates | undefined; protected _ticketTypeAttributes: TicketTypeAttributes | undefined; protected _ticketTypes: TicketTypes | undefined; protected _tickets: Tickets | undefined; protected _visitors: Visitors | undefined; + protected _brands: Brands | undefined; + protected _emails: Emails | undefined; constructor(protected readonly _options: Unstable.Options = {}) {} @@ -119,6 +129,10 @@ export class Unstable { return (this._helpCenter ??= new HelpCenter(this._options)); } + public get internalArticles(): InternalArticles { + return (this._internalArticles ??= new InternalArticles(this._options)); + } + public get companies(): Companies { return (this._companies ??= new Companies(this._options)); } @@ -167,6 +181,10 @@ export class Unstable { return (this._jobs ??= new Jobs(this._options)); } + public get macros(): Macros { + return (this._macros ??= new Macros(this._options)); + } + public get messages(): Messages { return (this._messages ??= new Messages(this._options)); } @@ -183,6 +201,10 @@ export class Unstable { return (this._switch ??= new Switch(this._options)); } + public get calls(): Calls { + return (this._calls ??= new Calls(this._options)); + } + public get teams(): Teams { return (this._teams ??= new Teams(this._options)); } @@ -206,4 +228,12 @@ export class Unstable { public get visitors(): Visitors { return (this._visitors ??= new Visitors(this._options)); } + + public get brands(): Brands { + return (this._brands ??= new Brands(this._options)); + } + + public get emails(): Emails { + return (this._emails ??= new Emails(this._options)); + } } diff --git a/src/api/resources/unstable/resources/admins/client/Client.ts b/src/api/resources/unstable/resources/admins/client/Client.ts index fad5ac42..7a85ddd7 100644 --- a/src/api/resources/unstable/resources/admins/client/Client.ts +++ b/src/api/resources/unstable/resources/admins/client/Client.ts @@ -109,8 +109,8 @@ export class Admins { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -203,8 +203,8 @@ export class Admins { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -302,8 +302,8 @@ export class Admins { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -382,8 +382,8 @@ export class Admins { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -470,8 +470,8 @@ export class Admins { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, diff --git a/src/api/resources/unstable/resources/aiAgent/types/AiAgent.ts b/src/api/resources/unstable/resources/aiAgent/types/AiAgent.ts index bc37ada3..9ce667c5 100644 --- a/src/api/resources/unstable/resources/aiAgent/types/AiAgent.ts +++ b/src/api/resources/unstable/resources/aiAgent/types/AiAgent.ts @@ -20,6 +20,10 @@ export interface AiAgent { rating?: number; /** The customer satisfaction rating remark given to AI Agent. */ rating_remark?: string; + /** The time when the AI agent rating was created. */ + created_at?: number; + /** The time when the AI agent rating was last updated. */ + updated_at?: number; content_sources?: Intercom.unstable.ContentSourcesList; } diff --git a/src/api/resources/unstable/resources/aiContent/client/Client.ts b/src/api/resources/unstable/resources/aiContent/client/Client.ts index 55afcd8a..1a2efc94 100644 --- a/src/api/resources/unstable/resources/aiContent/client/Client.ts +++ b/src/api/resources/unstable/resources/aiContent/client/Client.ts @@ -118,8 +118,8 @@ export class AiContent { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -207,8 +207,8 @@ export class AiContent { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -296,8 +296,8 @@ export class AiContent { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -390,8 +390,8 @@ export class AiContent { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -483,8 +483,8 @@ export class AiContent { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -566,8 +566,8 @@ export class AiContent { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -656,8 +656,8 @@ export class AiContent { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -744,8 +744,8 @@ export class AiContent { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -836,8 +836,8 @@ export class AiContent { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -924,8 +924,8 @@ export class AiContent { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, diff --git a/src/api/resources/unstable/resources/articles/client/Client.ts b/src/api/resources/unstable/resources/articles/client/Client.ts index ec87cbce..edfbd25b 100644 --- a/src/api/resources/unstable/resources/articles/client/Client.ts +++ b/src/api/resources/unstable/resources/articles/client/Client.ts @@ -110,8 +110,8 @@ export class Articles { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -197,8 +197,8 @@ export class Articles { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -288,8 +288,8 @@ export class Articles { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -378,8 +378,8 @@ export class Articles { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -488,8 +488,8 @@ export class Articles { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, diff --git a/src/api/resources/unstable/resources/articles/types/InternalArticle.ts b/src/api/resources/unstable/resources/articles/types/InternalArticle.ts new file mode 100644 index 00000000..646f09ea --- /dev/null +++ b/src/api/resources/unstable/resources/articles/types/InternalArticle.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Intercom from "../../../../../index"; + +/** + * The Internal Articles API is a central place to gather all information and take actions on your internal articles. + */ +export type InternalArticle = Intercom.unstable.InternalArticleListItem; diff --git a/src/api/resources/unstable/resources/articles/types/index.ts b/src/api/resources/unstable/resources/articles/types/index.ts index 815412c7..a916b2c1 100644 --- a/src/api/resources/unstable/resources/articles/types/index.ts +++ b/src/api/resources/unstable/resources/articles/types/index.ts @@ -1,4 +1,5 @@ export * from "./Article"; +export * from "./InternalArticle"; export * from "./ArticleListItem"; export * from "./ArticleSearchHighlights"; export * from "./ArticleSearchResponse"; diff --git a/src/api/resources/unstable/resources/awayStatusReasons/client/Client.ts b/src/api/resources/unstable/resources/awayStatusReasons/client/Client.ts index 9ff1532d..a15b3c34 100644 --- a/src/api/resources/unstable/resources/awayStatusReasons/client/Client.ts +++ b/src/api/resources/unstable/resources/awayStatusReasons/client/Client.ts @@ -106,8 +106,8 @@ export class AwayStatusReasons { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, diff --git a/src/api/resources/unstable/resources/brands/client/Client.ts b/src/api/resources/unstable/resources/brands/client/Client.ts new file mode 100644 index 00000000..080517a4 --- /dev/null +++ b/src/api/resources/unstable/resources/brands/client/Client.ts @@ -0,0 +1,259 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../../../environments"; +import * as core from "../../../../../../core"; +import * as Intercom from "../../../../../index"; +import urlJoin from "url-join"; +import * as errors from "../../../../../../errors/index"; + +export declare namespace Brands { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Intercom-Version header */ + version?: + | "1.0" + | "1.1" + | "1.2" + | "1.3" + | "1.4" + | "2.0" + | "2.1" + | "2.2" + | "2.3" + | "2.4" + | "2.5" + | "2.6" + | "2.7" + | "2.8" + | "2.9" + | "2.10" + | "2.11" + | "Unstable"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Additional headers to include in the request. */ + headers?: Record; + /** Override the Intercom-Version header */ + version?: + | "1.0" + | "1.1" + | "1.2" + | "1.3" + | "1.4" + | "2.0" + | "2.1" + | "2.2" + | "2.3" + | "2.4" + | "2.5" + | "2.6" + | "2.7" + | "2.8" + | "2.9" + | "2.10" + | "2.11" + | "Unstable"; + } +} + +/** + * Everything about your Brands + */ +export class Brands { + constructor(protected readonly _options: Brands.Options = {}) {} + + /** + * Retrieves all brands for the workspace, including the default brand. + * The default brand id always matches the workspace + * + * @param {Brands.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Intercom.unstable.UnauthorizedError} + * + * @example + * await client.unstable.brands.listBrands() + */ + public listBrands(requestOptions?: Brands.RequestOptions): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__listBrands(requestOptions)); + } + + private async __listBrands( + requestOptions?: Brands.RequestOptions, + ): Promise> { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + "brands", + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "intercom-client", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", + "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 20000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { data: _response.body as Intercom.unstable.BrandList, rawResponse: _response.rawResponse }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 401: + throw new Intercom.unstable.UnauthorizedError( + _response.error.body as Intercom.unstable.Error_, + _response.rawResponse, + ); + default: + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.IntercomTimeoutError("Timeout exceeded when calling GET /brands."); + case "unknown": + throw new errors.IntercomError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + } + + /** + * Fetches a specific brand by its unique identifier + * + * @param {Intercom.unstable.RetrieveBrandRequest} request + * @param {Brands.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Intercom.unstable.UnauthorizedError} + * @throws {@link Intercom.unstable.NotFoundError} + * + * @example + * await client.unstable.brands.retrieveBrand({ + * id: "id" + * }) + */ + public retrieveBrand( + request: Intercom.unstable.RetrieveBrandRequest, + requestOptions?: Brands.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__retrieveBrand(request, requestOptions)); + } + + private async __retrieveBrand( + request: Intercom.unstable.RetrieveBrandRequest, + requestOptions?: Brands.RequestOptions, + ): Promise> { + const { id } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `brands/${encodeURIComponent(id)}`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "intercom-client", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", + "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 20000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { data: _response.body as Intercom.unstable.Brand, rawResponse: _response.rawResponse }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 401: + throw new Intercom.unstable.UnauthorizedError( + _response.error.body as Intercom.unstable.Error_, + _response.rawResponse, + ); + case 404: + throw new Intercom.unstable.NotFoundError(_response.error.body as unknown, _response.rawResponse); + default: + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.IntercomTimeoutError("Timeout exceeded when calling GET /brands/{id}."); + case "unknown": + throw new errors.IntercomError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["INTERCOM_API_KEY"]; + if (bearer == null) { + throw new errors.IntercomError({ + message: + "Please specify a bearer by either passing it in to the constructor or initializing a INTERCOM_API_KEY environment variable", + }); + } + + return `Bearer ${bearer}`; + } +} diff --git a/src/api/resources/unstable/resources/brands/client/index.ts b/src/api/resources/unstable/resources/brands/client/index.ts new file mode 100644 index 00000000..415726b7 --- /dev/null +++ b/src/api/resources/unstable/resources/brands/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/unstable/resources/brands/client/requests/RetrieveBrandRequest.ts b/src/api/resources/unstable/resources/brands/client/requests/RetrieveBrandRequest.ts new file mode 100644 index 00000000..c072c816 --- /dev/null +++ b/src/api/resources/unstable/resources/brands/client/requests/RetrieveBrandRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * id: "id" + * } + */ +export interface RetrieveBrandRequest { + /** + * The unique identifier of the brand + */ + id: string; +} diff --git a/src/api/resources/unstable/resources/brands/client/requests/index.ts b/src/api/resources/unstable/resources/brands/client/requests/index.ts new file mode 100644 index 00000000..83058a3a --- /dev/null +++ b/src/api/resources/unstable/resources/brands/client/requests/index.ts @@ -0,0 +1 @@ +export { type RetrieveBrandRequest } from "./RetrieveBrandRequest"; diff --git a/src/api/resources/unstable/resources/brands/index.ts b/src/api/resources/unstable/resources/brands/index.ts new file mode 100644 index 00000000..c9240f83 --- /dev/null +++ b/src/api/resources/unstable/resources/brands/index.ts @@ -0,0 +1,2 @@ +export * from "./types"; +export * from "./client"; diff --git a/src/api/resources/unstable/resources/brands/types/Brand.ts b/src/api/resources/unstable/resources/brands/types/Brand.ts new file mode 100644 index 00000000..04fcc03d --- /dev/null +++ b/src/api/resources/unstable/resources/brands/types/Brand.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Represents a branding configuration for the workspace + */ +export interface Brand { + /** The type of object */ + type?: string; + /** Unique brand identifier. For default brand, matches the workspace ID */ + id?: string; + /** Display name of the brand */ + name?: string; + /** Whether this is the workspace's default brand */ + is_default?: boolean; + /** Unix timestamp of brand creation */ + created_at?: number; + /** Unix timestamp of last modification */ + updated_at?: number; + /** Associated help center identifier */ + help_center_id?: string; + /** Default email settings ID for this brand */ + default_address_settings_id?: string; +} diff --git a/src/api/resources/unstable/resources/brands/types/BrandList.ts b/src/api/resources/unstable/resources/brands/types/BrandList.ts new file mode 100644 index 00000000..423c521d --- /dev/null +++ b/src/api/resources/unstable/resources/brands/types/BrandList.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Intercom from "../../../../../index"; + +/** + * A list of brands + */ +export interface BrandList { + /** The type of object */ + type?: string; + data?: Intercom.unstable.Brand[]; +} diff --git a/src/api/resources/unstable/resources/brands/types/index.ts b/src/api/resources/unstable/resources/brands/types/index.ts new file mode 100644 index 00000000..ca3eccfb --- /dev/null +++ b/src/api/resources/unstable/resources/brands/types/index.ts @@ -0,0 +1,2 @@ +export * from "./Brand"; +export * from "./BrandList"; diff --git a/src/api/resources/unstable/resources/calls/client/Client.ts b/src/api/resources/unstable/resources/calls/client/Client.ts new file mode 100644 index 00000000..3d186e84 --- /dev/null +++ b/src/api/resources/unstable/resources/calls/client/Client.ts @@ -0,0 +1,540 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../../../environments"; +import * as core from "../../../../../../core"; +import * as Intercom from "../../../../../index"; +import urlJoin from "url-join"; +import * as errors from "../../../../../../errors/index"; + +export declare namespace Calls { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Intercom-Version header */ + version?: + | "1.0" + | "1.1" + | "1.2" + | "1.3" + | "1.4" + | "2.0" + | "2.1" + | "2.2" + | "2.3" + | "2.4" + | "2.5" + | "2.6" + | "2.7" + | "2.8" + | "2.9" + | "2.10" + | "2.11" + | "Unstable"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Additional headers to include in the request. */ + headers?: Record; + /** Override the Intercom-Version header */ + version?: + | "1.0" + | "1.1" + | "1.2" + | "1.3" + | "1.4" + | "2.0" + | "2.1" + | "2.2" + | "2.3" + | "2.4" + | "2.5" + | "2.6" + | "2.7" + | "2.8" + | "2.9" + | "2.10" + | "2.11" + | "Unstable"; + } +} + +export class Calls { + constructor(protected readonly _options: Calls.Options = {}) {} + + /** + * Retrieve a paginated list of calls. + * + * @param {Intercom.unstable.ListCallsRequest} request + * @param {Calls.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Intercom.unstable.UnauthorizedError} + * + * @example + * await client.unstable.calls.listCalls() + */ + public listCalls( + request: Intercom.unstable.ListCallsRequest = {}, + requestOptions?: Calls.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__listCalls(request, requestOptions)); + } + + private async __listCalls( + request: Intercom.unstable.ListCallsRequest = {}, + requestOptions?: Calls.RequestOptions, + ): Promise> { + const { page, per_page: perPage } = request; + const _queryParams: Record = {}; + if (page != null) { + _queryParams["page"] = page.toString(); + } + + if (perPage != null) { + _queryParams["per_page"] = perPage.toString(); + } + + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + "calls", + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "intercom-client", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", + "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 20000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { data: _response.body as Intercom.unstable.CallList, rawResponse: _response.rawResponse }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 401: + throw new Intercom.unstable.UnauthorizedError( + _response.error.body as Intercom.unstable.Error_, + _response.rawResponse, + ); + default: + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.IntercomTimeoutError("Timeout exceeded when calling GET /calls."); + case "unknown": + throw new errors.IntercomError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + } + + /** + * Retrieve a single call by id. + * + * @param {Intercom.unstable.ShowCallRequest} request + * @param {Calls.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Intercom.unstable.UnauthorizedError} + * @throws {@link Intercom.unstable.NotFoundError} + * + * @example + * await client.unstable.calls.showCall({ + * id: "id" + * }) + */ + public showCall( + request: Intercom.unstable.ShowCallRequest, + requestOptions?: Calls.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__showCall(request, requestOptions)); + } + + private async __showCall( + request: Intercom.unstable.ShowCallRequest, + requestOptions?: Calls.RequestOptions, + ): Promise> { + const { id } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `calls/${encodeURIComponent(id)}`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "intercom-client", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", + "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 20000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { data: _response.body as Intercom.unstable.Call, rawResponse: _response.rawResponse }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 401: + throw new Intercom.unstable.UnauthorizedError( + _response.error.body as Intercom.unstable.Error_, + _response.rawResponse, + ); + case 404: + throw new Intercom.unstable.NotFoundError(_response.error.body as unknown, _response.rawResponse); + default: + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.IntercomTimeoutError("Timeout exceeded when calling GET /calls/{id}."); + case "unknown": + throw new errors.IntercomError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + } + + /** + * Redirects to a signed URL for the call's recording if it exists. + * + * @param {Intercom.unstable.ShowCallRecordingRequest} request + * @param {Calls.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Intercom.unstable.UnauthorizedError} + * @throws {@link Intercom.unstable.NotFoundError} + * + * @example + * await client.unstable.calls.showCallRecording({ + * id: "id" + * }) + */ + public showCallRecording( + request: Intercom.unstable.ShowCallRecordingRequest, + requestOptions?: Calls.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__showCallRecording(request, requestOptions)); + } + + private async __showCallRecording( + request: Intercom.unstable.ShowCallRecordingRequest, + requestOptions?: Calls.RequestOptions, + ): Promise> { + const { id } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `calls/${encodeURIComponent(id)}/recording`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "intercom-client", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", + "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 20000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { data: undefined, rawResponse: _response.rawResponse }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 401: + throw new Intercom.unstable.UnauthorizedError( + _response.error.body as Intercom.unstable.Error_, + _response.rawResponse, + ); + case 404: + throw new Intercom.unstable.NotFoundError(_response.error.body as unknown, _response.rawResponse); + default: + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.IntercomTimeoutError("Timeout exceeded when calling GET /calls/{id}/recording."); + case "unknown": + throw new errors.IntercomError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + } + + /** + * Returns the transcript for the specified call as a downloadable text file. + * + * @param {Intercom.unstable.ShowCallTranscriptRequest} request + * @param {Calls.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Intercom.unstable.NotFoundError} + * + * @example + * await client.unstable.calls.showCallTranscript({ + * id: "id" + * }) + */ + public showCallTranscript( + request: Intercom.unstable.ShowCallTranscriptRequest, + requestOptions?: Calls.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__showCallTranscript(request, requestOptions)); + } + + private async __showCallTranscript( + request: Intercom.unstable.ShowCallTranscriptRequest, + requestOptions?: Calls.RequestOptions, + ): Promise> { + const { id } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `calls/${encodeURIComponent(id)}/transcript`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "intercom-client", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", + "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + responseType: "text", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 20000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { data: _response.body as string, rawResponse: _response.rawResponse }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 404: + throw new Intercom.unstable.NotFoundError(_response.error.body as unknown, _response.rawResponse); + default: + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.IntercomTimeoutError("Timeout exceeded when calling GET /calls/{id}/transcript."); + case "unknown": + throw new errors.IntercomError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + } + + /** + * Retrieve calls by a list of conversation ids and include transcripts when available. + * A maximum of 20 `conversation_ids` can be provided. If none are provided or more than 20 are provided, a 400 error is returned. + * + * @param {Intercom.unstable.ListCallsWithTranscriptsRequest} request + * @param {Calls.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Intercom.unstable.BadRequestError} + * @throws {@link Intercom.unstable.UnauthorizedError} + * + * @example + * await client.unstable.calls.listCallsWithTranscripts({ + * conversation_ids: ["64619700005694", "64619700005695"] + * }) + */ + public listCallsWithTranscripts( + request: Intercom.unstable.ListCallsWithTranscriptsRequest, + requestOptions?: Calls.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__listCallsWithTranscripts(request, requestOptions)); + } + + private async __listCallsWithTranscripts( + request: Intercom.unstable.ListCallsWithTranscriptsRequest, + requestOptions?: Calls.RequestOptions, + ): Promise> { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + "calls/search", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "intercom-client", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", + "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: request, + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 20000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { + data: _response.body as Intercom.unstable.ListCallsWithTranscriptsResponse, + rawResponse: _response.rawResponse, + }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Intercom.unstable.BadRequestError(_response.error.body as unknown, _response.rawResponse); + case 401: + throw new Intercom.unstable.UnauthorizedError( + _response.error.body as Intercom.unstable.Error_, + _response.rawResponse, + ); + default: + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.IntercomTimeoutError("Timeout exceeded when calling POST /calls/search."); + case "unknown": + throw new errors.IntercomError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["INTERCOM_API_KEY"]; + if (bearer == null) { + throw new errors.IntercomError({ + message: + "Please specify a bearer by either passing it in to the constructor or initializing a INTERCOM_API_KEY environment variable", + }); + } + + return `Bearer ${bearer}`; + } +} diff --git a/src/api/resources/unstable/resources/calls/client/index.ts b/src/api/resources/unstable/resources/calls/client/index.ts new file mode 100644 index 00000000..415726b7 --- /dev/null +++ b/src/api/resources/unstable/resources/calls/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/unstable/resources/calls/client/requests/ListCallsRequest.ts b/src/api/resources/unstable/resources/calls/client/requests/ListCallsRequest.ts new file mode 100644 index 00000000..344ffdc6 --- /dev/null +++ b/src/api/resources/unstable/resources/calls/client/requests/ListCallsRequest.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * {} + */ +export interface ListCallsRequest { + /** + * The page of results to fetch. Defaults to first page + */ + page?: number; + /** + * How many results to display per page. Defaults to 25. Max 25. + */ + per_page?: number; +} diff --git a/src/api/resources/unstable/resources/calls/client/requests/ListCallsWithTranscriptsRequest.ts b/src/api/resources/unstable/resources/calls/client/requests/ListCallsWithTranscriptsRequest.ts new file mode 100644 index 00000000..634fceb6 --- /dev/null +++ b/src/api/resources/unstable/resources/calls/client/requests/ListCallsWithTranscriptsRequest.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * conversation_ids: ["64619700005694", "64619700005695"] + * } + */ +export interface ListCallsWithTranscriptsRequest { + /** A list of conversation ids to fetch calls for. Maximum 20. */ + conversation_ids: string[]; +} diff --git a/src/api/resources/unstable/resources/calls/client/requests/ShowCallRecordingRequest.ts b/src/api/resources/unstable/resources/calls/client/requests/ShowCallRecordingRequest.ts new file mode 100644 index 00000000..9bb71fdd --- /dev/null +++ b/src/api/resources/unstable/resources/calls/client/requests/ShowCallRecordingRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * id: "id" + * } + */ +export interface ShowCallRecordingRequest { + /** + * The id of the call + */ + id: string; +} diff --git a/src/api/resources/unstable/resources/calls/client/requests/ShowCallRequest.ts b/src/api/resources/unstable/resources/calls/client/requests/ShowCallRequest.ts new file mode 100644 index 00000000..d64b2249 --- /dev/null +++ b/src/api/resources/unstable/resources/calls/client/requests/ShowCallRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * id: "id" + * } + */ +export interface ShowCallRequest { + /** + * The id of the call to retrieve + */ + id: string; +} diff --git a/src/api/resources/unstable/resources/calls/client/requests/ShowCallTranscriptRequest.ts b/src/api/resources/unstable/resources/calls/client/requests/ShowCallTranscriptRequest.ts new file mode 100644 index 00000000..11b16f1c --- /dev/null +++ b/src/api/resources/unstable/resources/calls/client/requests/ShowCallTranscriptRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * id: "id" + * } + */ +export interface ShowCallTranscriptRequest { + /** + * The id of the call + */ + id: string; +} diff --git a/src/api/resources/unstable/resources/calls/client/requests/index.ts b/src/api/resources/unstable/resources/calls/client/requests/index.ts new file mode 100644 index 00000000..c186bb96 --- /dev/null +++ b/src/api/resources/unstable/resources/calls/client/requests/index.ts @@ -0,0 +1,5 @@ +export { type ListCallsRequest } from "./ListCallsRequest"; +export { type ShowCallRequest } from "./ShowCallRequest"; +export { type ShowCallRecordingRequest } from "./ShowCallRecordingRequest"; +export { type ShowCallTranscriptRequest } from "./ShowCallTranscriptRequest"; +export { type ListCallsWithTranscriptsRequest } from "./ListCallsWithTranscriptsRequest"; diff --git a/src/api/resources/unstable/resources/calls/index.ts b/src/api/resources/unstable/resources/calls/index.ts new file mode 100644 index 00000000..c9240f83 --- /dev/null +++ b/src/api/resources/unstable/resources/calls/index.ts @@ -0,0 +1,2 @@ +export * from "./types"; +export * from "./client"; diff --git a/src/api/resources/unstable/resources/calls/types/Call.ts b/src/api/resources/unstable/resources/calls/types/Call.ts new file mode 100644 index 00000000..1d9a80df --- /dev/null +++ b/src/api/resources/unstable/resources/calls/types/Call.ts @@ -0,0 +1,42 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Intercom from "../../../../../index"; + +/** + * Represents a phone call in Intercom + */ +export interface Call { + /** String representing the object's type. Always has the value `call`. */ + type?: string; + /** The id of the call. */ + id?: string; + /** The id of the conversation associated with the call, if any. */ + conversation_id?: string; + /** The id of the admin associated with the call, if any. */ + admin_id?: string; + /** The id of the contact associated with the call, if any. */ + contact_id?: string; + /** The current state of the call. */ + state?: string; + initiated_at?: Intercom.unstable.Datetime; + answered_at?: Intercom.unstable.Datetime; + ended_at?: Intercom.unstable.Datetime; + created_at?: Intercom.unstable.Datetime; + updated_at?: Intercom.unstable.Datetime; + /** API URL to download or redirect to the call recording if available. */ + recording_url?: string; + /** The type of call. */ + call_type?: string; + /** The direction of the call. */ + direction?: string; + /** The reason for the call end, if applicable. */ + ended_reason?: string; + /** The phone number involved in the call, in E.164 format. */ + phone?: string; + /** API URL to the AI Agent (Fin) call recording if available. */ + fin_recording_url?: string; + /** API URL to the AI Agent (Fin) call transcript if available. */ + fin_transcription_url?: string; +} diff --git a/src/api/resources/unstable/resources/calls/types/ListCallsWithTranscriptsResponse.ts b/src/api/resources/unstable/resources/calls/types/ListCallsWithTranscriptsResponse.ts new file mode 100644 index 00000000..ab1e8d65 --- /dev/null +++ b/src/api/resources/unstable/resources/calls/types/ListCallsWithTranscriptsResponse.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Intercom from "../../../../../index"; + +export interface ListCallsWithTranscriptsResponse { + type?: string; + data?: ListCallsWithTranscriptsResponse.Data.Item[]; +} + +export namespace ListCallsWithTranscriptsResponse { + export type Data = Data.Item[]; + + export namespace Data { + export interface Item extends Intercom.unstable.Call { + /** The call transcript if available, otherwise an empty array. */ + transcript?: Record[]; + /** The status of the transcript if available. */ + transcript_status?: string; + } + } +} diff --git a/src/api/resources/unstable/resources/calls/types/index.ts b/src/api/resources/unstable/resources/calls/types/index.ts new file mode 100644 index 00000000..bd1a1dd3 --- /dev/null +++ b/src/api/resources/unstable/resources/calls/types/index.ts @@ -0,0 +1,2 @@ +export * from "./ListCallsWithTranscriptsResponse"; +export * from "./Call"; diff --git a/src/api/resources/unstable/resources/companies/client/Client.ts b/src/api/resources/unstable/resources/companies/client/Client.ts index b5593293..b17fdf7f 100644 --- a/src/api/resources/unstable/resources/companies/client/Client.ts +++ b/src/api/resources/unstable/resources/companies/client/Client.ts @@ -151,8 +151,8 @@ export class Companies { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -249,8 +249,8 @@ export class Companies { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -340,8 +340,8 @@ export class Companies { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -434,8 +434,8 @@ export class Companies { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -524,8 +524,8 @@ export class Companies { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -617,8 +617,8 @@ export class Companies { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -710,8 +710,8 @@ export class Companies { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -823,8 +823,8 @@ export class Companies { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -928,8 +928,8 @@ export class Companies { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -1034,8 +1034,8 @@ export class Companies { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -1128,8 +1128,8 @@ export class Companies { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, diff --git a/src/api/resources/unstable/resources/contacts/client/Client.ts b/src/api/resources/unstable/resources/contacts/client/Client.ts index 432c912e..4c6f3b86 100644 --- a/src/api/resources/unstable/resources/contacts/client/Client.ts +++ b/src/api/resources/unstable/resources/contacts/client/Client.ts @@ -113,8 +113,8 @@ export class Contacts { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -206,8 +206,8 @@ export class Contacts { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -304,8 +304,8 @@ export class Contacts { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -399,8 +399,8 @@ export class Contacts { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -488,8 +488,8 @@ export class Contacts { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -596,8 +596,8 @@ export class Contacts { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -687,8 +687,8 @@ export class Contacts { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -774,8 +774,8 @@ export class Contacts { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -973,8 +973,8 @@ export class Contacts { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -1059,8 +1059,8 @@ export class Contacts { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -1145,8 +1145,8 @@ export class Contacts { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -1236,8 +1236,8 @@ export class Contacts { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -1326,8 +1326,8 @@ export class Contacts { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -1403,8 +1403,8 @@ export class Contacts { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -1480,8 +1480,8 @@ export class Contacts { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, diff --git a/src/api/resources/unstable/resources/conversations/client/Client.ts b/src/api/resources/unstable/resources/conversations/client/Client.ts index 87442ffe..5485d044 100644 --- a/src/api/resources/unstable/resources/conversations/client/Client.ts +++ b/src/api/resources/unstable/resources/conversations/client/Client.ts @@ -126,8 +126,8 @@ export class Conversations { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -241,8 +241,8 @@ export class Conversations { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -335,12 +335,16 @@ export class Conversations { request: Intercom.unstable.RetrieveConversationRequest, requestOptions?: Conversations.RequestOptions, ): Promise> { - const { id, display_as: displayAs } = request; + const { id, display_as: displayAs, include_translations: includeTranslations } = request; const _queryParams: Record = {}; if (displayAs != null) { _queryParams["display_as"] = displayAs; } + if (includeTranslations != null) { + _queryParams["include_translations"] = includeTranslations.toString(); + } + const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.baseUrl)) ?? @@ -353,8 +357,8 @@ export class Conversations { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -482,8 +486,8 @@ export class Conversations { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -579,8 +583,8 @@ export class Conversations { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -779,8 +783,8 @@ export class Conversations { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -921,8 +925,8 @@ export class Conversations { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -1057,8 +1061,8 @@ export class Conversations { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -1171,8 +1175,8 @@ export class Conversations { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -1277,8 +1281,8 @@ export class Conversations { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -1392,8 +1396,8 @@ export class Conversations { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -1489,8 +1493,8 @@ export class Conversations { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, diff --git a/src/api/resources/unstable/resources/conversations/client/requests/RetrieveConversationRequest.ts b/src/api/resources/unstable/resources/conversations/client/requests/RetrieveConversationRequest.ts index 8849068d..af79928c 100644 --- a/src/api/resources/unstable/resources/conversations/client/requests/RetrieveConversationRequest.ts +++ b/src/api/resources/unstable/resources/conversations/client/requests/RetrieveConversationRequest.ts @@ -18,4 +18,8 @@ export interface RetrieveConversationRequest { * Set to plaintext to retrieve conversation messages in plain text. */ display_as?: string; + /** + * If set to true, conversation parts will be translated to the detected language of the conversation. + */ + include_translations?: boolean; } diff --git a/src/api/resources/unstable/resources/conversations/client/requests/UpdateConversationRequest.ts b/src/api/resources/unstable/resources/conversations/client/requests/UpdateConversationRequest.ts index 76276853..d982c000 100644 --- a/src/api/resources/unstable/resources/conversations/client/requests/UpdateConversationRequest.ts +++ b/src/api/resources/unstable/resources/conversations/client/requests/UpdateConversationRequest.ts @@ -52,4 +52,6 @@ export interface UpdateConversationRequest { /** The title given to the conversation */ title?: string; custom_attributes?: Intercom.unstable.CustomAttributes; + /** The ID of the company that the conversation is associated with. The unique identifier for the company which is given by Intercom. Set to nil to remove company. */ + company_id?: string; } diff --git a/src/api/resources/unstable/resources/conversations/types/Conversation.ts b/src/api/resources/unstable/resources/conversations/types/Conversation.ts index 2531c62d..ef3796e5 100644 --- a/src/api/resources/unstable/resources/conversations/types/Conversation.ts +++ b/src/api/resources/unstable/resources/conversations/types/Conversation.ts @@ -34,6 +34,8 @@ export interface Conversation { admin_assignee_id?: number; /** The id of the team assigned to the conversation. If it's not assigned to a team it will return null. */ team_assignee_id?: string; + /** The ID of the company that the conversation is associated with. The unique identifier for the company which is given by Intercom. */ + company_id?: string; tags?: Intercom.unstable.Tags; conversation_rating?: Intercom.unstable.ConversationRating; source?: Intercom.unstable.ConversationSource; diff --git a/src/api/resources/unstable/resources/customChannelEvents/client/Client.ts b/src/api/resources/unstable/resources/customChannelEvents/client/Client.ts index fab44a35..d848dc3d 100644 --- a/src/api/resources/unstable/resources/customChannelEvents/client/Client.ts +++ b/src/api/resources/unstable/resources/customChannelEvents/client/Client.ts @@ -74,7 +74,7 @@ export class CustomChannelEvents { /** * Notifies Intercom that a new conversation was created in your custom channel/platform. This triggers conversation creation and workflow automations within Intercom for your custom channel integration. - * > **Note:** This endpoint is restricted to customers with access to the closed beta for "Fin over API". + * > **Note:** This endpoint is currently under managed availability. Please reach out to your accounts team to discuss access and tailored, hands-on support. * * @param {Intercom.unstable.CustomChannelBaseEvent} request * @param {CustomChannelEvents.RequestOptions} requestOptions - Request-specific configuration. @@ -119,8 +119,8 @@ export class CustomChannelEvents { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -186,7 +186,7 @@ export class CustomChannelEvents { /** * Notifies Intercom that a new message was sent in a conversation on your custom channel/platform. This allows Intercom to process the message and trigger any relevant workflow automations. - * > **Note:** This endpoint is restricted to customers with access to the closed beta for "Fin over API". + * > **Note:** This endpoint is currently under managed availability. Please reach out to your accounts team to discuss access and tailored, hands-on support. * * @param {Intercom.unstable.NotifyNewMessageRequest} request * @param {CustomChannelEvents.RequestOptions} requestOptions - Request-specific configuration. @@ -232,8 +232,8 @@ export class CustomChannelEvents { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -299,7 +299,7 @@ export class CustomChannelEvents { /** * Notifies Intercom that a user selected a quick reply option in your custom channel/platform. This allows Intercom to process the response and trigger any relevant workflow automations. - * > **Note:** This endpoint is restricted to customers with access to the closed beta for "Fin over API". + * > **Note:** This endpoint is currently under managed availability. Please reach out to your accounts team to discuss access and tailored, hands-on support. * * @param {Intercom.unstable.NotifyQuickReplySelectedRequest} request * @param {CustomChannelEvents.RequestOptions} requestOptions - Request-specific configuration. @@ -345,8 +345,8 @@ export class CustomChannelEvents { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -412,7 +412,7 @@ export class CustomChannelEvents { /** * Notifies Intercom that a user provided a response to an attribute collector in your custom channel/platform. This allows Intercom to process the attribute and trigger any relevant workflow automations. - * > **Note:** This endpoint is restricted to customers with access to the closed beta for "Fin over API". + * > **Note:** This endpoint is currently under managed availability. Please reach out to your accounts team to discuss access and tailored, hands-on support. * * @param {Intercom.unstable.NotifyAttributeCollectedRequest} request * @param {CustomChannelEvents.RequestOptions} requestOptions - Request-specific configuration. @@ -461,8 +461,8 @@ export class CustomChannelEvents { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, diff --git a/src/api/resources/unstable/resources/customObjectInstances/client/Client.ts b/src/api/resources/unstable/resources/customObjectInstances/client/Client.ts index 8d8d1ca5..ffa10ee3 100644 --- a/src/api/resources/unstable/resources/customObjectInstances/client/Client.ts +++ b/src/api/resources/unstable/resources/customObjectInstances/client/Client.ts @@ -121,8 +121,8 @@ export class CustomObjectInstances { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -224,8 +224,8 @@ export class CustomObjectInstances { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -323,8 +323,8 @@ export class CustomObjectInstances { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -420,8 +420,8 @@ export class CustomObjectInstances { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -518,8 +518,8 @@ export class CustomObjectInstances { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, diff --git a/src/api/resources/unstable/resources/dataAttributes/client/Client.ts b/src/api/resources/unstable/resources/dataAttributes/client/Client.ts index 03670ff6..996e0192 100644 --- a/src/api/resources/unstable/resources/dataAttributes/client/Client.ts +++ b/src/api/resources/unstable/resources/dataAttributes/client/Client.ts @@ -119,8 +119,8 @@ export class DataAttributes { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -173,7 +173,7 @@ export class DataAttributes { /** * You can create a data attributes for a `contact` or a `company`. * - * @param {Intercom.unstable.CreateDataAttributeRequest} request + * @param {unknown} request * @param {DataAttributes.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.unstable.BadRequestError} @@ -181,57 +181,18 @@ export class DataAttributes { * * @example * await client.unstable.dataAttributes.createDataAttribute({ - * name: "Mithril Shirt", - * model: "company", - * data_type: "string" - * }) - * - * @example - * await client.unstable.dataAttributes.createDataAttribute({ - * name: "The One Ring", - * model: "contact", - * data_type: "integer" - * }) - * - * @example - * await client.unstable.dataAttributes.createDataAttribute({ - * name: "!nv@l!d n@me", - * model: "company", - * data_type: "string" - * }) - * - * @example - * await client.unstable.dataAttributes.createDataAttribute({ - * name: "The One Ring", - * model: "company", - * data_type: "string" - * }) - * - * @example - * await client.unstable.dataAttributes.createDataAttribute({ - * name: "The Second Ring", - * model: "company", - * data_type: "string" - * }) - * - * @example - * await client.unstable.dataAttributes.createDataAttribute({ - * name: "My Data Attribute", - * model: "contact", - * data_type: "string", - * description: "Just a plain old ring", - * options: ["options"] + * "key": "value" * }) */ public createDataAttribute( - request: Intercom.unstable.CreateDataAttributeRequest, + request?: unknown, requestOptions?: DataAttributes.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__createDataAttribute(request, requestOptions)); } private async __createDataAttribute( - request: Intercom.unstable.CreateDataAttributeRequest, + request?: unknown, requestOptions?: DataAttributes.RequestOptions, ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ @@ -246,8 +207,8 @@ export class DataAttributes { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -318,24 +279,9 @@ export class DataAttributes { * @example * await client.unstable.dataAttributes.updateDataAttribute({ * id: 1, - * archived: false, - * description: "Just a plain old ring", - * options: ["options", "options"] - * }) - * - * @example - * await client.unstable.dataAttributes.updateDataAttribute({ - * id: 1, - * archived: false, - * description: "Too few options", - * options: ["option1", "option2"] - * }) - * - * @example - * await client.unstable.dataAttributes.updateDataAttribute({ - * id: 1, - * archived: true, - * description: "Trying to archieve" + * body: { + * "key": "value" + * } * }) */ public updateDataAttribute( @@ -349,7 +295,7 @@ export class DataAttributes { request: Intercom.unstable.UpdateDataAttributeRequest, requestOptions?: DataAttributes.RequestOptions, ): Promise> { - const { id, ..._body } = request; + const { id, body: _body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.baseUrl)) ?? @@ -362,8 +308,8 @@ export class DataAttributes { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, diff --git a/src/api/resources/unstable/resources/dataAttributes/client/requests/CreateDataAttributeRequest.ts b/src/api/resources/unstable/resources/dataAttributes/client/requests/CreateDataAttributeRequest.ts deleted file mode 100644 index d0856471..00000000 --- a/src/api/resources/unstable/resources/dataAttributes/client/requests/CreateDataAttributeRequest.ts +++ /dev/null @@ -1,86 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -/** - * @example - * { - * name: "Mithril Shirt", - * model: "company", - * data_type: "string" - * } - * - * @example - * { - * name: "The One Ring", - * model: "contact", - * data_type: "integer" - * } - * - * @example - * { - * name: "!nv@l!d n@me", - * model: "company", - * data_type: "string" - * } - * - * @example - * { - * name: "The One Ring", - * model: "company", - * data_type: "string" - * } - * - * @example - * { - * name: "The Second Ring", - * model: "company", - * data_type: "string" - * } - * - * @example - * { - * name: "My Data Attribute", - * model: "contact", - * data_type: "string", - * description: "Just a plain old ring", - * options: ["options"] - * } - */ -export interface CreateDataAttributeRequest { - /** The name of the data attribute. */ - name: string; - /** The model that the data attribute belongs to. */ - model: CreateDataAttributeRequest.Model; - /** The type of data stored for this attribute. */ - data_type: CreateDataAttributeRequest.DataType; - /** The readable description you see in the UI for the attribute. */ - description?: string; - /** To create list attributes. Provide a set of hashes with `value` as the key of the options you want to make. `data_type` must be `string`. */ - options?: string[]; - /** Can this attribute be updated by the Messenger */ - messenger_writable?: boolean; -} - -export namespace CreateDataAttributeRequest { - /** - * The model that the data attribute belongs to. - */ - export type Model = "contact" | "company"; - export const Model = { - Contact: "contact", - Company: "company", - } as const; - /** - * The type of data stored for this attribute. - */ - export type DataType = "string" | "integer" | "float" | "boolean" | "datetime" | "date"; - export const DataType = { - String: "string", - Integer: "integer", - Float: "float", - Boolean: "boolean", - Datetime: "datetime", - Date: "date", - } as const; -} diff --git a/src/api/resources/unstable/resources/dataAttributes/client/requests/UpdateDataAttributeRequest.ts b/src/api/resources/unstable/resources/dataAttributes/client/requests/UpdateDataAttributeRequest.ts index 80ea0b29..530272ae 100644 --- a/src/api/resources/unstable/resources/dataAttributes/client/requests/UpdateDataAttributeRequest.ts +++ b/src/api/resources/unstable/resources/dataAttributes/client/requests/UpdateDataAttributeRequest.ts @@ -6,32 +6,9 @@ * @example * { * id: 1, - * archived: false, - * description: "Just a plain old ring", - * options: ["options", "options"] - * } - * - * @example - * { - * id: 1, - * archived: false, - * description: "Too few options", - * options: ["option1", "option2"] - * } - * - * @example - * { - * id: 1, - * archived: false, - * description: "Just a plain old ring", - * options: ["options", "options"] - * } - * - * @example - * { - * id: 1, - * archived: true, - * description: "Trying to archieve" + * body: { + * "key": "value" + * } * } */ export interface UpdateDataAttributeRequest { @@ -39,12 +16,5 @@ export interface UpdateDataAttributeRequest { * The data attribute id */ id: number; - /** Whether the attribute is to be archived or not. */ - archived?: boolean; - /** The readable description you see in the UI for the attribute. */ - description?: string; - /** To create list attributes. Provide a set of hashes with `value` as the key of the options you want to make. `data_type` must be `string`. */ - options?: string[]; - /** Can this attribute be updated by the Messenger */ - messenger_writable?: boolean; + body?: unknown; } diff --git a/src/api/resources/unstable/resources/dataAttributes/client/requests/index.ts b/src/api/resources/unstable/resources/dataAttributes/client/requests/index.ts index 5b0976fe..60cfa27e 100644 --- a/src/api/resources/unstable/resources/dataAttributes/client/requests/index.ts +++ b/src/api/resources/unstable/resources/dataAttributes/client/requests/index.ts @@ -1,3 +1,2 @@ export { type LisDataAttributesRequest } from "./LisDataAttributesRequest"; -export { type CreateDataAttributeRequest } from "./CreateDataAttributeRequest"; export { type UpdateDataAttributeRequest } from "./UpdateDataAttributeRequest"; diff --git a/src/api/resources/unstable/resources/dataEvents/client/Client.ts b/src/api/resources/unstable/resources/dataEvents/client/Client.ts index 7349e445..838a505b 100644 --- a/src/api/resources/unstable/resources/dataEvents/client/Client.ts +++ b/src/api/resources/unstable/resources/dataEvents/client/Client.ts @@ -136,8 +136,8 @@ export class DataEvents { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -263,8 +263,8 @@ export class DataEvents { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -348,8 +348,8 @@ export class DataEvents { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, diff --git a/src/api/resources/unstable/resources/dataExport/client/Client.ts b/src/api/resources/unstable/resources/dataExport/client/Client.ts index 6f6a2ebe..e5c84f8f 100644 --- a/src/api/resources/unstable/resources/dataExport/client/Client.ts +++ b/src/api/resources/unstable/resources/dataExport/client/Client.ts @@ -124,8 +124,8 @@ export class DataExport { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -206,8 +206,8 @@ export class DataExport { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -285,8 +285,8 @@ export class DataExport { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -370,8 +370,8 @@ export class DataExport { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, diff --git a/src/api/resources/unstable/resources/emails/client/Client.ts b/src/api/resources/unstable/resources/emails/client/Client.ts new file mode 100644 index 00000000..5a5e61b8 --- /dev/null +++ b/src/api/resources/unstable/resources/emails/client/Client.ts @@ -0,0 +1,258 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../../../environments"; +import * as core from "../../../../../../core"; +import * as Intercom from "../../../../../index"; +import urlJoin from "url-join"; +import * as errors from "../../../../../../errors/index"; + +export declare namespace Emails { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Intercom-Version header */ + version?: + | "1.0" + | "1.1" + | "1.2" + | "1.3" + | "1.4" + | "2.0" + | "2.1" + | "2.2" + | "2.3" + | "2.4" + | "2.5" + | "2.6" + | "2.7" + | "2.8" + | "2.9" + | "2.10" + | "2.11" + | "Unstable"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Additional headers to include in the request. */ + headers?: Record; + /** Override the Intercom-Version header */ + version?: + | "1.0" + | "1.1" + | "1.2" + | "1.3" + | "1.4" + | "2.0" + | "2.1" + | "2.2" + | "2.3" + | "2.4" + | "2.5" + | "2.6" + | "2.7" + | "2.8" + | "2.9" + | "2.10" + | "2.11" + | "Unstable"; + } +} + +/** + * Everything about your Emails + */ +export class Emails { + constructor(protected readonly _options: Emails.Options = {}) {} + + /** + * Lists all sender email address settings for the workspace + * + * @param {Emails.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Intercom.unstable.UnauthorizedError} + * + * @example + * await client.unstable.emails.listEmails() + */ + public listEmails(requestOptions?: Emails.RequestOptions): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__listEmails(requestOptions)); + } + + private async __listEmails( + requestOptions?: Emails.RequestOptions, + ): Promise> { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + "emails", + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "intercom-client", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", + "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 20000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { data: _response.body as Intercom.unstable.EmailList, rawResponse: _response.rawResponse }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 401: + throw new Intercom.unstable.UnauthorizedError( + _response.error.body as Intercom.unstable.Error_, + _response.rawResponse, + ); + default: + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.IntercomTimeoutError("Timeout exceeded when calling GET /emails."); + case "unknown": + throw new errors.IntercomError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + } + + /** + * Fetches a specific email setting by its unique identifier + * + * @param {Intercom.unstable.RetrieveEmailRequest} request + * @param {Emails.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Intercom.unstable.UnauthorizedError} + * @throws {@link Intercom.unstable.NotFoundError} + * + * @example + * await client.unstable.emails.retrieveEmail({ + * id: "id" + * }) + */ + public retrieveEmail( + request: Intercom.unstable.RetrieveEmailRequest, + requestOptions?: Emails.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__retrieveEmail(request, requestOptions)); + } + + private async __retrieveEmail( + request: Intercom.unstable.RetrieveEmailRequest, + requestOptions?: Emails.RequestOptions, + ): Promise> { + const { id } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `emails/${encodeURIComponent(id)}`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "intercom-client", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", + "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 20000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { data: _response.body as Intercom.unstable.EmailSetting, rawResponse: _response.rawResponse }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 401: + throw new Intercom.unstable.UnauthorizedError( + _response.error.body as Intercom.unstable.Error_, + _response.rawResponse, + ); + case 404: + throw new Intercom.unstable.NotFoundError(_response.error.body as unknown, _response.rawResponse); + default: + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.IntercomTimeoutError("Timeout exceeded when calling GET /emails/{id}."); + case "unknown": + throw new errors.IntercomError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["INTERCOM_API_KEY"]; + if (bearer == null) { + throw new errors.IntercomError({ + message: + "Please specify a bearer by either passing it in to the constructor or initializing a INTERCOM_API_KEY environment variable", + }); + } + + return `Bearer ${bearer}`; + } +} diff --git a/src/api/resources/unstable/resources/emails/client/index.ts b/src/api/resources/unstable/resources/emails/client/index.ts new file mode 100644 index 00000000..415726b7 --- /dev/null +++ b/src/api/resources/unstable/resources/emails/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/unstable/resources/emails/client/requests/RetrieveEmailRequest.ts b/src/api/resources/unstable/resources/emails/client/requests/RetrieveEmailRequest.ts new file mode 100644 index 00000000..27e8305f --- /dev/null +++ b/src/api/resources/unstable/resources/emails/client/requests/RetrieveEmailRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * id: "id" + * } + */ +export interface RetrieveEmailRequest { + /** + * The unique identifier of the email setting + */ + id: string; +} diff --git a/src/api/resources/unstable/resources/emails/client/requests/index.ts b/src/api/resources/unstable/resources/emails/client/requests/index.ts new file mode 100644 index 00000000..f2fbbcca --- /dev/null +++ b/src/api/resources/unstable/resources/emails/client/requests/index.ts @@ -0,0 +1 @@ +export { type RetrieveEmailRequest } from "./RetrieveEmailRequest"; diff --git a/src/api/resources/unstable/resources/emails/index.ts b/src/api/resources/unstable/resources/emails/index.ts new file mode 100644 index 00000000..c9240f83 --- /dev/null +++ b/src/api/resources/unstable/resources/emails/index.ts @@ -0,0 +1,2 @@ +export * from "./types"; +export * from "./client"; diff --git a/src/api/resources/unstable/resources/emails/types/EmailList.ts b/src/api/resources/unstable/resources/emails/types/EmailList.ts new file mode 100644 index 00000000..4ffb5b4a --- /dev/null +++ b/src/api/resources/unstable/resources/emails/types/EmailList.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Intercom from "../../../../../index"; + +/** + * A list of email settings + */ +export interface EmailList { + /** The type of object */ + type?: string; + data?: Intercom.unstable.EmailSetting[]; +} diff --git a/src/api/resources/unstable/resources/emails/types/EmailSetting.ts b/src/api/resources/unstable/resources/emails/types/EmailSetting.ts new file mode 100644 index 00000000..5369b7f1 --- /dev/null +++ b/src/api/resources/unstable/resources/emails/types/EmailSetting.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Represents a sender email address configuration + */ +export interface EmailSetting { + /** The type of object */ + type?: string; + /** Unique email setting identifier */ + id?: string; + /** Full sender email address */ + email?: string; + /** Whether the email address has been verified */ + verified?: boolean; + /** Domain portion of the email address */ + domain?: string; + /** Associated brand identifier */ + brand_id?: string; + /** Whether email forwarding is active */ + forwarding_enabled?: boolean; + /** Unix timestamp of last forwarded email received (null if never) */ + forwarded_email_last_received_at?: number; + /** Unix timestamp of creation */ + created_at?: number; + /** Unix timestamp of last modification */ + updated_at?: number; +} diff --git a/src/api/resources/unstable/resources/emails/types/index.ts b/src/api/resources/unstable/resources/emails/types/index.ts new file mode 100644 index 00000000..9444890e --- /dev/null +++ b/src/api/resources/unstable/resources/emails/types/index.ts @@ -0,0 +1,2 @@ +export * from "./EmailSetting"; +export * from "./EmailList"; diff --git a/src/api/resources/unstable/resources/export/client/Client.ts b/src/api/resources/unstable/resources/export/client/Client.ts index b067f559..48db48d1 100644 --- a/src/api/resources/unstable/resources/export/client/Client.ts +++ b/src/api/resources/unstable/resources/export/client/Client.ts @@ -83,7 +83,7 @@ export class Export { * @example * await client.unstable.export.enqueueANewReportingDataExportJob({ * dataset_id: "conversation", - * attribute_ids: ["conversation.id", "conversation.first_user_conversation_part_created_at"], + * attribute_ids: ["conversation_id", "conversation_started_at"], * start_time: 1717490000, * end_time: 1717510000 * }) @@ -111,8 +111,8 @@ export class Export { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -201,8 +201,8 @@ export class Export { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, diff --git a/src/api/resources/unstable/resources/export/client/requests/PostExportReportingDataEnqueueRequest.ts b/src/api/resources/unstable/resources/export/client/requests/PostExportReportingDataEnqueueRequest.ts index 55c7d4f8..3a4d33e1 100644 --- a/src/api/resources/unstable/resources/export/client/requests/PostExportReportingDataEnqueueRequest.ts +++ b/src/api/resources/unstable/resources/export/client/requests/PostExportReportingDataEnqueueRequest.ts @@ -6,7 +6,7 @@ * @example * { * dataset_id: "conversation", - * attribute_ids: ["conversation.id", "conversation.first_user_conversation_part_created_at"], + * attribute_ids: ["conversation_id", "conversation_started_at"], * start_time: 1717490000, * end_time: 1717510000 * } diff --git a/src/api/resources/unstable/resources/helpCenter/client/Client.ts b/src/api/resources/unstable/resources/helpCenter/client/Client.ts index 776053b4..99d4e522 100644 --- a/src/api/resources/unstable/resources/helpCenter/client/Client.ts +++ b/src/api/resources/unstable/resources/helpCenter/client/Client.ts @@ -108,8 +108,8 @@ export class HelpCenter { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -201,8 +201,8 @@ export class HelpCenter { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -292,8 +292,8 @@ export class HelpCenter { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -385,8 +385,8 @@ export class HelpCenter { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -478,8 +478,8 @@ export class HelpCenter { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -573,8 +573,8 @@ export class HelpCenter { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -658,8 +658,8 @@ export class HelpCenter { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, diff --git a/src/api/resources/unstable/resources/helpCenter/types/HelpCenter.ts b/src/api/resources/unstable/resources/helpCenter/types/HelpCenter.ts index 30cba20e..9a8a55c5 100644 --- a/src/api/resources/unstable/resources/helpCenter/types/HelpCenter.ts +++ b/src/api/resources/unstable/resources/helpCenter/types/HelpCenter.ts @@ -20,4 +20,8 @@ export interface HelpCenter { website_turned_on?: boolean; /** The display name of the Help Center only seen by teammates. */ display_name?: string; + /** The URL for the help center, if you have a custom domain then this will show the URL using the custom domain. */ + url?: string; + /** Custom domain configured for the help center */ + custom_domain?: string; } diff --git a/src/api/resources/unstable/resources/index.ts b/src/api/resources/unstable/resources/index.ts index a7c8f375..1666272e 100644 --- a/src/api/resources/unstable/resources/index.ts +++ b/src/api/resources/unstable/resources/index.ts @@ -8,6 +8,8 @@ export * as export_ from "./export"; export * from "./export/types"; export * as helpCenter from "./helpCenter"; export * from "./helpCenter/types"; +export * as internalArticles from "./internalArticles"; +export * from "./internalArticles/types"; export * as companies from "./companies"; export * from "./companies/types"; export * as contacts from "./contacts"; @@ -30,16 +32,24 @@ export * as dataExport from "./dataExport"; export * from "./dataExport/types"; export * as jobs from "./jobs"; export * from "./jobs/types"; +export * as macros from "./macros"; +export * from "./macros/types"; export * as messages from "./messages"; export * from "./messages/types"; export * as news from "./news"; export * from "./news/types"; export * as segments from "./segments"; export * from "./segments/types"; +export * as calls from "./calls"; +export * from "./calls/types"; export * as teams from "./teams"; export * from "./teams/types"; export * as tickets from "./tickets"; export * from "./tickets/types"; +export * as brands from "./brands"; +export * from "./brands/types"; +export * as emails from "./emails"; +export * from "./emails/types"; export * as aiAgent from "./aiAgent"; export * from "./aiAgent/types"; export * as aiContentSource from "./aiContentSource"; @@ -56,6 +66,7 @@ export * from "./aiContent/client/requests"; export * from "./articles/client/requests"; export * from "./export/client/requests"; export * from "./helpCenter/client/requests"; +export * from "./internalArticles/client/requests"; export * from "./companies/client/requests"; export * from "./contacts/client/requests"; export * from "./notes/client/requests"; @@ -68,11 +79,15 @@ export * from "./dataAttributes/client/requests"; export * from "./dataEvents/client/requests"; export * from "./dataExport/client/requests"; export * from "./jobs/client/requests"; +export * from "./macros/client/requests"; export * from "./messages/client/requests"; export * from "./news/client/requests"; export * from "./segments/client/requests"; +export * from "./calls/client/requests"; export * from "./teams/client/requests"; export * from "./ticketTypeAttributes/client/requests"; export * from "./ticketTypes/client/requests"; export * from "./tickets/client/requests"; export * from "./visitors/client/requests"; +export * from "./brands/client/requests"; +export * from "./emails/client/requests"; diff --git a/src/api/resources/unstable/resources/internalArticles/client/Client.ts b/src/api/resources/unstable/resources/internalArticles/client/Client.ts new file mode 100644 index 00000000..13304cc2 --- /dev/null +++ b/src/api/resources/unstable/resources/internalArticles/client/Client.ts @@ -0,0 +1,644 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../../../environments"; +import * as core from "../../../../../../core"; +import * as Intercom from "../../../../../index"; +import urlJoin from "url-join"; +import * as errors from "../../../../../../errors/index"; + +export declare namespace InternalArticles { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Intercom-Version header */ + version?: + | "1.0" + | "1.1" + | "1.2" + | "1.3" + | "1.4" + | "2.0" + | "2.1" + | "2.2" + | "2.3" + | "2.4" + | "2.5" + | "2.6" + | "2.7" + | "2.8" + | "2.9" + | "2.10" + | "2.11" + | "Unstable"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Additional headers to include in the request. */ + headers?: Record; + /** Override the Intercom-Version header */ + version?: + | "1.0" + | "1.1" + | "1.2" + | "1.3" + | "1.4" + | "2.0" + | "2.1" + | "2.2" + | "2.3" + | "2.4" + | "2.5" + | "2.6" + | "2.7" + | "2.8" + | "2.9" + | "2.10" + | "2.11" + | "Unstable"; + } +} + +/** + * Everything about your Internal Articles + */ +export class InternalArticles { + constructor(protected readonly _options: InternalArticles.Options = {}) {} + + /** + * You can fetch a list of all internal articles by making a GET request to `https://api.intercom.io/internal_articles`. + * + * @param {InternalArticles.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Intercom.unstable.UnauthorizedError} + * + * @example + * await client.unstable.internalArticles.listInternalArticles() + */ + public listInternalArticles( + requestOptions?: InternalArticles.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__listInternalArticles(requestOptions)); + } + + private async __listInternalArticles( + requestOptions?: InternalArticles.RequestOptions, + ): Promise> { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + "internal_articles", + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "intercom-client", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", + "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 20000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { + data: _response.body as Intercom.unstable.InternalArticleList, + rawResponse: _response.rawResponse, + }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 401: + throw new Intercom.unstable.UnauthorizedError( + _response.error.body as Intercom.unstable.Error_, + _response.rawResponse, + ); + default: + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.IntercomTimeoutError("Timeout exceeded when calling GET /internal_articles."); + case "unknown": + throw new errors.IntercomError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + } + + /** + * You can create a new internal article by making a POST request to `https://api.intercom.io/internal_articles`. + * + * @param {Intercom.unstable.CreateInternalArticleRequest} request + * @param {InternalArticles.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Intercom.unstable.BadRequestError} + * @throws {@link Intercom.unstable.UnauthorizedError} + * + * @example + * await client.unstable.internalArticles.createInternalArticle({ + * title: "Thanks for everything", + * body: "Body of the Article", + * author_id: 991266252, + * owner_id: 991266252 + * }) + * + * @example + * await client.unstable.internalArticles.createInternalArticle({ + * title: "Thanks for everything", + * body: "Body of the Internal Article", + * author_id: 1295, + * owner_id: 1295 + * }) + */ + public createInternalArticle( + request?: Intercom.unstable.CreateInternalArticleRequest, + requestOptions?: InternalArticles.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__createInternalArticle(request, requestOptions)); + } + + private async __createInternalArticle( + request?: Intercom.unstable.CreateInternalArticleRequest, + requestOptions?: InternalArticles.RequestOptions, + ): Promise> { + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + "internal_articles", + ), + method: "POST", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "intercom-client", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", + "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: request != null ? request : undefined, + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 20000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { data: _response.body as Intercom.unstable.InternalArticle, rawResponse: _response.rawResponse }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Intercom.unstable.BadRequestError(_response.error.body as unknown, _response.rawResponse); + case 401: + throw new Intercom.unstable.UnauthorizedError( + _response.error.body as Intercom.unstable.Error_, + _response.rawResponse, + ); + default: + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.IntercomTimeoutError("Timeout exceeded when calling POST /internal_articles."); + case "unknown": + throw new errors.IntercomError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + } + + /** + * You can fetch the details of a single internal article by making a GET request to `https://api.intercom.io/internal_articles/`. + * + * @param {Intercom.unstable.RetrieveInternalArticleRequest} request + * @param {InternalArticles.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Intercom.unstable.UnauthorizedError} + * @throws {@link Intercom.unstable.NotFoundError} + * + * @example + * await client.unstable.internalArticles.retrieveInternalArticle({ + * id: 1 + * }) + */ + public retrieveInternalArticle( + request: Intercom.unstable.RetrieveInternalArticleRequest, + requestOptions?: InternalArticles.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__retrieveInternalArticle(request, requestOptions)); + } + + private async __retrieveInternalArticle( + request: Intercom.unstable.RetrieveInternalArticleRequest, + requestOptions?: InternalArticles.RequestOptions, + ): Promise> { + const { id } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `internal_articles/${encodeURIComponent(id)}`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "intercom-client", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", + "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 20000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { data: _response.body as Intercom.unstable.InternalArticle, rawResponse: _response.rawResponse }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 401: + throw new Intercom.unstable.UnauthorizedError( + _response.error.body as Intercom.unstable.Error_, + _response.rawResponse, + ); + case 404: + throw new Intercom.unstable.NotFoundError(_response.error.body as unknown, _response.rawResponse); + default: + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.IntercomTimeoutError("Timeout exceeded when calling GET /internal_articles/{id}."); + case "unknown": + throw new errors.IntercomError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + } + + /** + * You can update the details of a single internal article by making a PUT request to `https://api.intercom.io/internal_articles/`. + * + * @param {Intercom.unstable.UpdateInternalArticleRequestBody} request + * @param {InternalArticles.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Intercom.unstable.UnauthorizedError} + * @throws {@link Intercom.unstable.NotFoundError} + * + * @example + * await client.unstable.internalArticles.updateInternalArticle({ + * id: 1, + * title: "Christmas is here!", + * body: "

New gifts in store for the jolly season

" + * }) + */ + public updateInternalArticle( + request: Intercom.unstable.UpdateInternalArticleRequestBody, + requestOptions?: InternalArticles.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__updateInternalArticle(request, requestOptions)); + } + + private async __updateInternalArticle( + request: Intercom.unstable.UpdateInternalArticleRequestBody, + requestOptions?: InternalArticles.RequestOptions, + ): Promise> { + const { id, ..._body } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `internal_articles/${encodeURIComponent(id)}`, + ), + method: "PUT", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "intercom-client", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", + "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + body: _body, + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 20000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { data: _response.body as Intercom.unstable.InternalArticle, rawResponse: _response.rawResponse }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 401: + throw new Intercom.unstable.UnauthorizedError( + _response.error.body as Intercom.unstable.Error_, + _response.rawResponse, + ); + case 404: + throw new Intercom.unstable.NotFoundError(_response.error.body as unknown, _response.rawResponse); + default: + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.IntercomTimeoutError("Timeout exceeded when calling PUT /internal_articles/{id}."); + case "unknown": + throw new errors.IntercomError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + } + + /** + * You can delete a single internal article by making a DELETE request to `https://api.intercom.io/internal_articles/`. + * + * @param {Intercom.unstable.DeleteInternalArticleRequest} request + * @param {InternalArticles.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Intercom.unstable.UnauthorizedError} + * @throws {@link Intercom.unstable.NotFoundError} + * + * @example + * await client.unstable.internalArticles.deleteInternalArticle({ + * id: 1 + * }) + */ + public deleteInternalArticle( + request: Intercom.unstable.DeleteInternalArticleRequest, + requestOptions?: InternalArticles.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__deleteInternalArticle(request, requestOptions)); + } + + private async __deleteInternalArticle( + request: Intercom.unstable.DeleteInternalArticleRequest, + requestOptions?: InternalArticles.RequestOptions, + ): Promise> { + const { id } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `internal_articles/${encodeURIComponent(id)}`, + ), + method: "DELETE", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "intercom-client", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", + "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 20000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { + data: _response.body as Intercom.unstable.DeletedInternalArticleObject, + rawResponse: _response.rawResponse, + }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 401: + throw new Intercom.unstable.UnauthorizedError( + _response.error.body as Intercom.unstable.Error_, + _response.rawResponse, + ); + case 404: + throw new Intercom.unstable.NotFoundError(_response.error.body as unknown, _response.rawResponse); + default: + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.IntercomTimeoutError("Timeout exceeded when calling DELETE /internal_articles/{id}."); + case "unknown": + throw new errors.IntercomError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + } + + /** + * You can search for internal articles by making a GET request to `https://api.intercom.io/internal_articles/search`. + * + * @param {Intercom.unstable.SearchInternalArticlesRequest} request + * @param {InternalArticles.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Intercom.unstable.UnauthorizedError} + * + * @example + * await client.unstable.internalArticles.searchInternalArticles() + */ + public searchInternalArticles( + request: Intercom.unstable.SearchInternalArticlesRequest = {}, + requestOptions?: InternalArticles.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__searchInternalArticles(request, requestOptions)); + } + + private async __searchInternalArticles( + request: Intercom.unstable.SearchInternalArticlesRequest = {}, + requestOptions?: InternalArticles.RequestOptions, + ): Promise> { + const { folder_id: folderId } = request; + const _queryParams: Record = {}; + if (folderId != null) { + _queryParams["folder_id"] = folderId; + } + + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + "internal_articles/search", + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "intercom-client", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", + "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 20000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { + data: _response.body as Intercom.unstable.InternalArticleSearchResponse, + rawResponse: _response.rawResponse, + }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 401: + throw new Intercom.unstable.UnauthorizedError( + _response.error.body as Intercom.unstable.Error_, + _response.rawResponse, + ); + default: + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.IntercomTimeoutError("Timeout exceeded when calling GET /internal_articles/search."); + case "unknown": + throw new errors.IntercomError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["INTERCOM_API_KEY"]; + if (bearer == null) { + throw new errors.IntercomError({ + message: + "Please specify a bearer by either passing it in to the constructor or initializing a INTERCOM_API_KEY environment variable", + }); + } + + return `Bearer ${bearer}`; + } +} diff --git a/src/api/resources/unstable/resources/internalArticles/client/index.ts b/src/api/resources/unstable/resources/internalArticles/client/index.ts new file mode 100644 index 00000000..415726b7 --- /dev/null +++ b/src/api/resources/unstable/resources/internalArticles/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/unstable/resources/internalArticles/client/requests/DeleteInternalArticleRequest.ts b/src/api/resources/unstable/resources/internalArticles/client/requests/DeleteInternalArticleRequest.ts new file mode 100644 index 00000000..8a6d4f19 --- /dev/null +++ b/src/api/resources/unstable/resources/internalArticles/client/requests/DeleteInternalArticleRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * id: 1 + * } + */ +export interface DeleteInternalArticleRequest { + /** + * The unique identifier for the internal article which is given by Intercom. + */ + id: number; +} diff --git a/src/api/resources/unstable/resources/internalArticles/client/requests/RetrieveInternalArticleRequest.ts b/src/api/resources/unstable/resources/internalArticles/client/requests/RetrieveInternalArticleRequest.ts new file mode 100644 index 00000000..021be526 --- /dev/null +++ b/src/api/resources/unstable/resources/internalArticles/client/requests/RetrieveInternalArticleRequest.ts @@ -0,0 +1,16 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * id: 1 + * } + */ +export interface RetrieveInternalArticleRequest { + /** + * The unique identifier for the article which is given by Intercom. + */ + id: number; +} diff --git a/src/api/resources/unstable/resources/internalArticles/client/requests/SearchInternalArticlesRequest.ts b/src/api/resources/unstable/resources/internalArticles/client/requests/SearchInternalArticlesRequest.ts new file mode 100644 index 00000000..8f67cd7e --- /dev/null +++ b/src/api/resources/unstable/resources/internalArticles/client/requests/SearchInternalArticlesRequest.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * {} + */ +export interface SearchInternalArticlesRequest { + /** + * The ID of the folder to search in. + */ + folder_id?: string; +} diff --git a/src/api/resources/unstable/resources/internalArticles/client/requests/UpdateInternalArticleRequestBody.ts b/src/api/resources/unstable/resources/internalArticles/client/requests/UpdateInternalArticleRequestBody.ts new file mode 100644 index 00000000..c1523d70 --- /dev/null +++ b/src/api/resources/unstable/resources/internalArticles/client/requests/UpdateInternalArticleRequestBody.ts @@ -0,0 +1,33 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * id: 1, + * title: "Christmas is here!", + * body: "

New gifts in store for the jolly season

" + * } + * + * @example + * { + * id: 1, + * title: "Christmas is here!", + * body: "

New gifts in store for the jolly season

" + * } + */ +export interface UpdateInternalArticleRequestBody { + /** + * The unique identifier for the internal article which is given by Intercom. + */ + id: number; + /** The title of the article. */ + title?: string; + /** The content of the article. */ + body?: string; + /** The id of the author of the article. */ + author_id?: number; + /** The id of the author of the article. */ + owner_id?: number; +} diff --git a/src/api/resources/unstable/resources/internalArticles/client/requests/index.ts b/src/api/resources/unstable/resources/internalArticles/client/requests/index.ts new file mode 100644 index 00000000..7620bb3a --- /dev/null +++ b/src/api/resources/unstable/resources/internalArticles/client/requests/index.ts @@ -0,0 +1,4 @@ +export { type RetrieveInternalArticleRequest } from "./RetrieveInternalArticleRequest"; +export { type UpdateInternalArticleRequestBody } from "./UpdateInternalArticleRequestBody"; +export { type DeleteInternalArticleRequest } from "./DeleteInternalArticleRequest"; +export { type SearchInternalArticlesRequest } from "./SearchInternalArticlesRequest"; diff --git a/src/api/resources/unstable/resources/internalArticles/index.ts b/src/api/resources/unstable/resources/internalArticles/index.ts new file mode 100644 index 00000000..c9240f83 --- /dev/null +++ b/src/api/resources/unstable/resources/internalArticles/index.ts @@ -0,0 +1,2 @@ +export * from "./types"; +export * from "./client"; diff --git a/src/api/resources/unstable/resources/internalArticles/types/InternalArticleListItem.ts b/src/api/resources/unstable/resources/internalArticles/types/InternalArticleListItem.ts new file mode 100644 index 00000000..36d72e78 --- /dev/null +++ b/src/api/resources/unstable/resources/internalArticles/types/InternalArticleListItem.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * The data returned about your internal articles when you list them. + */ +export interface InternalArticleListItem { + /** The type of object - `internal_article`. */ + type?: "internal_article"; + /** The unique identifier for the article which is given by Intercom. */ + id?: string; + /** The title of the article. */ + title?: string; + /** The body of the article in HTML. */ + body?: string; + /** The id of the owner of the article. */ + owner_id?: number; + /** The id of the author of the article. */ + author_id?: number; + /** The time when the article was created. */ + created_at?: number; + /** The time when the article was last updated. */ + updated_at?: number; + /** The default locale of the article. */ + locale?: string; +} diff --git a/src/api/resources/unstable/resources/internalArticles/types/InternalArticleSearchResponse.ts b/src/api/resources/unstable/resources/internalArticles/types/InternalArticleSearchResponse.ts new file mode 100644 index 00000000..921eda80 --- /dev/null +++ b/src/api/resources/unstable/resources/internalArticles/types/InternalArticleSearchResponse.ts @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Intercom from "../../../../../index"; + +/** + * The results of an Internal Article search + */ +export interface InternalArticleSearchResponse { + /** The type of the object - `list`. */ + type?: "list"; + /** The total number of Internal Articles matching the search query */ + total_count?: number; + /** An object containing the results of the search. */ + data?: InternalArticleSearchResponse.Data; + pages?: Intercom.unstable.CursorPages; +} + +export namespace InternalArticleSearchResponse { + /** + * An object containing the results of the search. + */ + export interface Data { + /** An array of Internal Article objects */ + internal_articles?: Intercom.unstable.InternalArticle[]; + } +} diff --git a/src/api/resources/unstable/resources/internalArticles/types/index.ts b/src/api/resources/unstable/resources/internalArticles/types/index.ts new file mode 100644 index 00000000..f27b4e44 --- /dev/null +++ b/src/api/resources/unstable/resources/internalArticles/types/index.ts @@ -0,0 +1,2 @@ +export * from "./InternalArticleListItem"; +export * from "./InternalArticleSearchResponse"; diff --git a/src/api/resources/unstable/resources/jobs/client/Client.ts b/src/api/resources/unstable/resources/jobs/client/Client.ts index 3c114bdf..61939bc9 100644 --- a/src/api/resources/unstable/resources/jobs/client/Client.ts +++ b/src/api/resources/unstable/resources/jobs/client/Client.ts @@ -113,8 +113,8 @@ export class Jobs { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, diff --git a/src/api/resources/unstable/resources/macros/client/Client.ts b/src/api/resources/unstable/resources/macros/client/Client.ts new file mode 100644 index 00000000..f0e04b46 --- /dev/null +++ b/src/api/resources/unstable/resources/macros/client/Client.ts @@ -0,0 +1,323 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as environments from "../../../../../../environments"; +import * as core from "../../../../../../core"; +import * as Intercom from "../../../../../index"; +import urlJoin from "url-join"; +import * as errors from "../../../../../../errors/index"; + +export declare namespace Macros { + export interface Options { + environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; + token?: core.Supplier; + /** Override the Intercom-Version header */ + version?: + | "1.0" + | "1.1" + | "1.2" + | "1.3" + | "1.4" + | "2.0" + | "2.1" + | "2.2" + | "2.3" + | "2.4" + | "2.5" + | "2.6" + | "2.7" + | "2.8" + | "2.9" + | "2.10" + | "2.11" + | "Unstable"; + fetcher?: core.FetchFunction; + } + + export interface RequestOptions { + /** The maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** The number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A hook to abort the request. */ + abortSignal?: AbortSignal; + /** Additional headers to include in the request. */ + headers?: Record; + /** Override the Intercom-Version header */ + version?: + | "1.0" + | "1.1" + | "1.2" + | "1.3" + | "1.4" + | "2.0" + | "2.1" + | "2.2" + | "2.3" + | "2.4" + | "2.5" + | "2.6" + | "2.7" + | "2.8" + | "2.9" + | "2.10" + | "2.11" + | "Unstable"; + } +} + +/** + * Operations related to saved replies (macros) in conversations + */ +export class Macros { + constructor(protected readonly _options: Macros.Options = {}) {} + + /** + * You can fetch a list of all macros (saved replies) in your workspace for use in automating responses. + * + * The macros are returned in descending order by updated_at. + * + * **Pagination** + * + * This endpoint uses cursor-based pagination via the `starting_after` parameter. The cursor is a Base64-encoded JSON array containing `[updated_at, id]` of the last item from the previous page. + * + * **Placeholder Transformation** + * + * The API transforms Intercom placeholders to a more standard XML-like format: + * - From: `{{user.name | fallback: 'there'}}` + * - To: `` + * + * @param {Intercom.unstable.ListMacrosRequest} request + * @param {Macros.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Intercom.unstable.BadRequestError} + * @throws {@link Intercom.unstable.UnauthorizedError} + * @throws {@link Intercom.unstable.ForbiddenError} + * + * @example + * await client.unstable.macros.listMacros({ + * starting_after: "WzE3MTk0OTM3NTcuMCwgIjEyMyJd" + * }) + */ + public listMacros( + request: Intercom.unstable.ListMacrosRequest = {}, + requestOptions?: Macros.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__listMacros(request, requestOptions)); + } + + private async __listMacros( + request: Intercom.unstable.ListMacrosRequest = {}, + requestOptions?: Macros.RequestOptions, + ): Promise> { + const { per_page: perPage, starting_after: startingAfter, updated_since: updatedSince } = request; + const _queryParams: Record = {}; + if (perPage != null) { + _queryParams["per_page"] = perPage.toString(); + } + + if (startingAfter != null) { + _queryParams["starting_after"] = startingAfter; + } + + if (updatedSince != null) { + _queryParams["updated_since"] = updatedSince.toString(); + } + + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + "macros", + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "intercom-client", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", + "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + queryParameters: _queryParams, + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 20000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { data: _response.body as Intercom.unstable.MacroList, rawResponse: _response.rawResponse }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Intercom.unstable.BadRequestError(_response.error.body as unknown, _response.rawResponse); + case 401: + throw new Intercom.unstable.UnauthorizedError( + _response.error.body as Intercom.unstable.Error_, + _response.rawResponse, + ); + case 403: + throw new Intercom.unstable.ForbiddenError( + _response.error.body as Intercom.unstable.Error_, + _response.rawResponse, + ); + default: + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.IntercomTimeoutError("Timeout exceeded when calling GET /macros."); + case "unknown": + throw new errors.IntercomError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + } + + /** + * You can fetch a single macro (saved reply) by its ID. The macro will only be returned if it is visible to the authenticated user based on its visibility settings. + * + * **Visibility Rules** + * + * A macro is returned based on its `visible_to` setting: + * - `everyone`: Always visible to all team members + * - `specific_teams`: Only visible if the authenticated user belongs to one of the teams specified in `visible_to_team_ids` + * + * If a macro exists but is not visible to the authenticated user, a 404 error is returned. + * + * **Placeholder Transformation** + * + * The API transforms Intercom placeholders to a more standard XML-like format in the `body` field: + * - From: `{{user.name | fallback: 'there'}}` + * - To: `` + * + * Default values in placeholders are HTML-escaped for security. + * + * @param {Intercom.unstable.GetMacroRequest} request + * @param {Macros.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Intercom.unstable.UnauthorizedError} + * @throws {@link Intercom.unstable.ForbiddenError} + * @throws {@link Intercom.unstable.NotFoundError} + * + * @example + * await client.unstable.macros.getMacro({ + * id: "123" + * }) + */ + public getMacro( + request: Intercom.unstable.GetMacroRequest, + requestOptions?: Macros.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__getMacro(request, requestOptions)); + } + + private async __getMacro( + request: Intercom.unstable.GetMacroRequest, + requestOptions?: Macros.RequestOptions, + ): Promise> { + const { id } = request; + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: urlJoin( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `macros/${encodeURIComponent(id)}`, + ), + method: "GET", + headers: { + Authorization: await this._getAuthorizationHeader(), + "X-Fern-Language": "JavaScript", + "X-Fern-SDK-Name": "intercom-client", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", + "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", + "X-Fern-Runtime": core.RUNTIME.type, + "X-Fern-Runtime-Version": core.RUNTIME.version, + ...requestOptions?.headers, + }, + contentType: "application/json", + requestType: "json", + timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 20000, + maxRetries: requestOptions?.maxRetries, + abortSignal: requestOptions?.abortSignal, + }); + if (_response.ok) { + return { data: _response.body as Intercom.unstable.Macro | undefined, rawResponse: _response.rawResponse }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 401: + throw new Intercom.unstable.UnauthorizedError( + _response.error.body as Intercom.unstable.Error_, + _response.rawResponse, + ); + case 403: + throw new Intercom.unstable.ForbiddenError( + _response.error.body as Intercom.unstable.Error_, + _response.rawResponse, + ); + case 404: + throw new Intercom.unstable.NotFoundError(_response.error.body as unknown, _response.rawResponse); + default: + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + switch (_response.error.reason) { + case "non-json": + throw new errors.IntercomError({ + statusCode: _response.error.statusCode, + body: _response.error.rawBody, + rawResponse: _response.rawResponse, + }); + case "timeout": + throw new errors.IntercomTimeoutError("Timeout exceeded when calling GET /macros/{id}."); + case "unknown": + throw new errors.IntercomError({ + message: _response.error.errorMessage, + rawResponse: _response.rawResponse, + }); + } + } + + protected async _getAuthorizationHeader(): Promise { + const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["INTERCOM_API_KEY"]; + if (bearer == null) { + throw new errors.IntercomError({ + message: + "Please specify a bearer by either passing it in to the constructor or initializing a INTERCOM_API_KEY environment variable", + }); + } + + return `Bearer ${bearer}`; + } +} diff --git a/src/api/resources/unstable/resources/macros/client/index.ts b/src/api/resources/unstable/resources/macros/client/index.ts new file mode 100644 index 00000000..415726b7 --- /dev/null +++ b/src/api/resources/unstable/resources/macros/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/unstable/resources/macros/client/requests/GetMacroRequest.ts b/src/api/resources/unstable/resources/macros/client/requests/GetMacroRequest.ts new file mode 100644 index 00000000..eaaaabe9 --- /dev/null +++ b/src/api/resources/unstable/resources/macros/client/requests/GetMacroRequest.ts @@ -0,0 +1,31 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * id: "123" + * } + * + * @example + * { + * id: "123" + * } + * + * @example + * { + * id: "123" + * } + * + * @example + * { + * id: "123" + * } + */ +export interface GetMacroRequest { + /** + * The unique identifier of the macro + */ + id: string; +} diff --git a/src/api/resources/unstable/resources/macros/client/requests/ListMacrosRequest.ts b/src/api/resources/unstable/resources/macros/client/requests/ListMacrosRequest.ts new file mode 100644 index 00000000..8c9530d1 --- /dev/null +++ b/src/api/resources/unstable/resources/macros/client/requests/ListMacrosRequest.ts @@ -0,0 +1,49 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * @example + * { + * starting_after: "WzE3MTk0OTM3NTcuMCwgIjEyMyJd" + * } + * + * @example + * { + * starting_after: "WzE3MTk0OTM3NTcuMCwgIjEyMyJd" + * } + * + * @example + * { + * starting_after: "WzE3MTk0OTM3NTcuMCwgIjEyMyJd" + * } + * + * @example + * { + * starting_after: "WzE3MTk0OTM3NTcuMCwgIjEyMyJd" + * } + * + * @example + * { + * starting_after: "WzE3MTk0OTM3NTcuMCwgIjEyMyJd" + * } + * + * @example + * { + * starting_after: "WzE3MTk0OTM3NTcuMCwgIjEyMyJd" + * } + */ +export interface ListMacrosRequest { + /** + * The number of results per page + */ + per_page?: number; + /** + * Base64-encoded cursor containing [updated_at, id] for pagination + */ + starting_after?: string; + /** + * Unix timestamp to filter macros updated after this time + */ + updated_since?: number; +} diff --git a/src/api/resources/unstable/resources/macros/client/requests/index.ts b/src/api/resources/unstable/resources/macros/client/requests/index.ts new file mode 100644 index 00000000..dcd96ae8 --- /dev/null +++ b/src/api/resources/unstable/resources/macros/client/requests/index.ts @@ -0,0 +1,2 @@ +export { type ListMacrosRequest } from "./ListMacrosRequest"; +export { type GetMacroRequest } from "./GetMacroRequest"; diff --git a/src/api/resources/unstable/resources/macros/index.ts b/src/api/resources/unstable/resources/macros/index.ts new file mode 100644 index 00000000..c9240f83 --- /dev/null +++ b/src/api/resources/unstable/resources/macros/index.ts @@ -0,0 +1,2 @@ +export * from "./types"; +export * from "./client"; diff --git a/src/api/resources/unstable/resources/macros/types/Macro.ts b/src/api/resources/unstable/resources/macros/types/Macro.ts new file mode 100644 index 00000000..d62b8fc5 --- /dev/null +++ b/src/api/resources/unstable/resources/macros/types/Macro.ts @@ -0,0 +1,49 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * A macro is a pre-defined response template (saved reply) that can be used to quickly reply to conversations. + */ +export interface Macro { + /** String representing the object's type. Always has the value `macro`. */ + type?: "macro"; + /** The unique identifier for the macro. */ + id?: string; + /** The name of the macro. */ + name?: string; + /** The body of the macro in HTML format with placeholders transformed to XML-like format. */ + body?: string; + /** The plain text version of the macro body with original Intercom placeholder format. */ + body_text?: string; + /** The time the macro was created in ISO 8601 format. */ + created_at?: string; + /** The time the macro was last updated in ISO 8601 format. */ + updated_at?: string; + /** Who can view this macro. */ + visible_to?: Macro.VisibleTo; + /** The team IDs that can view this macro when visible_to is set to specific_teams. */ + visible_to_team_ids?: string[]; + /** Where the macro is available for use. */ + available_on?: Macro.AvailableOn.Item[]; +} + +export namespace Macro { + /** + * Who can view this macro. + */ + export type VisibleTo = "everyone" | "specific_teams"; + export const VisibleTo = { + Everyone: "everyone", + SpecificTeams: "specific_teams", + } as const; + export type AvailableOn = AvailableOn.Item[]; + + export namespace AvailableOn { + export type Item = "inbox" | "messenger"; + export const Item = { + Inbox: "inbox", + Messenger: "messenger", + } as const; + } +} diff --git a/src/api/resources/unstable/resources/macros/types/MacroList.ts b/src/api/resources/unstable/resources/macros/types/MacroList.ts new file mode 100644 index 00000000..c63d62df --- /dev/null +++ b/src/api/resources/unstable/resources/macros/types/MacroList.ts @@ -0,0 +1,41 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Intercom from "../../../../../index"; + +/** + * A paginated list of macros (saved replies) in the workspace. + */ +export interface MacroList { + /** Always list */ + type?: "list"; + /** The list of macro objects */ + data?: (Intercom.unstable.Macro | undefined)[]; + /** Pagination information */ + pages?: MacroList.Pages; +} + +export namespace MacroList { + /** + * Pagination information + */ + export interface Pages { + /** The type of pagination */ + type?: "pages"; + /** Number of results per page */ + per_page?: number; + /** Cursor for the next page */ + next?: Pages.Next; + } + + export namespace Pages { + /** + * Cursor for the next page + */ + export interface Next { + /** Base64-encoded cursor containing [updated_at, id] for pagination */ + starting_after?: string; + } + } +} diff --git a/src/api/resources/unstable/resources/macros/types/index.ts b/src/api/resources/unstable/resources/macros/types/index.ts new file mode 100644 index 00000000..96a355c0 --- /dev/null +++ b/src/api/resources/unstable/resources/macros/types/index.ts @@ -0,0 +1,2 @@ +export * from "./Macro"; +export * from "./MacroList"; diff --git a/src/api/resources/unstable/resources/messages/client/Client.ts b/src/api/resources/unstable/resources/messages/client/Client.ts index e49625bc..b31f8845 100644 --- a/src/api/resources/unstable/resources/messages/client/Client.ts +++ b/src/api/resources/unstable/resources/messages/client/Client.ts @@ -76,7 +76,7 @@ export class Messages { constructor(protected readonly _options: Messages.Options = {}) {} /** - * You can create a message that has been initiated by an admin. The conversation can be either an in-app message, an email or sms. + * You can create a message that has been initiated by an admin. The conversation can be either an in-app message, an email, sms or whatsapp. * * > 🚧 Sending for visitors * > @@ -88,7 +88,7 @@ export class Messages { * > * > As this is a message, there will be no conversation present until the contact responds. Once they do, you will have to search for a contact's conversations with the id of the message. * - * @param {Intercom.CreateMessageRequestTwo} request + * @param {Intercom.CreateMessageRequestThree} request * @param {Messages.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.unstable.BadRequestError} @@ -174,6 +174,32 @@ export class Messages { * await client.unstable.messages.createMessage({ * "from": { * "type": "admin", + * "id": "991267817" + * }, + * "to": { + * "phone": 5547999998888, + * "name": "John Doe" + * }, + * "message_type": "whatsapp", + * "components": [ + * { + * "type": "BODY", + * "parameters": [ + * { + * "type": "text", + * "text": "Username 123" + * } + * ] + * } + * ], + * "template": "keep_live", + * "locale": "en" + * }) + * + * @example + * await client.unstable.messages.createMessage({ + * "from": { + * "type": "admin", * "id": "991267818" * }, * "to": { @@ -227,14 +253,14 @@ export class Messages { * }) */ public createMessage( - request?: Intercom.CreateMessageRequestTwo, + request?: Intercom.CreateMessageRequestThree, requestOptions?: Messages.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__createMessage(request, requestOptions)); } private async __createMessage( - request?: Intercom.CreateMessageRequestTwo, + request?: Intercom.CreateMessageRequestThree, requestOptions?: Messages.RequestOptions, ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ @@ -249,8 +275,8 @@ export class Messages { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -366,8 +392,8 @@ export class Messages { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, diff --git a/src/api/resources/unstable/resources/messages/types/Message.ts b/src/api/resources/unstable/resources/messages/types/Message.ts index 35585c59..0fdf5756 100644 --- a/src/api/resources/unstable/resources/messages/types/Message.ts +++ b/src/api/resources/unstable/resources/messages/types/Message.ts @@ -16,7 +16,7 @@ export interface Message { subject?: string; /** The message body, which may contain HTML. */ body: string; - /** The type of message that was sent. Can be email, inapp, facebook ,twitter or sms. */ + /** The type of message that was sent. Can be email, inapp, facebook, twitter, sms or whatsapp. */ message_type: Message.MessageType; /** The associated conversation_id */ conversation_id?: string; @@ -24,14 +24,15 @@ export interface Message { export namespace Message { /** - * The type of message that was sent. Can be email, inapp, facebook ,twitter or sms. + * The type of message that was sent. Can be email, inapp, facebook, twitter, sms or whatsapp. */ - export type MessageType = "email" | "inapp" | "facebook" | "twitter" | "sms"; + export type MessageType = "email" | "inapp" | "facebook" | "twitter" | "sms" | "whatsapp"; export const MessageType = { Email: "email", Inapp: "inapp", Facebook: "facebook", Twitter: "twitter", Sms: "sms", + Whatsapp: "whatsapp", } as const; } diff --git a/src/api/resources/unstable/resources/news/client/Client.ts b/src/api/resources/unstable/resources/news/client/Client.ts index f42e1729..cd500803 100644 --- a/src/api/resources/unstable/resources/news/client/Client.ts +++ b/src/api/resources/unstable/resources/news/client/Client.ts @@ -106,8 +106,8 @@ export class News { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -202,8 +202,8 @@ export class News { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -291,8 +291,8 @@ export class News { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -396,8 +396,8 @@ export class News { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -487,8 +487,8 @@ export class News { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -576,8 +576,8 @@ export class News { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -657,8 +657,8 @@ export class News { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -744,8 +744,8 @@ export class News { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, diff --git a/src/api/resources/unstable/resources/notes/client/Client.ts b/src/api/resources/unstable/resources/notes/client/Client.ts index b82d5191..9fa43c45 100644 --- a/src/api/resources/unstable/resources/notes/client/Client.ts +++ b/src/api/resources/unstable/resources/notes/client/Client.ts @@ -112,8 +112,8 @@ export class Notes { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -215,8 +215,8 @@ export class Notes { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -301,8 +301,8 @@ export class Notes { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, diff --git a/src/api/resources/unstable/resources/segments/client/Client.ts b/src/api/resources/unstable/resources/segments/client/Client.ts index 67d08f1f..94091ea7 100644 --- a/src/api/resources/unstable/resources/segments/client/Client.ts +++ b/src/api/resources/unstable/resources/segments/client/Client.ts @@ -115,8 +115,8 @@ export class Segments { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -204,8 +204,8 @@ export class Segments { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, diff --git a/src/api/resources/unstable/resources/subscriptionTypes/client/Client.ts b/src/api/resources/unstable/resources/subscriptionTypes/client/Client.ts index 38e70154..6937c880 100644 --- a/src/api/resources/unstable/resources/subscriptionTypes/client/Client.ts +++ b/src/api/resources/unstable/resources/subscriptionTypes/client/Client.ts @@ -128,8 +128,8 @@ export class SubscriptionTypes { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -222,8 +222,8 @@ export class SubscriptionTypes { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -307,8 +307,8 @@ export class SubscriptionTypes { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, diff --git a/src/api/resources/unstable/resources/switch/client/Client.ts b/src/api/resources/unstable/resources/switch/client/Client.ts index 543d2759..b8e9f1a6 100644 --- a/src/api/resources/unstable/resources/switch/client/Client.ts +++ b/src/api/resources/unstable/resources/switch/client/Client.ts @@ -116,8 +116,8 @@ export class Switch { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, diff --git a/src/api/resources/unstable/resources/tags/client/Client.ts b/src/api/resources/unstable/resources/tags/client/Client.ts index 279f075c..083047d0 100644 --- a/src/api/resources/unstable/resources/tags/client/Client.ts +++ b/src/api/resources/unstable/resources/tags/client/Client.ts @@ -120,8 +120,8 @@ export class Tags { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -214,8 +214,8 @@ export class Tags { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -308,8 +308,8 @@ export class Tags { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -403,8 +403,8 @@ export class Tags { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -487,8 +487,8 @@ export class Tags { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -608,8 +608,8 @@ export class Tags { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -702,8 +702,8 @@ export class Tags { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -793,8 +793,8 @@ export class Tags { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -887,8 +887,8 @@ export class Tags { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -980,8 +980,8 @@ export class Tags { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, diff --git a/src/api/resources/unstable/resources/teams/client/Client.ts b/src/api/resources/unstable/resources/teams/client/Client.ts index 1a849930..3fcf7924 100644 --- a/src/api/resources/unstable/resources/teams/client/Client.ts +++ b/src/api/resources/unstable/resources/teams/client/Client.ts @@ -104,8 +104,8 @@ export class Teams { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -192,8 +192,8 @@ export class Teams { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, diff --git a/src/api/resources/unstable/resources/ticketStates/client/Client.ts b/src/api/resources/unstable/resources/ticketStates/client/Client.ts index 9df86fd0..52e9f69a 100644 --- a/src/api/resources/unstable/resources/ticketStates/client/Client.ts +++ b/src/api/resources/unstable/resources/ticketStates/client/Client.ts @@ -106,8 +106,8 @@ export class TicketStates { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, diff --git a/src/api/resources/unstable/resources/ticketTypeAttributes/client/Client.ts b/src/api/resources/unstable/resources/ticketTypeAttributes/client/Client.ts index 4db689cf..9e75a19c 100644 --- a/src/api/resources/unstable/resources/ticketTypeAttributes/client/Client.ts +++ b/src/api/resources/unstable/resources/ticketTypeAttributes/client/Client.ts @@ -116,8 +116,8 @@ export class TicketTypeAttributes { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -211,8 +211,8 @@ export class TicketTypeAttributes { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, diff --git a/src/api/resources/unstable/resources/ticketTypes/client/Client.ts b/src/api/resources/unstable/resources/ticketTypes/client/Client.ts index 857fd1f7..bca2cad4 100644 --- a/src/api/resources/unstable/resources/ticketTypes/client/Client.ts +++ b/src/api/resources/unstable/resources/ticketTypes/client/Client.ts @@ -106,8 +106,8 @@ export class TicketTypes { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -196,8 +196,8 @@ export class TicketTypes { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -287,8 +287,8 @@ export class TicketTypes { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, diff --git a/src/api/resources/unstable/resources/tickets/client/Client.ts b/src/api/resources/unstable/resources/tickets/client/Client.ts index 116eed02..85a594a1 100644 --- a/src/api/resources/unstable/resources/tickets/client/Client.ts +++ b/src/api/resources/unstable/resources/tickets/client/Client.ts @@ -159,8 +159,8 @@ export class Tickets { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -254,8 +254,8 @@ export class Tickets { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -344,8 +344,8 @@ export class Tickets { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -460,8 +460,8 @@ export class Tickets { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -553,8 +553,8 @@ export class Tickets { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -651,6 +651,13 @@ export class Tickets { * | snoozed_until | Date (UNIX timestamp) | * | ticket_attribute.{id} | String or Boolean or Date (UNIX timestamp) or Float or Integer | * + * {% admonition type="info" name="Searching by Category" %} + * When searching for tickets by the **`category`** field, specific terms must be used instead of the category names: + * * For **Customer** category tickets, use the term `request`. + * * For **Back-office** category tickets, use the term `task`. + * * For **Tracker** category tickets, use the term `tracker`. + * {% /admonition %} + * * ### Accepted Operators * * {% admonition type="info" name="Searching based on `created_at`" %} @@ -713,8 +720,8 @@ export class Tickets { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, diff --git a/src/api/resources/unstable/resources/visitors/client/Client.ts b/src/api/resources/unstable/resources/visitors/client/Client.ts index ef6e2e8a..2063e660 100644 --- a/src/api/resources/unstable/resources/visitors/client/Client.ts +++ b/src/api/resources/unstable/resources/visitors/client/Client.ts @@ -115,8 +115,8 @@ export class Visitors { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -219,8 +219,8 @@ export class Visitors { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -321,8 +321,8 @@ export class Visitors { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, diff --git a/src/api/resources/unstable/types/ActivityLog.ts b/src/api/resources/unstable/types/ActivityLog.ts index 1815ce24..85813f23 100644 --- a/src/api/resources/unstable/types/ActivityLog.ts +++ b/src/api/resources/unstable/types/ActivityLog.ts @@ -36,7 +36,8 @@ export namespace ActivityLog { } export type ActivityType = - | "admin_assignment_limit_change" + | "admin_conversation_assignment_limit_change" + | "admin_ticket_assignment_limit_change" | "admin_away_mode_change" | "admin_deletion" | "admin_deprovisioned" @@ -104,7 +105,8 @@ export namespace ActivityLog { | "upfront_email_collection_change" | "welcome_message_change"; export const ActivityType = { - AdminAssignmentLimitChange: "admin_assignment_limit_change", + AdminConversationAssignmentLimitChange: "admin_conversation_assignment_limit_change", + AdminTicketAssignmentLimitChange: "admin_ticket_assignment_limit_change", AdminAwayModeChange: "admin_away_mode_change", AdminDeletion: "admin_deletion", AdminDeprovisioned: "admin_deprovisioned", diff --git a/src/api/resources/unstable/types/ActivityLogMetadata.ts b/src/api/resources/unstable/types/ActivityLogMetadata.ts index 4814d8e5..91347794 100644 --- a/src/api/resources/unstable/types/ActivityLogMetadata.ts +++ b/src/api/resources/unstable/types/ActivityLogMetadata.ts @@ -24,4 +24,8 @@ export interface ActivityLogMetadata { update_by?: number; /** The name of the Admin who initiated the activity. */ update_by_name?: string; + /** The conversation assignment limit value for an admin. */ + conversation_assignment_limit?: number; + /** The ticket assignment limit value for an admin. */ + ticket_assignment_limit?: number; } diff --git a/src/api/resources/unstable/types/CallList.ts b/src/api/resources/unstable/types/CallList.ts new file mode 100644 index 00000000..f60ab87b --- /dev/null +++ b/src/api/resources/unstable/types/CallList.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Intercom from "../../../index"; + +/** + * A paginated list of calls. + */ +export interface CallList { + /** String representing the object's type. Always has the value `list`. */ + type?: string; + /** A list of calls. */ + data?: Intercom.unstable.Call[]; + /** Total number of items available. */ + total_count?: number; + pages?: Intercom.unstable.CursorPages; +} diff --git a/src/api/resources/unstable/types/ConversationRating.ts b/src/api/resources/unstable/types/ConversationRating.ts index 5b5a7899..1a15c9ef 100644 --- a/src/api/resources/unstable/types/ConversationRating.ts +++ b/src/api/resources/unstable/types/ConversationRating.ts @@ -14,6 +14,8 @@ export interface ConversationRating { remark?: string; /** The time the rating was requested in the conversation being rated. */ created_at?: number; + /** The time the rating was last updated. */ + updated_at?: number; contact?: Intercom.unstable.ContactReference; teammate?: Intercom.unstable.Reference; } diff --git a/src/api/resources/unstable/types/UpdateArticleRequestBody.ts b/src/api/resources/unstable/types/CreateArticleRequest.ts similarity index 87% rename from src/api/resources/unstable/types/UpdateArticleRequestBody.ts rename to src/api/resources/unstable/types/CreateArticleRequest.ts index 09be43a9..805c4970 100644 --- a/src/api/resources/unstable/types/UpdateArticleRequestBody.ts +++ b/src/api/resources/unstable/types/CreateArticleRequest.ts @@ -5,27 +5,27 @@ import * as Intercom from "../../../index"; /** - * You can Update an Article + * You can create an Article */ -export interface UpdateArticleRequestBody { +export interface CreateArticleRequest { /** The title of the article.For multilingual articles, this will be the title of the default language's content. */ - title?: string; + title: string; /** The description of the article. For multilingual articles, this will be the description of the default language's content. */ description?: string; /** The content of the article. For multilingual articles, this will be the body of the default language's content. */ body?: string; /** The id of the author of the article. For multilingual articles, this will be the id of the author of the default language's content. Must be a teammate on the help center's workspace. */ - author_id?: number; + author_id: number; /** Whether the article will be `published` or will be a `draft`. Defaults to draft. For multilingual articles, this will be the state of the default language's content. */ - state?: UpdateArticleRequestBody.State; + state?: CreateArticleRequest.State; /** The id of the article's parent collection or section. An article without this field stands alone. */ - parent_id?: string; + parent_id?: number; /** The type of parent, which can either be a `collection` or `section`. */ parent_type?: string; translated_content?: Intercom.unstable.ArticleTranslatedContent; } -export namespace UpdateArticleRequestBody { +export namespace CreateArticleRequest { /** * Whether the article will be `published` or will be a `draft`. Defaults to draft. For multilingual articles, this will be the state of the default language's content. */ diff --git a/src/api/resources/unstable/types/CreateDataAttributeRequest.ts b/src/api/resources/unstable/types/CreateDataAttributeRequest.ts new file mode 100644 index 00000000..f3656b4a --- /dev/null +++ b/src/api/resources/unstable/types/CreateDataAttributeRequest.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * + */ +export type CreateDataAttributeRequest = + | { + data_type?: "options" | undefined; + options: { + value?: string | undefined; + }[]; + } + | { + data_type?: ("string" | "integer" | "float" | "boolean" | "datetime" | "date") | undefined; + }; diff --git a/src/api/resources/unstable/types/CreateInternalArticleRequest.ts b/src/api/resources/unstable/types/CreateInternalArticleRequest.ts new file mode 100644 index 00000000..bb7b5d6b --- /dev/null +++ b/src/api/resources/unstable/types/CreateInternalArticleRequest.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * You can create an Internal Article + */ +export interface CreateInternalArticleRequest { + /** The title of the article. */ + title: string; + /** The content of the article. */ + body?: string; + /** The id of the author of the article. */ + author_id: number; + /** The id of the owner of the article. */ + owner_id: number; +} diff --git a/src/api/resources/unstable/types/CreateOrUpdateCompanyRequest.ts b/src/api/resources/unstable/types/CreateOrUpdateCompanyRequest.ts new file mode 100644 index 00000000..66fb80d7 --- /dev/null +++ b/src/api/resources/unstable/types/CreateOrUpdateCompanyRequest.ts @@ -0,0 +1,27 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * You can create or update a Company + */ +export interface CreateOrUpdateCompanyRequest { + /** The name of the Company */ + name?: string; + /** The company id you have defined for the company. Can't be updated */ + company_id?: string; + /** The name of the plan you have associated with the company. */ + plan?: string; + /** The number of employees in this company. */ + size?: number; + /** The URL for this company's website. Please note that the value specified here is not validated. Accepts any string. */ + website?: string; + /** The industry that this company operates in. */ + industry?: string; + /** A hash of key/value pairs containing any other data about the company you want Intercom to store. */ + custom_attributes?: Record; + /** The time the company was created by you. */ + remote_created_at?: number; + /** How much revenue the company generates for your business. Note that this will truncate floats. i.e. it only allow for whole integers, 155.98 will be truncated to 155. Note that this has an upper limit of 2**31-1 or 2147483647.. */ + monthly_spend?: number; +} diff --git a/src/api/resources/unstable/types/CreatePhoneSwitchRequest.ts b/src/api/resources/unstable/types/CreatePhoneSwitchRequest.ts new file mode 100644 index 00000000..edd654e8 --- /dev/null +++ b/src/api/resources/unstable/types/CreatePhoneSwitchRequest.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Intercom from "../../../index"; + +/** + * You can create an phone switch + */ +export interface CreatePhoneSwitchRequest { + /** Phone number in E.164 format, that will receive the SMS to continue the conversation in the Messenger. */ + phone: string; + custom_attributes?: Intercom.unstable.CustomAttributes; +} diff --git a/src/api/resources/ticketTypes/client/requests/CreateTicketTypeRequest.ts b/src/api/resources/unstable/types/CreateTicketTypeRequest.ts similarity index 82% rename from src/api/resources/ticketTypes/client/requests/CreateTicketTypeRequest.ts rename to src/api/resources/unstable/types/CreateTicketTypeRequest.ts index 0282e169..e347c29d 100644 --- a/src/api/resources/ticketTypes/client/requests/CreateTicketTypeRequest.ts +++ b/src/api/resources/unstable/types/CreateTicketTypeRequest.ts @@ -3,13 +3,8 @@ */ /** - * @example - * { - * name: "Customer Issue", - * description: "Customer Report Template", - * category: "Customer", - * icon: "\uD83C\uDF9F\uFE0F" - * } + * The request payload for creating a ticket type. + * You can copy the `icon` property for your ticket type from [Twemoji Cheatsheet](https://twemoji-cheatsheet.vercel.app/) */ export interface CreateTicketTypeRequest { /** The name of the ticket type. */ diff --git a/src/api/resources/unstable/types/CustomChannelContact.ts b/src/api/resources/unstable/types/CustomChannelContact.ts index e1e7eabc..00a7f59d 100644 --- a/src/api/resources/unstable/types/CustomChannelContact.ts +++ b/src/api/resources/unstable/types/CustomChannelContact.ts @@ -7,10 +7,10 @@ export interface CustomChannelContact { type: CustomChannelContact.Type; /** External identifier for the contact. Intercom will take care of the mapping of your external_id with our internal ones so you don't have to worry about it. */ external_id: string; - /** Name of the contact. */ - name: string; - /** Email address of the contact. */ - email: string; + /** Name of the contact. Required for user type. */ + name?: string; + /** Email address of the contact. Required for user type. */ + email?: string; } export namespace CustomChannelContact { diff --git a/src/api/resources/unstable/types/DeletedInternalArticleObject.ts b/src/api/resources/unstable/types/DeletedInternalArticleObject.ts new file mode 100644 index 00000000..45dd858e --- /dev/null +++ b/src/api/resources/unstable/types/DeletedInternalArticleObject.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Response returned when an object is deleted + */ +export interface DeletedInternalArticleObject { + /** The unique identifier for the internal article which you provided in the URL. */ + id?: string; + /** The type of object which was deleted. - internal_article */ + object?: "internal_article"; + /** Whether the internal article was deleted successfully or not. */ + deleted?: boolean; +} diff --git a/src/api/resources/unstable/types/IntercomVersion.ts b/src/api/resources/unstable/types/IntercomVersion.ts index 921f8ae6..5fc1c153 100644 --- a/src/api/resources/unstable/types/IntercomVersion.ts +++ b/src/api/resources/unstable/types/IntercomVersion.ts @@ -23,6 +23,9 @@ export type IntercomVersion = | "2.9" | "2.10" | "2.11" + | "2.12" + | "2.13" + | "2.14" | "Unstable"; export const IntercomVersion = { One0: "1.0", @@ -42,5 +45,8 @@ export const IntercomVersion = { Two9: "2.9", Two10: "2.10", Two11: "2.11", + Two12: "2.12", + Two13: "2.13", + Two14: "2.14", Unstable: "Unstable", } as const; diff --git a/src/api/resources/unstable/types/IntercomVersionUnstable.ts b/src/api/resources/unstable/types/IntercomVersionUnstable.ts index 1bbcf600..9aec3686 100644 --- a/src/api/resources/unstable/types/IntercomVersionUnstable.ts +++ b/src/api/resources/unstable/types/IntercomVersionUnstable.ts @@ -3,6 +3,6 @@ */ /** - * Unstable Intercom API version. Used for closed beta endpoints. + * Unstable Intercom API version. Used for closed beta endpoints or other features under managed availability. */ export type IntercomVersionUnstable = "unstable"; diff --git a/src/api/resources/unstable/types/InternalArticleList.ts b/src/api/resources/unstable/types/InternalArticleList.ts new file mode 100644 index 00000000..970b6375 --- /dev/null +++ b/src/api/resources/unstable/types/InternalArticleList.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Intercom from "../../../index"; + +/** + * This will return a list of internal articles for the App. + */ +export interface InternalArticleList { + /** The type of the object - `list`. */ + type?: "list"; + pages?: Intercom.unstable.CursorPages; + /** A count of the total number of internal articles. */ + total_count?: number; + /** An array of Internal Article objects */ + data?: Intercom.unstable.InternalArticleListItem[]; +} diff --git a/src/api/resources/unstable/types/UpdateDataAttributeRequestBody.ts b/src/api/resources/unstable/types/UpdateDataAttributeRequestBody.ts new file mode 100644 index 00000000..c2d7dbe9 --- /dev/null +++ b/src/api/resources/unstable/types/UpdateDataAttributeRequestBody.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * + */ +export type UpdateDataAttributeRequestBody = + | { + options: { + value?: string | undefined; + }[]; + } + | unknown; diff --git a/src/api/resources/unstable/types/index.ts b/src/api/resources/unstable/types/index.ts index 129ed3c6..bbafaf04 100644 --- a/src/api/resources/unstable/types/index.ts +++ b/src/api/resources/unstable/types/index.ts @@ -11,6 +11,7 @@ export * from "./AdminReplyTicketRequest"; export * from "./AdminWithApp"; export * from "./App"; export * from "./ArticleContent"; +export * from "./InternalArticleList"; export * from "./ArticleList"; export * from "./ArticleStatistics"; export * from "./ArticleTranslatedContent"; @@ -61,11 +62,18 @@ export * from "./ConversationResponseTime"; export * from "./ConversationSource"; export * from "./ConversationStatistics"; export * from "./ConversationTeammates"; +export * from "./CreateArticleRequest"; +export * from "./CreateInternalArticleRequest"; +export * from "./CreateDataAttributeRequest"; export * from "./Recipient"; +export * from "./CreateOrUpdateCompanyRequest"; export * from "./CreateOrUpdateTagRequest"; +export * from "./CreatePhoneSwitchRequest"; export * from "./CreateTicketReplyWithCommentRequest"; export * from "./CreateTicketRequestBody"; +export * from "./CreateTicketTypeRequest"; export * from "./CursorPages"; +export * from "./CallList"; export * from "./CustomAttributes"; export * from "./CustomObjectInstanceDeleted"; export * from "./CustomObjectInstanceList"; @@ -76,6 +84,7 @@ export * from "./DataEventSummary"; export * from "./DataEventSummaryItem"; export * from "./DataExportCsv"; export * from "./DeletedArticleObject"; +export * from "./DeletedInternalArticleObject"; export * from "./DeletedCollectionObject"; export * from "./DeletedCompanyObject"; export * from "./DeletedObject"; @@ -139,7 +148,6 @@ export * from "./TicketTypeAttributeList"; export * from "./TicketTypeList"; export * from "./Translation"; export * from "./UntagCompanyRequest"; -export * from "./UpdateArticleRequestBody"; -export * from "./UpdateTicketTypeRequestBody"; +export * from "./UpdateDataAttributeRequestBody"; export * from "./Visitor"; export * from "./VisitorDeletedObject"; diff --git a/src/api/resources/visitors/client/Client.ts b/src/api/resources/visitors/client/Client.ts index e18896e6..8438ce40 100644 --- a/src/api/resources/visitors/client/Client.ts +++ b/src/api/resources/visitors/client/Client.ts @@ -92,14 +92,14 @@ export class Visitors { public find( request: Intercom.FindVisitorRequest, requestOptions?: Visitors.RequestOptions, - ): core.HttpResponsePromise { + ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__find(request, requestOptions)); } private async __find( request: Intercom.FindVisitorRequest, requestOptions?: Visitors.RequestOptions, - ): Promise> { + ): Promise> { const { user_id: userId } = request; const _queryParams: Record = {}; _queryParams["user_id"] = userId; @@ -115,8 +115,8 @@ export class Visitors { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -130,7 +130,7 @@ export class Visitors { abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return { data: _response.body as Intercom.Visitor, rawResponse: _response.rawResponse }; + return { data: _response.body as Intercom.Visitor | undefined, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { @@ -183,7 +183,7 @@ export class Visitors { * * @example * await client.visitors.update({ - * id: "667d61cc8a68186f43bafe95", + * id: "6762f30c1bb69f9f2193bc5e", * name: "Gareth Bale" * }) * @@ -196,14 +196,14 @@ export class Visitors { public update( request: Intercom.UpdateVisitorRequest, requestOptions?: Visitors.RequestOptions, - ): core.HttpResponsePromise { + ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__update(request, requestOptions)); } private async __update( request: Intercom.UpdateVisitorRequest, requestOptions?: Visitors.RequestOptions, - ): Promise> { + ): Promise> { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( (await core.Supplier.get(this._options.baseUrl)) ?? @@ -216,8 +216,8 @@ export class Visitors { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -231,7 +231,7 @@ export class Visitors { abortSignal: requestOptions?.abortSignal, }); if (_response.ok) { - return { data: _response.body as Intercom.Visitor, rawResponse: _response.rawResponse }; + return { data: _response.body as Intercom.Visitor | undefined, rawResponse: _response.rawResponse }; } if (_response.error.reason === "status-code") { @@ -316,8 +316,8 @@ export class Visitors { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "6.4.0", - "User-Agent": "intercom-client/6.4.0", + "X-Fern-SDK-Version": "7.0.0", + "User-Agent": "intercom-client/7.0.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, diff --git a/src/api/types/ActionComponent.ts b/src/api/types/ActionComponent.ts deleted file mode 100644 index c97feba7..00000000 --- a/src/api/types/ActionComponent.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as Intercom from "../index"; - -export type ActionComponent = - | Intercom.ActionComponent.Sheet - | Intercom.ActionComponent.Url - | Intercom.ActionComponent.Submit; - -export namespace ActionComponent { - export interface Sheet extends Intercom.SheetActionComponent { - type: "sheet"; - } - - export interface Url extends Intercom.UrlActionComponent { - type: "url"; - } - - export interface Submit extends Intercom.SubmitActionComponent { - type: "submit"; - } -} diff --git a/src/api/types/ActivityLog.ts b/src/api/types/ActivityLog.ts index 80328f6f..db6cb159 100644 --- a/src/api/types/ActivityLog.ts +++ b/src/api/types/ActivityLog.ts @@ -9,13 +9,13 @@ import * as Intercom from "../index"; */ export interface ActivityLog { /** The id representing the activity. */ - id: string; + id?: string; /** Details about the Admin involved in the activity. */ - performed_by: ActivityLog.PerformedBy; + performed_by?: ActivityLog.PerformedBy; metadata?: Intercom.ActivityLogMetadata; /** The time the activity was created. */ created_at?: number; - activity_type: ActivityLog.ActivityType; + activity_type?: ActivityLog.ActivityType; /** A sentence or two describing the activity. */ activity_description?: string; } @@ -26,7 +26,7 @@ export namespace ActivityLog { */ export interface PerformedBy { /** String representing the object's type. Always has the value `admin`. */ - type?: "admin"; + type?: string; /** The id representing the admin. */ id?: string; /** The email of the admin. */ @@ -36,7 +36,8 @@ export namespace ActivityLog { } export type ActivityType = - | "admin_assignment_limit_change" + | "admin_conversation_assignment_limit_change" + | "admin_ticket_assignment_limit_change" | "admin_away_mode_change" | "admin_deletion" | "admin_deprovisioned" @@ -104,7 +105,8 @@ export namespace ActivityLog { | "upfront_email_collection_change" | "welcome_message_change"; export const ActivityType = { - AdminAssignmentLimitChange: "admin_assignment_limit_change", + AdminConversationAssignmentLimitChange: "admin_conversation_assignment_limit_change", + AdminTicketAssignmentLimitChange: "admin_ticket_assignment_limit_change", AdminAwayModeChange: "admin_away_mode_change", AdminDeletion: "admin_deletion", AdminDeprovisioned: "admin_deprovisioned", diff --git a/src/api/types/ActivityLogList.ts b/src/api/types/ActivityLogList.ts index ff4d942a..8fb951f0 100644 --- a/src/api/types/ActivityLogList.ts +++ b/src/api/types/ActivityLogList.ts @@ -9,8 +9,8 @@ import * as Intercom from "../index"; */ export interface ActivityLogList { /** String representing the object's type. Always has the value `activity_log.list`. */ - type: "activity_log.list"; + type?: string; pages?: Intercom.CursorPages; /** An array of activity logs */ - activity_logs: Intercom.ActivityLog[]; + activity_logs?: (Intercom.ActivityLog | undefined)[]; } diff --git a/src/api/types/ActivityLogMetadata.ts b/src/api/types/ActivityLogMetadata.ts index 4814d8e5..91347794 100644 --- a/src/api/types/ActivityLogMetadata.ts +++ b/src/api/types/ActivityLogMetadata.ts @@ -24,4 +24,8 @@ export interface ActivityLogMetadata { update_by?: number; /** The name of the Admin who initiated the activity. */ update_by_name?: string; + /** The conversation assignment limit value for an admin. */ + conversation_assignment_limit?: number; + /** The ticket assignment limit value for an admin. */ + ticket_assignment_limit?: number; } diff --git a/src/api/types/AddressableList.ts b/src/api/types/AddressableList.ts index 9fbf43ad..787be0f6 100644 --- a/src/api/types/AddressableList.ts +++ b/src/api/types/AddressableList.ts @@ -7,9 +7,9 @@ */ export interface AddressableList { /** The addressable object type */ - type: string; + type?: string; /** The id of the addressable object */ - id: string; + id?: string; /** Url to get more company resources for this contact */ - url: string; + url?: string; } diff --git a/src/api/types/AdminList.ts b/src/api/types/AdminList.ts index 6c802a88..ac36e505 100644 --- a/src/api/types/AdminList.ts +++ b/src/api/types/AdminList.ts @@ -9,7 +9,7 @@ import * as Intercom from "../index"; */ export interface AdminList { /** String representing the object's type. Always has the value `admin.list`. */ - type: "admin.list"; + type?: string; /** A list of admins associated with a given workspace. */ - admins: Intercom.Admin[]; + admins?: (Intercom.Admin | undefined)[]; } diff --git a/src/api/types/AdminReplyConversationRequest.ts b/src/api/types/AdminReplyConversationRequest.ts index be2e3a21..8d601846 100644 --- a/src/api/types/AdminReplyConversationRequest.ts +++ b/src/api/types/AdminReplyConversationRequest.ts @@ -16,6 +16,8 @@ export interface AdminReplyConversationRequest { admin_id: string; /** The time the reply was created. If not provided, the current time will be used. */ created_at?: number; + /** The quick reply options to display to the end user. Must be present for quick_reply message types. */ + reply_options?: Intercom.QuickReplyOption[]; /** A list of image URLs that will be added as attachments. You can include up to 10 URLs. */ attachment_urls?: string[]; /** A list of files that will be added as attachments. You can include up to 10 files */ @@ -23,9 +25,10 @@ export interface AdminReplyConversationRequest { } export namespace AdminReplyConversationRequest { - export type MessageType = "comment" | "note"; + export type MessageType = "comment" | "note" | "quick_reply"; export const MessageType = { Comment: "comment", Note: "note", + QuickReply: "quick_reply", } as const; } diff --git a/src/api/types/AdminWithApp.ts b/src/api/types/AdminWithApp.ts index 5f262869..ec07b117 100644 --- a/src/api/types/AdminWithApp.ts +++ b/src/api/types/AdminWithApp.ts @@ -9,23 +9,23 @@ import * as Intercom from "../index"; */ export interface AdminWithApp { /** String representing the object's type. Always has the value `admin`. */ - type: "admin"; + type?: string; /** The id representing the admin. */ - id: string; + id?: string; /** The name of the admin. */ - name: string; + name?: string; /** The email of the admin. */ - email: string; + email?: string; /** The job title of the admin. */ - job_title: string; + job_title?: string; /** Identifies if this admin is currently set in away mode. */ - away_mode_enabled: boolean; + away_mode_enabled?: boolean; /** Identifies if this admin is set to automatically reassign new conversations to the apps default inbox. */ - away_mode_reassign: boolean; + away_mode_reassign?: boolean; /** Identifies if this admin has a paid inbox seat to restrict/allow features that require them. */ - has_inbox_seat: boolean; + has_inbox_seat?: boolean; /** This is a list of ids of the teams that this admin is part of. */ - team_ids: number[]; + team_ids?: number[]; /** This object represents the avatar associated with the admin. */ avatar?: AdminWithApp.Avatar; /** Identifies if this admin's email is verified. */ @@ -40,7 +40,7 @@ export namespace AdminWithApp { */ export interface Avatar { /** This is a string that identifies the type of the object. It will always have the value `avatar`. */ - type?: "avatar"; + type?: string; /** This object represents the avatar associated with the admin. */ image_url?: string; } diff --git a/src/api/types/App.ts b/src/api/types/App.ts index 6506491c..fd2d8319 100644 --- a/src/api/types/App.ts +++ b/src/api/types/App.ts @@ -7,17 +7,17 @@ */ export interface App { /** */ - type: string; + type?: string; /** The id of the app. */ - id_code: string; + id_code?: string; /** The name of the app. */ - name: string; + name?: string; /** The Intercom region the app is located in. */ - region: string; + region?: string; /** The timezone of the region where the app is located. */ - timezone: string; + timezone?: string; /** When the app was created. */ - created_at: number; + created_at?: number; /** Whether or not the app uses identity verification. */ - identity_verification: boolean; + identity_verification?: boolean; } diff --git a/src/api/types/ArticleContent.ts b/src/api/types/ArticleContent.ts index dd73e27e..31652500 100644 --- a/src/api/types/ArticleContent.ts +++ b/src/api/types/ArticleContent.ts @@ -7,17 +7,17 @@ */ export interface ArticleContent { /** The type of object - `article_content` . */ - type: "article_content"; + type?: string; /** The title of the article. */ - title: string; + title?: string; /** The description of the article. */ - description: string; + description?: string; /** The body of the article. */ - body: string; + body?: string; /** The ID of the author of the article. */ - author_id: number; + author_id?: number; /** Whether the article is `published` or is a `draft` . */ - state: ArticleContent.State; + state?: ArticleContent.State; /** The time when the article was created (seconds). */ created_at?: number; /** The time when the article was last updated (seconds). */ diff --git a/src/api/types/ArticleList.ts b/src/api/types/ArticleList.ts index faf9ef31..4a179fe7 100644 --- a/src/api/types/ArticleList.ts +++ b/src/api/types/ArticleList.ts @@ -9,10 +9,10 @@ import * as Intercom from "../index"; */ export interface ArticleList { /** The type of the object - `list`. */ - type: "list"; + type?: "list"; pages?: unknown; /** A count of the total number of articles. */ - total_count: number; + total_count?: number; /** An array of Article objects */ - data: Intercom.ArticleListItem[]; + data?: Intercom.ArticleListItem[]; } diff --git a/src/api/types/ArticleStatistics.ts b/src/api/types/ArticleStatistics.ts index 00301798..6fffbb4f 100644 --- a/src/api/types/ArticleStatistics.ts +++ b/src/api/types/ArticleStatistics.ts @@ -11,7 +11,7 @@ export interface ArticleStatistics { /** The number of total views the article has received. */ views: number; /** The number of conversations started from the article. */ - conversions: number; + conversions?: number; /** The number of total reactions the article has received. */ reactions: number; /** The percentage of happy reactions the article has received against other types of reaction. */ diff --git a/src/api/types/ArticleTranslatedContent.ts b/src/api/types/ArticleTranslatedContent.ts index 48f103b3..73ec4969 100644 --- a/src/api/types/ArticleTranslatedContent.ts +++ b/src/api/types/ArticleTranslatedContent.ts @@ -9,7 +9,7 @@ import * as Intercom from "../index"; */ export interface ArticleTranslatedContent { /** The type of object - article_translated_content. */ - type?: "article_translated_content"; + type?: string; /** The content of the article in Arabic */ ar?: Intercom.ArticleContent; /** The content of the article in Bulgarian */ diff --git a/src/api/types/AwayStatusReason.ts b/src/api/types/AwayStatusReason.ts new file mode 100644 index 00000000..02f9e7a8 --- /dev/null +++ b/src/api/types/AwayStatusReason.ts @@ -0,0 +1,21 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface AwayStatusReason { + type?: string; + /** The unique identifier for the away status reason */ + id?: string; + /** The display text for the away status reason */ + label?: string; + /** The emoji associated with the status reason */ + emoji?: string; + /** The display order of the status reason */ + order?: number; + /** Whether the status reason has been soft deleted */ + deleted?: boolean; + /** The Unix timestamp when the status reason was created */ + created_at?: number; + /** The Unix timestamp when the status reason was last updated */ + updated_at?: number; +} diff --git a/src/api/types/ButtonComponent.ts b/src/api/types/ButtonComponent.ts deleted file mode 100644 index fa419ed8..00000000 --- a/src/api/types/ButtonComponent.ts +++ /dev/null @@ -1,36 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as Intercom from "../index"; - -/** - * A button component is used to take an action by clicking a button. This can either: - * - [Trigger a submit request to be sent](https://developers.intercom.com/docs/references/canvas-kit/actioncomponents/submit-action) Inbox Messenger - * - [Open a link in a new page](https://developers.intercom.com/docs/references/canvas-kit/actioncomponents/url-action) Inbox Messenger - * - [Open a sheet](https://developers.intercom.com/docs/references/canvas-kit/actioncomponents/sheets-action) Messenger - */ -export interface ButtonComponent { - /** A unique identifier for the component. */ - id: string; - /** The text that will be rendered inside the button. */ - label: string; - /** This can be a Submit Action, URL Action, or Sheets Action. */ - action: Intercom.ActionComponent; - /** Styles the button. Default is 'primary'. */ - style?: ButtonComponent.Style; - /** Styles the button and prevents the action. Default is false. */ - disabled?: boolean; -} - -export namespace ButtonComponent { - /** - * Styles the button. Default is 'primary'. - */ - export type Style = "primary" | "secondary" | "link"; - export const Style = { - Primary: "primary", - Secondary: "secondary", - Link: "link", - } as const; -} diff --git a/src/api/types/CallList.ts b/src/api/types/CallList.ts new file mode 100644 index 00000000..52e61a00 --- /dev/null +++ b/src/api/types/CallList.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Intercom from "../index"; + +/** + * A paginated list of calls. + */ +export interface CallList { + /** String representing the object's type. Always has the value `list`. */ + type?: string; + /** A list of calls. */ + data?: Intercom.Call[]; + /** Total number of items available. */ + total_count?: number; + pages?: Intercom.CursorPages; +} diff --git a/src/api/types/CanvasObject.ts b/src/api/types/CanvasObject.ts deleted file mode 100644 index bb6161d3..00000000 --- a/src/api/types/CanvasObject.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as Intercom from "../index"; - -/** - * You have to respond to the majority of requests with a canvas object. This will tell us what UI to show for your app. - * - * A canvas can either be static (meaning we send you the next request only when an action takes place) or live (meaning we send you the next request when someone views the app). - * - * - A static canvas needs a ContentObject which will contain the components to show. - * - A live canvas needs a `content_url` which we we will make the Live Canvas requests to when the app is viewed. This is only possible for apps viewed or used in the Messenger. - */ -export interface CanvasObject { - /** The content object that will be shown as the UI of the app. Max Size is 64KB. */ - content: Intercom.ContentObject; - /** The URL which we make Live Canvas requests to. You must respond to these with a content object. Max size is 64KB. */ - content_url?: string; - /** Optional Stored Data that you want to be returned in the next sent request. Max Size is 64KB. */ - stored_data?: Record; -} diff --git a/src/api/types/CheckboxComponent.ts b/src/api/types/CheckboxComponent.ts deleted file mode 100644 index ddd79298..00000000 --- a/src/api/types/CheckboxComponent.ts +++ /dev/null @@ -1,39 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as Intercom from "../index"; - -/** - * A checkbox component is used to capture multiple choices from as many options as you want to provide. You can submit the options by: - * - * - Using a ButtonComponent (which will submit all interactive components in the canvas) - * - * When a submit action takes place, the results are given in a hash with the `id` from the checkbox component used as the key and an array containing the `id` of each chosen option as the value. - */ -export interface CheckboxComponent { - /** A unique identifier for the component. */ - id: string; - /** The list of options. Minimum of 1. */ - option: Intercom.CheckboxOption[]; - /** The text shown above the options. */ - label: string; - /** The option's that are selected by default. */ - value?: string[]; - /** Styles the input. Default is `unsaved`. Prevent action with `saved`. */ - save_state?: CheckboxComponent.SaveState; - /** Styles all options and prevents the action. Default is false. Will be overridden if save_state is saved. */ - disabled?: boolean; -} - -export namespace CheckboxComponent { - /** - * Styles the input. Default is `unsaved`. Prevent action with `saved`. - */ - export type SaveState = "unsaved" | "saved" | "failed"; - export const SaveState = { - Unsaved: "unsaved", - Saved: "saved", - Failed: "failed", - } as const; -} diff --git a/src/api/types/CheckboxOption.ts b/src/api/types/CheckboxOption.ts deleted file mode 100644 index d33bb8fe..00000000 --- a/src/api/types/CheckboxOption.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -/** - * A checkbox option component that can be selected. - */ -export interface CheckboxOption { - /** The type of component you are rendering. */ - type: "option"; - /** A unique identifier for the option. */ - id: string; - /** The text shown next to the checkbox. */ - text: string; - /** Styles the option and prevents the action. Default is false. */ - disabled?: boolean; -} diff --git a/src/api/types/CollectionList.ts b/src/api/types/CollectionList.ts index 3260e2c6..3ba6b1bc 100644 --- a/src/api/types/CollectionList.ts +++ b/src/api/types/CollectionList.ts @@ -9,10 +9,10 @@ import * as Intercom from "../index"; */ export interface CollectionList { /** The type of the object - `list`. */ - type: "list"; + type?: "list"; pages?: Intercom.OffsetPages; /** A count of the total number of collections. */ - total_count: number; + total_count?: number; /** An array of collection objects */ - data: Intercom.Collection[]; + data?: Intercom.Collection[]; } diff --git a/src/api/types/CompanyAttachedContacts.ts b/src/api/types/CompanyAttachedContacts.ts index a07697e9..4a9da8ce 100644 --- a/src/api/types/CompanyAttachedContacts.ts +++ b/src/api/types/CompanyAttachedContacts.ts @@ -9,10 +9,10 @@ import * as Intercom from "../index"; */ export interface CompanyAttachedContacts { /** The type of object - `list` */ - type: "list"; + type?: "list"; /** An array containing Contact Objects */ - data: Intercom.Contact[]; + data?: Intercom.Contact[]; /** The total number of contacts */ - total_count: number; + total_count?: number; pages?: Intercom.CursorPages; } diff --git a/src/api/types/CompanyAttachedSegments.ts b/src/api/types/CompanyAttachedSegments.ts index 12c36438..9e3044ae 100644 --- a/src/api/types/CompanyAttachedSegments.ts +++ b/src/api/types/CompanyAttachedSegments.ts @@ -9,7 +9,7 @@ import * as Intercom from "../index"; */ export interface CompanyAttachedSegments { /** The type of object - `list` */ - type: "list"; + type?: "list"; /** An array containing Segment Objects */ - data: Intercom.Segment[]; + data?: Intercom.Segment[]; } diff --git a/src/api/types/CompanyData.ts b/src/api/types/CompanyData.ts new file mode 100644 index 00000000..de38845a --- /dev/null +++ b/src/api/types/CompanyData.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * An object containing data about the companies that a contact is associated with. + */ +export interface CompanyData { + /** The unique identifier for the company which is given by Intercom. */ + id?: string; + /** The type of the object. Always company. */ + type?: "company"; + /** The relative URL of the company. */ + url?: string; +} diff --git a/src/api/types/CompanyList.ts b/src/api/types/CompanyList.ts index 8d4eb5de..91b49465 100644 --- a/src/api/types/CompanyList.ts +++ b/src/api/types/CompanyList.ts @@ -10,7 +10,7 @@ import * as Intercom from "../index"; export interface CompanyList { pages?: Intercom.OffsetPages; /** The total number of companies. */ - total_count: number; + total_count?: number; /** An array containing Company Objects. */ - data: Intercom.Company[]; + data?: Intercom.Company[]; } diff --git a/src/api/types/CompanyScroll.ts b/src/api/types/CompanyScroll.ts index dd606955..b12a046f 100644 --- a/src/api/types/CompanyScroll.ts +++ b/src/api/types/CompanyScroll.ts @@ -9,8 +9,8 @@ import * as Intercom from "../index"; */ export interface CompanyScroll { /** The type of object - `list` */ - type: "list"; - data: Intercom.Company[]; + type?: "list"; + data?: Intercom.Company[]; pages?: Intercom.CursorPages; /** The total number of companies */ total_count?: number; diff --git a/src/api/types/Component.ts b/src/api/types/Component.ts deleted file mode 100644 index d2de298c..00000000 --- a/src/api/types/Component.ts +++ /dev/null @@ -1,69 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as Intercom from "../index"; - -export type Component = - | Intercom.Component.Button - | Intercom.Component.Checkbox - | Intercom.Component.Dropdown - | Intercom.Component.Input - | Intercom.Component.List - | Intercom.Component.SingleSelect - | Intercom.Component.Textarea - | Intercom.Component.DataTable - | Intercom.Component.Divider - | Intercom.Component.Image - | Intercom.Component.Spacer - | Intercom.Component.Text; - -export namespace Component { - export interface Button extends Intercom.ButtonComponent { - type: "button"; - } - - export interface Checkbox extends Intercom.CheckboxComponent { - type: "checkbox"; - } - - export interface Dropdown extends Intercom.DropdownComponent { - type: "dropdown"; - } - - export interface Input extends Intercom.InputComponent { - type: "input"; - } - - export interface List extends Intercom.ListComponent { - type: "list"; - } - - export interface SingleSelect extends Intercom.SingleSelectComponent { - type: "single-select"; - } - - export interface Textarea extends Intercom.TextAreaComponent { - type: "textarea"; - } - - export interface DataTable extends Intercom.DataTableComponent { - type: "data-table"; - } - - export interface Divider extends Intercom.DividerComponent { - type: "divider"; - } - - export interface Image extends Intercom.ImageComponent { - type: "image"; - } - - export interface Spacer extends Intercom.SpacerComponent { - type: "spacer"; - } - - export interface Text extends Intercom.TextComponent { - type: "text"; - } -} diff --git a/src/api/types/ConfigureRequest.ts b/src/api/types/ConfigureRequest.ts deleted file mode 100644 index b565bb2b..00000000 --- a/src/api/types/ConfigureRequest.ts +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as Intercom from "../index"; - -/** - * The first request we send will allow you to know the workspace where this is happening, the admin who will be configuring the app, and additional context such as where this will be added once complete. - * - * For subsequent requests whereby an admin has interacted with a component with a submit action, the request payload will contain the same details with `current_canvas`, `input_values` and the `component_id` also present. This allows you to understand what component the request came from, see what the value of any input was, action anything in your codebase, and then respond knowing what canvas was previously shown beforehand. - */ -export type ConfigureRequest = - | { - workspace_id: string; - admin: Intercom.Admin; - context: Intercom.Context; - } - | { - workspace_id: string; - workspace_region: string; - component_id: string; - admin: Intercom.Admin; - context: Intercom.Context; - current_canvas: Intercom.CanvasObject; - input_values: Record; - }; diff --git a/src/api/types/ConfigureResponse.ts b/src/api/types/ConfigureResponse.ts deleted file mode 100644 index 08ad2508..00000000 --- a/src/api/types/ConfigureResponse.ts +++ /dev/null @@ -1,16 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as Intercom from "../index"; - -/** - * The response object returned when configuring an app. This will either: - * - A canvas object which will replace the previous canvas that was visible until the teammate interacted with your app - * - A results object which will end the configuration and trigger the initialize request to be sent. There will be a card_creation_options object in the payload showing your key-value pairs from the results object. - */ -export type ConfigureResponse = - | Intercom.ResultsResponse - | { - canvas: Intercom.CanvasObject; - }; diff --git a/src/api/types/ContactArchived.ts b/src/api/types/ContactArchived.ts index 882c4bec..62393995 100644 --- a/src/api/types/ContactArchived.ts +++ b/src/api/types/ContactArchived.ts @@ -2,16 +2,12 @@ * This file was auto-generated by Fern from our API Definition. */ +import * as Intercom from "../index"; + /** * archived contact object */ -export interface ContactArchived { - /** always contact */ - type: "contact"; - /** The unique identifier for the contact which is given by Intercom. */ - id: string; - /** The unique identifier for the contact which is provided by the Client. */ - external_id?: string; +export interface ContactArchived extends Intercom.ContactReference { /** Whether the contact is archived or not. */ - archived: boolean; + archived?: boolean; } diff --git a/src/api/types/ContactAttachedCompanies.ts b/src/api/types/ContactAttachedCompanies.ts index 3c73d361..7da7a991 100644 --- a/src/api/types/ContactAttachedCompanies.ts +++ b/src/api/types/ContactAttachedCompanies.ts @@ -9,10 +9,10 @@ import * as Intercom from "../index"; */ export interface ContactAttachedCompanies { /** The type of object */ - type: "list"; + type?: "list"; /** An array containing Company Objects */ - companies: Intercom.Company[]; + companies?: Intercom.Company[]; /** The total number of companies associated to this contact */ - total_count: number; + total_count?: number; pages?: Intercom.PagesLink; } diff --git a/src/api/types/ContactBlocked.ts b/src/api/types/ContactBlocked.ts new file mode 100644 index 00000000..dea43876 --- /dev/null +++ b/src/api/types/ContactBlocked.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Intercom from "../index"; + +/** + * blocked contact object + */ +export interface ContactBlocked extends Intercom.ContactReference { + /** Always true. */ + blocked?: boolean; +} diff --git a/src/api/types/ContactCompanies.ts b/src/api/types/ContactCompanies.ts index 88980a31..3e71827e 100644 --- a/src/api/types/ContactCompanies.ts +++ b/src/api/types/ContactCompanies.ts @@ -5,17 +5,15 @@ import * as Intercom from "../index"; /** - * An object containing companies meta data about the companies that a contact has. Up to 10 will be displayed here. Use the url to get more. + * An object with metadata about companies attached to a contact . Up to 10 will be displayed here. Use the url to get more. */ export interface ContactCompanies { - /** The type of object */ - type?: "list"; - /** An array containing Company Objects */ - data?: Intercom.ContactCompany[]; + /** An array of company data objects attached to the contact. */ + data?: Intercom.CompanyData[]; /** Url to get more company resources for this contact */ - url: string; - /** Int representing the total number of companyies attached to this contact */ - total_count: number; + url?: string; + /** Integer representing the total number of companies attached to this contact */ + total_count?: number; /** Whether there's more Addressable Objects to be viewed. If true, use the url to view all */ - has_more: boolean; + has_more?: boolean; } diff --git a/src/api/types/ContactCompany.ts b/src/api/types/ContactCompany.ts deleted file mode 100644 index cfe15a56..00000000 --- a/src/api/types/ContactCompany.ts +++ /dev/null @@ -1,15 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -/** - * A reference to a company associated with a contact - */ -export interface ContactCompany { - /** The unique identifier for the company */ - id: string; - /** The type of the object */ - type: "company"; - /** URL to get the full company resource */ - url: string; -} diff --git a/src/api/types/ContactDeleted.ts b/src/api/types/ContactDeleted.ts index 12d7b0c6..8f11f435 100644 --- a/src/api/types/ContactDeleted.ts +++ b/src/api/types/ContactDeleted.ts @@ -2,16 +2,12 @@ * This file was auto-generated by Fern from our API Definition. */ +import * as Intercom from "../index"; + /** * deleted contact object */ -export interface ContactDeleted { - /** always contact */ - type: "contact"; - /** The unique identifier for the contact which is given by Intercom. */ - id: string; - /** The unique identifier for the contact which is provided by the Client. */ - external_id?: string; +export interface ContactDeleted extends Intercom.ContactReference { /** Whether the contact is deleted or not. */ - deleted: boolean; + deleted?: boolean; } diff --git a/src/api/types/ContactList.ts b/src/api/types/ContactList.ts index fd188c1a..dbaf1222 100644 --- a/src/api/types/ContactList.ts +++ b/src/api/types/ContactList.ts @@ -9,10 +9,10 @@ import * as Intercom from "../index"; */ export interface ContactList { /** Always list */ - type: "list"; + type?: "list"; /** The list of contact objects */ - data: Intercom.Contact[]; + data?: Intercom.Contact[]; /** A count of the total number of objects. */ - total_count: number; + total_count?: number; pages?: Intercom.CursorPages; } diff --git a/src/api/types/ContactLocation.ts b/src/api/types/ContactLocation.ts index 2e079a7c..6f3ca2ec 100644 --- a/src/api/types/ContactLocation.ts +++ b/src/api/types/ContactLocation.ts @@ -7,7 +7,7 @@ */ export interface ContactLocation { /** Always location */ - type: "location"; + type?: string; /** The country that the contact is located in */ country?: string; /** The overal region that the contact is located in */ diff --git a/src/api/types/ContactNotes.ts b/src/api/types/ContactNotes.ts index 56f4b090..ced63f78 100644 --- a/src/api/types/ContactNotes.ts +++ b/src/api/types/ContactNotes.ts @@ -9,11 +9,11 @@ import * as Intercom from "../index"; */ export interface ContactNotes { /** This object represents the notes attached to a contact. */ - data: Intercom.AddressableList[]; + data?: Intercom.AddressableList[]; /** Url to get more company resources for this contact */ - url: string; + url?: string; /** Int representing the total number of companyies attached to this contact */ - total_count: number; + total_count?: number; /** Whether there's more Addressable Objects to be viewed. If true, use the url to view all */ - has_more: boolean; + has_more?: boolean; } diff --git a/src/api/types/ContactReference.ts b/src/api/types/ContactReference.ts index 06dcf74e..d202aadc 100644 --- a/src/api/types/ContactReference.ts +++ b/src/api/types/ContactReference.ts @@ -7,9 +7,9 @@ */ export interface ContactReference { /** always contact */ - type: "contact"; + type?: "contact"; /** The unique identifier for the contact which is given by Intercom. */ - id: string; + id?: string; /** The unique identifier for the contact which is provided by the Client. */ external_id?: string; } diff --git a/src/api/types/ContactReplyBaseRequest.ts b/src/api/types/ContactReplyBaseRequest.ts index 74f679c9..0559f83e 100644 --- a/src/api/types/ContactReplyBaseRequest.ts +++ b/src/api/types/ContactReplyBaseRequest.ts @@ -11,4 +11,19 @@ export interface ContactReplyBaseRequest { created_at?: number; /** A list of image URLs that will be added as attachments. You can include up to 10 URLs. */ attachment_urls?: string[]; + /** The quick reply selection the contact wishes to respond with. These map to buttons displayed in the Messenger UI if sent by a bot, or the reply options sent by an Admin via the API. */ + reply_options?: ContactReplyBaseRequest.ReplyOptions.Item[]; +} + +export namespace ContactReplyBaseRequest { + export type ReplyOptions = ReplyOptions.Item[]; + + export namespace ReplyOptions { + export interface Item { + /** The text of the chosen reply option. */ + text: string; + /** The unique identifier for the quick reply option selected. */ + uuid: string; + } + } } diff --git a/src/api/types/ContactSegments.ts b/src/api/types/ContactSegments.ts index cb9bc850..609b3aa3 100644 --- a/src/api/types/ContactSegments.ts +++ b/src/api/types/ContactSegments.ts @@ -9,7 +9,7 @@ import * as Intercom from "../index"; */ export interface ContactSegments { /** The type of the object */ - type: "list"; + type?: "list"; /** Segment objects associated with the contact. */ - data: Intercom.Segment[]; + data?: Intercom.Segment[]; } diff --git a/src/api/types/ContactSocialProfiles.ts b/src/api/types/ContactSocialProfiles.ts index baf40a04..c85479b1 100644 --- a/src/api/types/ContactSocialProfiles.ts +++ b/src/api/types/ContactSocialProfiles.ts @@ -9,5 +9,5 @@ import * as Intercom from "../index"; */ export interface ContactSocialProfiles { /** A list of social profiles objects associated with the contact. */ - data: Intercom.SocialProfile[]; + data?: Intercom.SocialProfile[]; } diff --git a/src/api/types/ContactSubscriptionTypes.ts b/src/api/types/ContactSubscriptionTypes.ts index ff8cd650..09f9834e 100644 --- a/src/api/types/ContactSubscriptionTypes.ts +++ b/src/api/types/ContactSubscriptionTypes.ts @@ -9,11 +9,11 @@ import * as Intercom from "../index"; */ export interface ContactSubscriptionTypes { /** This object represents the subscriptions attached to a contact. */ - data: Intercom.AddressableList[]; + data?: Intercom.AddressableList[]; /** Url to get more subscription type resources for this contact */ - url: string; + url?: string; /** Int representing the total number of subscription types attached to this contact */ - total_count: number; + total_count?: number; /** Whether there's more Addressable Objects to be viewed. If true, use the url to view all */ - has_more: boolean; + has_more?: boolean; } diff --git a/src/api/types/ContactTags.ts b/src/api/types/ContactTags.ts index 6ed9fd6d..5b327cf0 100644 --- a/src/api/types/ContactTags.ts +++ b/src/api/types/ContactTags.ts @@ -9,11 +9,11 @@ import * as Intercom from "../index"; */ export interface ContactTags { /** This object represents the tags attached to a contact. */ - data: Intercom.AddressableList[]; + data?: Intercom.AddressableList[]; /** url to get more tag resources for this contact */ - url: string; + url?: string; /** Int representing the total number of tags attached to this contact */ - total_count: number; + total_count?: number; /** Whether there's more Addressable Objects to be viewed. If true, use the url to view all */ - has_more: boolean; + has_more?: boolean; } diff --git a/src/api/types/ContactUnarchived.ts b/src/api/types/ContactUnarchived.ts index 7940f0f1..238c5924 100644 --- a/src/api/types/ContactUnarchived.ts +++ b/src/api/types/ContactUnarchived.ts @@ -2,16 +2,12 @@ * This file was auto-generated by Fern from our API Definition. */ +import * as Intercom from "../index"; + /** * unarchived contact object */ -export interface ContactUnarchived { - /** always contact */ - type: "contact"; - /** The unique identifier for the contact which is given by Intercom. */ - id: string; - /** The unique identifier for the contact which is provided by the Client. */ - external_id?: string; +export interface ContactUnarchived extends Intercom.ContactReference { /** Whether the contact is archived or not. */ - archived: boolean; + archived?: boolean; } diff --git a/src/api/types/ContentObject.ts b/src/api/types/ContentObject.ts deleted file mode 100644 index 127b8d88..00000000 --- a/src/api/types/ContentObject.ts +++ /dev/null @@ -1,15 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as Intercom from "../index"; - -/** - * The content object is where you specify the UI of your app. You provide us with a set of `components` in a components array that we then render. - * - * The content object should usually be returned within the [canvas object](https://developers.intercom.com/docs/references/canvas-kit/responseobjects/canvas). If you're responding to a Live Canvas request however, then you should only respond with the content object. - */ -export interface ContentObject { - /** The list of components to be rendered. */ - components: Intercom.Component[]; -} diff --git a/src/api/types/ContentSourcesList.ts b/src/api/types/ContentSourcesList.ts index 28044b85..5d3833b6 100644 --- a/src/api/types/ContentSourcesList.ts +++ b/src/api/types/ContentSourcesList.ts @@ -5,9 +5,9 @@ import * as Intercom from "../index"; export interface ContentSourcesList { - type: "content_source.list"; + type?: "content_source.list"; /** The total number of content sources used by AI Agent in the conversation. */ - total_count: number; + total_count?: number; /** The content sources used by AI Agent in the conversation. */ - content_sources: Intercom.ContentSource[]; + content_sources?: Intercom.ContentSource[]; } diff --git a/src/api/types/Context.ts b/src/api/types/Context.ts deleted file mode 100644 index c86d4597..00000000 --- a/src/api/types/Context.ts +++ /dev/null @@ -1,36 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -/** - * The context object provides additional details on where the app has been added (or is currently being used), what page the app is being used on, and information on the Messenger settings. This is in order for you give a fully customised experience based on the customers use case. - * - * If the `location` is `conversation` then you will also be given a `conversation_id`. If you need to use details about the conversation, then you have to use the `conversation_id` to [make a call to our Conversations API and retrieve the conversation object](https://developers.intercom.com/intercom-api-reference/reference#get-a-single-conversation). - */ -export interface Context { - /** The id of the conversation where the app is added or being used. */ - conversation_id?: number; - /** Where the app is added or the action took place. Can be either 'conversation', 'home', 'message', or 'operator'. */ - location?: Context.Location; - /** The default end-user language of the Messenger. Use to localise Messenger App content. */ - locale?: string; - /** The messengers action colour. Use in Sheets and Icons to make a Messenger App experience feel part of the host Messenger. */ - messenger_action_colour?: string; - /** The messengers background colour. Use in Sheets and Icons to make a Messenger App experience feel part of the host Messenger. */ - messenger_background_colour?: string; - /** The current page URL where the app is being used. */ - referrer?: string; -} - -export namespace Context { - /** - * Where the app is added or the action took place. Can be either 'conversation', 'home', 'message', or 'operator'. - */ - export type Location = "conversation" | "home" | "message" | "operator"; - export const Location = { - Conversation: "conversation", - Home: "home", - Message: "message", - Operator: "operator", - } as const; -} diff --git a/src/api/types/ConversationAttachmentFiles.ts b/src/api/types/ConversationAttachmentFiles.ts index df8323f1..98d751b4 100644 --- a/src/api/types/ConversationAttachmentFiles.ts +++ b/src/api/types/ConversationAttachmentFiles.ts @@ -7,9 +7,9 @@ */ export interface ConversationAttachmentFiles { /** The content type of the file */ - content_type: string; + content_type?: string; /** The base64 encoded file data. */ - data: string; + data?: string; /** The name of the file. */ - name: string; + name?: string; } diff --git a/src/api/types/ConversationAttributeUpdatedByAdmin.ts b/src/api/types/ConversationAttributeUpdatedByAdmin.ts new file mode 100644 index 00000000..1c49cecf --- /dev/null +++ b/src/api/types/ConversationAttributeUpdatedByAdmin.ts @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Contains details about Custom Data Attributes (CDAs) that were modified by an admin (operator) for conversation part type conversation_attribute_updated_by_admin. + */ +export interface ConversationAttributeUpdatedByAdmin { + attribute?: ConversationAttributeUpdatedByAdmin.Attribute; + value?: ConversationAttributeUpdatedByAdmin.Value; +} + +export namespace ConversationAttributeUpdatedByAdmin { + export interface Attribute { + /** Name of the CDA updated */ + name?: string; + } + + export interface Value { + /** Value of the CDA updated */ + name?: string; + } +} diff --git a/src/api/types/ConversationAttributeUpdatedByWorkflow.ts b/src/api/types/ConversationAttributeUpdatedByWorkflow.ts new file mode 100644 index 00000000..65572650 --- /dev/null +++ b/src/api/types/ConversationAttributeUpdatedByWorkflow.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Contains details about the workflow that was triggered and any Custom Data Attributes (CDAs) that were modified during the workflow execution for conversation part type conversation_attribute_updated_by_workflow. + */ +export interface ConversationAttributeUpdatedByWorkflow { + workflow?: ConversationAttributeUpdatedByWorkflow.Workflow; + attribute?: ConversationAttributeUpdatedByWorkflow.Attribute; + value?: ConversationAttributeUpdatedByWorkflow.Value; +} + +export namespace ConversationAttributeUpdatedByWorkflow { + export interface Workflow { + /** Name of the workflow */ + name?: string; + } + + export interface Attribute { + /** Name of the CDA updated */ + name?: string; + } + + export interface Value { + /** Value of the CDA updated */ + name?: string; + } +} diff --git a/src/api/types/ConversationContacts.ts b/src/api/types/ConversationContacts.ts index c76e082d..1c481c90 100644 --- a/src/api/types/ConversationContacts.ts +++ b/src/api/types/ConversationContacts.ts @@ -8,7 +8,8 @@ import * as Intercom from "../index"; * The list of contacts (users or leads) involved in this conversation. This will only contain one customer unless more were added via the group conversation feature. */ export interface ConversationContacts { - type: "contact.list"; + /** */ + type?: "contact.list"; /** The list of contacts (users or leads) involved in this conversation. This will only contain one customer unless more were added via the group conversation feature. */ - contacts: Intercom.ContactReference[]; + contacts?: Intercom.ContactReference[]; } diff --git a/src/api/types/ConversationDeleted.ts b/src/api/types/ConversationDeleted.ts new file mode 100644 index 00000000..c45bc58f --- /dev/null +++ b/src/api/types/ConversationDeleted.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * deleted conversation object + */ +export interface ConversationDeleted { + /** The unique identifier for the conversation. */ + id?: string; + /** always conversation */ + object?: "conversation"; + /** Whether the conversation is deleted or not. */ + deleted?: boolean; +} diff --git a/src/api/types/ConversationFirstContactReply.ts b/src/api/types/ConversationFirstContactReply.ts index efef9c6a..7d859b74 100644 --- a/src/api/types/ConversationFirstContactReply.ts +++ b/src/api/types/ConversationFirstContactReply.ts @@ -7,9 +7,9 @@ */ export interface ConversationFirstContactReply { /** */ - created_at: number; + created_at?: number; /** */ - type: string; + type?: string; /** */ url?: string; } diff --git a/src/api/types/PaginatedConversationResponse.ts b/src/api/types/ConversationList.ts similarity index 76% rename from src/api/types/PaginatedConversationResponse.ts rename to src/api/types/ConversationList.ts index 4a319f84..9d9f7e0a 100644 --- a/src/api/types/PaginatedConversationResponse.ts +++ b/src/api/types/ConversationList.ts @@ -7,12 +7,12 @@ import * as Intercom from "../index"; /** * Conversations are how you can communicate with users in Intercom. They are created when a contact replies to an outbound message, or when one admin directly sends a message to a single contact. */ -export interface PaginatedConversationResponse { +export interface ConversationList { /** Always conversation.list */ - type: "conversation.list"; + type?: "conversation.list"; /** The list of conversation objects */ - conversations: Intercom.Conversation[]; + conversations?: Intercom.Conversation[]; /** A count of the total number of objects. */ - total_count: number; + total_count?: number; pages?: Intercom.CursorPages; } diff --git a/src/api/types/ConversationPart.ts b/src/api/types/ConversationPart.ts index 51fcf06a..76ede947 100644 --- a/src/api/types/ConversationPart.ts +++ b/src/api/types/ConversationPart.ts @@ -9,26 +9,47 @@ import * as Intercom from "../index"; */ export interface ConversationPart { /** Always conversation_part */ - type: "conversation_part"; + type?: string; /** The id representing the conversation part. */ - id: string; + id?: string; /** The type of conversation part. */ - part_type: string; + part_type?: string; /** The message body, which may contain HTML. For Twitter, this will show a generic message regarding why the body is obscured. */ body?: string; /** The time the conversation part was created. */ - created_at: number; + created_at?: number; /** The last time the conversation part was updated. */ updated_at?: number; /** The time the user was notified with the conversation part. */ - notified_at: number; + notified_at?: number; /** The id of the admin that was assigned the conversation by this conversation_part (null if there has been no change in assignment.) */ assigned_to?: Intercom.Reference; - author: Intercom.ConversationPartAuthor; + author?: Intercom.ConversationPartAuthor; /** A list of attachments for the part. */ attachments?: Intercom.PartAttachment[]; /** The external id of the conversation part */ external_id?: string; /** Whether or not the conversation part has been redacted. */ - redacted: boolean; + redacted?: boolean; + email_message_metadata?: Intercom.EmailMessageMetadata; + metadata?: Intercom.ConversationPartMetadata; + /** Indicates the current state of conversation when the conversation part was created. */ + state?: ConversationPart.State; + /** A list of tags objects associated with the conversation part. */ + tags?: Intercom.TagBasic[]; + event_details?: Intercom.EventDetails; + /** The app package code if this part was created via API. null if the part was not created via API. */ + app_package_code?: string; +} + +export namespace ConversationPart { + /** + * Indicates the current state of conversation when the conversation part was created. + */ + export type State = "open" | "closed" | "snoozed"; + export const State = { + Open: "open", + Closed: "closed", + Snoozed: "snoozed", + } as const; } diff --git a/src/api/types/ConversationPartAuthor.ts b/src/api/types/ConversationPartAuthor.ts index 36495f34..01a62b9f 100644 --- a/src/api/types/ConversationPartAuthor.ts +++ b/src/api/types/ConversationPartAuthor.ts @@ -7,11 +7,15 @@ */ export interface ConversationPartAuthor { /** The type of the author */ - type: string; + type?: string; /** The id of the author */ - id: string; + id?: string; /** The name of the author */ - name: string; + name?: string; /** The email of the author */ - email: string; + email?: string; + /** If this conversation part was sent by the AI Agent */ + from_ai_agent?: boolean; + /** If this conversation part body was generated by the AI Agent */ + is_ai_answer?: boolean; } diff --git a/src/api/types/ConversationPartMetadata.ts b/src/api/types/ConversationPartMetadata.ts new file mode 100644 index 00000000..0ef9495d --- /dev/null +++ b/src/api/types/ConversationPartMetadata.ts @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Intercom from "../index"; + +/** + * Metadata for a conversation part + */ +export interface ConversationPartMetadata { + /** The quick reply options sent by the Admin or bot, presented in this conversation part. */ + quick_reply_options?: ConversationPartMetadata.QuickReplyOptions.Item[]; + /** The unique identifier for the quick reply option that was clicked by the end user. */ + quick_reply_uuid?: string; +} + +export namespace ConversationPartMetadata { + export type QuickReplyOptions = QuickReplyOptions.Item[]; + + export namespace QuickReplyOptions { + export interface Item extends Intercom.QuickReplyOption { + /** The translations for the quick reply option. */ + translations?: Record; + } + } +} diff --git a/src/api/types/ConversationParts.ts b/src/api/types/ConversationParts.ts index 2d0114df..ab11da74 100644 --- a/src/api/types/ConversationParts.ts +++ b/src/api/types/ConversationParts.ts @@ -9,9 +9,9 @@ import * as Intercom from "../index"; */ export interface ConversationParts { /** */ - type: "conversation_part.list"; + type?: "conversation_part.list"; /** A list of Conversation Part objects for each part message in the conversation. This is only returned when Retrieving a Conversation, and ignored when Listing all Conversations. There is a limit of 500 parts. */ - conversation_parts: Intercom.ConversationPart[]; + conversation_parts?: Intercom.ConversationPart[]; /** */ - total_count: number; + total_count?: number; } diff --git a/src/api/types/ConversationRating.ts b/src/api/types/ConversationRating.ts index 96209e62..46d14a6e 100644 --- a/src/api/types/ConversationRating.ts +++ b/src/api/types/ConversationRating.ts @@ -9,11 +9,13 @@ import * as Intercom from "../index"; */ export interface ConversationRating { /** The rating, between 1 and 5, for the conversation. */ - rating: number; + rating?: number; /** An optional field to add a remark to correspond to the number rating */ - remark: string; + remark?: string; /** The time the rating was requested in the conversation being rated. */ - created_at: number; - contact: Intercom.ContactReference; - teammate: Intercom.Reference; + created_at?: number; + /** The time the rating was last updated. */ + updated_at?: number; + contact?: Intercom.ContactReference; + teammate?: Intercom.Reference; } diff --git a/src/api/types/ConversationResponseTime.ts b/src/api/types/ConversationResponseTime.ts new file mode 100644 index 00000000..56d2b0ae --- /dev/null +++ b/src/api/types/ConversationResponseTime.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Details of first response time of assigned team in seconds. + */ +export interface ConversationResponseTime { + /** Id of the assigned team. */ + team_id?: number; + /** Name of the assigned Team, null if team does not exist, Unassigned if no team is assigned. */ + team_name?: string; + /** First response time of assigned team in seconds. */ + response_time?: number; +} diff --git a/src/api/types/ConversationSource.ts b/src/api/types/ConversationSource.ts index 7dcaf810..5d268b83 100644 --- a/src/api/types/ConversationSource.ts +++ b/src/api/types/ConversationSource.ts @@ -5,26 +5,26 @@ import * as Intercom from "../index"; /** - * The Conversation Part that originated this conversation, which can be Contact, Admin, Campaign, Automated or Operator initiated. + * The type of the conversation part that started this conversation. Can be Contact, Admin, Campaign, Automated or Operator initiated. */ export interface ConversationSource { /** This includes conversation, email, facebook, instagram, phone_call, phone_switch, push, sms, twitter and whatsapp. */ - type: ConversationSource.Type; + type?: ConversationSource.Type; /** The id representing the message. */ - id: string; + id?: string; /** The conversation's initiation type. Possible values are customer_initiated, campaigns_initiated (legacy campaigns), operator_initiated (Custom bot), automated (Series and other outbounds with dynamic audience message) and admin_initiated (fixed audience message, ticket initiated by an admin, group email). */ - delivered_as: string; + delivered_as?: string; /** Optional. The message subject. For Twitter, this will show a generic message regarding why the subject is obscured. */ - subject: string; + subject?: string; /** The message body, which may contain HTML. For Twitter, this will show a generic message regarding why the body is obscured. */ body?: string; - author: Intercom.ConversationPartAuthor; + author?: Intercom.ConversationPartAuthor; /** A list of attachments for the part. */ attachments?: Intercom.PartAttachment[]; /** The URL where the conversation was started. For Twitter, Email, and Bots, this will be blank. */ url?: string; /** Whether or not the source message has been redacted. Only applicable for contact initiated messages. */ - redacted: boolean; + redacted?: boolean; } export namespace ConversationSource { diff --git a/src/api/types/ConversationStatistics.ts b/src/api/types/ConversationStatistics.ts index 18444e0d..a38b06e7 100644 --- a/src/api/types/ConversationStatistics.ts +++ b/src/api/types/ConversationStatistics.ts @@ -2,12 +2,14 @@ * This file was auto-generated by Fern from our API Definition. */ +import * as Intercom from "../index"; + /** * A Statistics object containing all information required for reporting, with timestamps and calculated metrics. */ export interface ConversationStatistics { /** */ - type: "conversation_statistics"; + type?: string; /** Duration until last assignment before first admin reply. In seconds. */ time_to_assignment?: number; /** Duration until first admin reply. Subtracts out of business hours. In seconds. */ @@ -44,4 +46,10 @@ export interface ConversationStatistics { count_assignments?: number; /** Total number of conversation parts. */ count_conversation_parts?: number; + /** An array of conversation response time objects */ + assigned_team_first_response_time_by_team?: Intercom.ConversationResponseTime[]; + /** An array of conversation response time objects within office hours */ + assigned_team_first_response_time_in_office_hours?: Intercom.ConversationResponseTime[]; + /** Time from conversation assignment to conversation close in seconds. */ + handling_time?: number; } diff --git a/src/api/resources/articles/client/requests/CreateArticleRequest.ts b/src/api/types/CreateArticleRequest.ts similarity index 67% rename from src/api/resources/articles/client/requests/CreateArticleRequest.ts rename to src/api/types/CreateArticleRequest.ts index ef3fdc01..3c7300a8 100644 --- a/src/api/resources/articles/client/requests/CreateArticleRequest.ts +++ b/src/api/types/CreateArticleRequest.ts @@ -2,38 +2,10 @@ * This file was auto-generated by Fern from our API Definition. */ -import * as Intercom from "../../../../index"; +import * as Intercom from "../index"; /** - * @example - * { - * title: "Thanks for everything", - * description: "Description of the Article", - * body: "Body of the Article", - * author_id: 991267407, - * state: "published", - * parent_id: 145, - * parent_type: "collection", - * translated_content: { - * fr: { - * type: "article_content", - * title: "Merci pour tout", - * description: "Description de l'article", - * body: "Corps de l'article", - * author_id: 991267407, - * state: "published" - * } - * } - * } - * - * @example - * { - * title: "Thanks for everything", - * description: "Description of the Article", - * body: "Body of the Article", - * author_id: 1295, - * state: "published" - * } + * You can create an Article */ export interface CreateArticleRequest { /** The title of the article.For multilingual articles, this will be the title of the default language's content. */ diff --git a/src/api/types/CreateDataAttributeRequest.ts b/src/api/types/CreateDataAttributeRequest.ts new file mode 100644 index 00000000..f3656b4a --- /dev/null +++ b/src/api/types/CreateDataAttributeRequest.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * + */ +export type CreateDataAttributeRequest = + | { + data_type?: "options" | undefined; + options: { + value?: string | undefined; + }[]; + } + | { + data_type?: ("string" | "integer" | "float" | "boolean" | "datetime" | "date") | undefined; + }; diff --git a/src/api/types/CreateInternalArticleRequest.ts b/src/api/types/CreateInternalArticleRequest.ts new file mode 100644 index 00000000..bb7b5d6b --- /dev/null +++ b/src/api/types/CreateInternalArticleRequest.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * You can create an Internal Article + */ +export interface CreateInternalArticleRequest { + /** The title of the article. */ + title: string; + /** The content of the article. */ + body?: string; + /** The id of the author of the article. */ + author_id: number; + /** The id of the owner of the article. */ + owner_id: number; +} diff --git a/src/api/types/CreateMessageRequestTwo.ts b/src/api/types/CreateMessageRequestThree.ts similarity index 60% rename from src/api/types/CreateMessageRequestTwo.ts rename to src/api/types/CreateMessageRequestThree.ts index 1c075b32..32881964 100644 --- a/src/api/types/CreateMessageRequestTwo.ts +++ b/src/api/types/CreateMessageRequestThree.ts @@ -2,4 +2,4 @@ * This file was auto-generated by Fern from our API Definition. */ -export type CreateMessageRequestTwo = unknown; +export type CreateMessageRequestThree = unknown; diff --git a/src/api/resources/companies/client/requests/CreateOrUpdateCompanyRequest.ts b/src/api/types/CreateOrUpdateCompanyRequest.ts similarity index 87% rename from src/api/resources/companies/client/requests/CreateOrUpdateCompanyRequest.ts rename to src/api/types/CreateOrUpdateCompanyRequest.ts index 7024d304..869f0e8b 100644 --- a/src/api/resources/companies/client/requests/CreateOrUpdateCompanyRequest.ts +++ b/src/api/types/CreateOrUpdateCompanyRequest.ts @@ -3,15 +3,7 @@ */ /** - * @example - * { - * name: "my company", - * company_id: "company_remote_id", - * remote_created_at: 1374138000 - * } - * - * @example - * {} + * You can create or update a Company */ export interface CreateOrUpdateCompanyRequest { /** The name of the Company */ diff --git a/src/api/types/CreatePhoneSwitchRequest.ts b/src/api/types/CreatePhoneSwitchRequest.ts new file mode 100644 index 00000000..128de5b8 --- /dev/null +++ b/src/api/types/CreatePhoneSwitchRequest.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Intercom from "../index"; + +/** + * You can create an phone switch + */ +export interface CreatePhoneSwitchRequest { + /** Phone number in E.164 format, that will receive the SMS to continue the conversation in the Messenger. */ + phone: string; + custom_attributes?: Intercom.CustomAttributes; +} diff --git a/src/api/types/CreateTicketRequest.ts b/src/api/types/CreateTicketRequest.ts deleted file mode 100644 index 272de2b7..00000000 --- a/src/api/types/CreateTicketRequest.ts +++ /dev/null @@ -1,37 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as Intercom from "../index"; - -/** - * You can create a Ticket - */ -export interface CreateTicketRequest { - /** The ID of the type of ticket you want to create */ - ticket_type_id: string; - /** The list of contacts (users or leads) affected by this ticket. Currently only one is allowed */ - contacts: CreateTicketRequest.Contacts.Item[]; - /** The ID of the company that the ticket is associated with. The ID that you set upon company creation. */ - company_id?: string; - /** The time the ticket was created. If not provided, the current time will be used. */ - created_at?: number; - ticket_attributes?: Intercom.TicketRequestCustomAttributes; -} - -export namespace CreateTicketRequest { - export type Contacts = Contacts.Item[]; - - export namespace Contacts { - export type Item = - | { - id: string; - } - | { - external_id: string; - } - | { - email: string; - }; - } -} diff --git a/src/api/types/CreateTicketRequestBody.ts b/src/api/types/CreateTicketRequestBody.ts new file mode 100644 index 00000000..b5af5ba1 --- /dev/null +++ b/src/api/types/CreateTicketRequestBody.ts @@ -0,0 +1,50 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * You can create a Ticket + */ +export interface CreateTicketRequestBody { + /** The ID of the type of ticket you want to create */ + ticket_type_id: string; + /** The list of contacts (users or leads) affected by this ticket. Currently only one is allowed */ + contacts: CreateTicketRequestBody.Contacts.Item[]; + /** + * The ID of the conversation you want to link to the ticket. Here are the valid ways of linking two tickets: + * - conversation | back-office ticket + * - customer tickets | non-shared back-office ticket + * - conversation | tracker ticket + * - customer ticket | tracker ticket + */ + conversation_to_link_id?: string; + /** The ID of the company that the ticket is associated with. The unique identifier for the company which is given by Intercom */ + company_id?: string; + /** The time the ticket was created. If not provided, the current time will be used. */ + created_at?: number; + assignment?: CreateTicketRequestBody.Assignment; +} + +export namespace CreateTicketRequestBody { + export type Contacts = Contacts.Item[]; + + export namespace Contacts { + export type Item = + | { + id: string; + } + | { + external_id: string; + } + | { + email: string; + }; + } + + export interface Assignment { + /** The ID of the admin to which the ticket is assigned. If not provided, the ticket will be unassigned. */ + admin_assignee_id?: string; + /** The ID of the team to which the ticket is assigned. If not provided, the ticket will be unassigned. */ + team_assignee_id?: string; + } +} diff --git a/src/api/resources/unstable/types/UpdateTicketTypeRequestBody.ts b/src/api/types/CreateTicketTypeRequest.ts similarity index 64% rename from src/api/resources/unstable/types/UpdateTicketTypeRequestBody.ts rename to src/api/types/CreateTicketTypeRequest.ts index 2eca441d..e347c29d 100644 --- a/src/api/resources/unstable/types/UpdateTicketTypeRequestBody.ts +++ b/src/api/types/CreateTicketTypeRequest.ts @@ -3,25 +3,23 @@ */ /** - * The request payload for updating a ticket type. - * You can copy the `icon` property for your ticket type from [Twemoji Cheatsheet](https://twemoji-cheatsheet.vercel.app/) + * The request payload for creating a ticket type. + * You can copy the `icon` property for your ticket type from [Twemoji Cheatsheet](https://twemoji-cheatsheet.vercel.app/) */ -export interface UpdateTicketTypeRequestBody { +export interface CreateTicketTypeRequest { /** The name of the ticket type. */ - name?: string; + name: string; /** The description of the ticket type. */ description?: string; /** Category of the Ticket Type. */ - category?: UpdateTicketTypeRequestBody.Category; + category?: CreateTicketTypeRequest.Category; /** The icon of the ticket type. */ icon?: string; - /** The archived status of the ticket type. */ - archived?: boolean; /** Whether the tickets associated with this ticket type are intended for internal use only or will be shared with customers. This is currently a limited attribute. */ is_internal?: boolean; } -export namespace UpdateTicketTypeRequestBody { +export namespace CreateTicketTypeRequest { /** * Category of the Ticket Type. */ diff --git a/src/api/types/CurrentCanvas.ts b/src/api/types/CurrentCanvas.ts deleted file mode 100644 index d985ac0f..00000000 --- a/src/api/types/CurrentCanvas.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as Intercom from "../index"; - -/** - * The current canvas that was most recently showing before the request was sent. This object mirrors the same format as the Canvas Object. - */ -export interface CurrentCanvas { - /** The canvas object representing the current canvas state. */ - current_canvas: Intercom.CanvasObject; -} diff --git a/src/api/types/CursorPages.ts b/src/api/types/CursorPages.ts index db27af6a..e78fc095 100644 --- a/src/api/types/CursorPages.ts +++ b/src/api/types/CursorPages.ts @@ -10,7 +10,7 @@ import * as Intercom from "../index"; */ export interface CursorPages { /** the type of object `pages`. */ - type: "pages"; + type?: "pages"; /** The current page */ page?: number; next?: Intercom.StartingAfterPaging; diff --git a/src/api/types/CustomActionFinished.ts b/src/api/types/CustomActionFinished.ts new file mode 100644 index 00000000..95484be5 --- /dev/null +++ b/src/api/types/CustomActionFinished.ts @@ -0,0 +1,30 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Contains details about final status of the completed action for conversation part type custom_action_finished. + */ +export interface CustomActionFinished { + action?: CustomActionFinished.Action; +} + +export namespace CustomActionFinished { + export interface Action { + /** Name of the action */ + name?: string; + /** Status of the action */ + result?: Action.Result; + } + + export namespace Action { + /** + * Status of the action + */ + export type Result = "success" | "failed"; + export const Result = { + Success: "success", + Failed: "failed", + } as const; + } +} diff --git a/src/api/types/CustomActionStarted.ts b/src/api/types/CustomActionStarted.ts new file mode 100644 index 00000000..eb089da6 --- /dev/null +++ b/src/api/types/CustomActionStarted.ts @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Contains details about name of the action that was initiated for conversation part type custom_action_started. + */ +export interface CustomActionStarted { + action?: CustomActionStarted.Action; +} + +export namespace CustomActionStarted { + export interface Action { + /** Name of the action */ + name?: string; + } +} diff --git a/src/api/types/CustomAttributes.ts b/src/api/types/CustomAttributes.ts index ebc3d771..8f951f83 100644 --- a/src/api/types/CustomAttributes.ts +++ b/src/api/types/CustomAttributes.ts @@ -2,7 +2,13 @@ * This file was auto-generated by Fern from our API Definition. */ +import * as Intercom from "../index"; + /** * Custom data set for this data. */ -export type CustomAttributes = Record; +export type CustomAttributes = Record; + +export namespace CustomAttributes { + export type Value = string | number | Intercom.Datetime | Intercom.CustomObjectInstanceList; +} diff --git a/src/api/types/CustomChannelAttribute.ts b/src/api/types/CustomChannelAttribute.ts new file mode 100644 index 00000000..1f5ffeb6 --- /dev/null +++ b/src/api/types/CustomChannelAttribute.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface CustomChannelAttribute { + /** Identifier for the attribute being collected. */ + id: string; + /** Value provided by the user for the attribute. */ + value: string; +} diff --git a/src/api/types/CustomChannelBaseEvent.ts b/src/api/types/CustomChannelBaseEvent.ts new file mode 100644 index 00000000..f9a085ec --- /dev/null +++ b/src/api/types/CustomChannelBaseEvent.ts @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Intercom from "../index"; + +export interface CustomChannelBaseEvent { + /** Unique identifier for the event. */ + event_id: string; + /** Identifier for the conversation in your application. */ + external_conversation_id: string; + contact: Intercom.CustomChannelContact; +} diff --git a/src/api/types/CustomChannelContact.ts b/src/api/types/CustomChannelContact.ts new file mode 100644 index 00000000..00a7f59d --- /dev/null +++ b/src/api/types/CustomChannelContact.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface CustomChannelContact { + /** Type of contact, must be "user" or "lead". */ + type: CustomChannelContact.Type; + /** External identifier for the contact. Intercom will take care of the mapping of your external_id with our internal ones so you don't have to worry about it. */ + external_id: string; + /** Name of the contact. Required for user type. */ + name?: string; + /** Email address of the contact. Required for user type. */ + email?: string; +} + +export namespace CustomChannelContact { + /** + * Type of contact, must be "user" or "lead". + */ + export type Type = "user" | "lead"; + export const Type = { + User: "user", + Lead: "lead", + } as const; +} diff --git a/src/api/types/CustomChannelNotificationResponse.ts b/src/api/types/CustomChannelNotificationResponse.ts new file mode 100644 index 00000000..ae5a5611 --- /dev/null +++ b/src/api/types/CustomChannelNotificationResponse.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface CustomChannelNotificationResponse { + /** The external conversation ID provided in the notification request */ + external_conversation_id: string; + /** The Intercom conversation ID mapped to the external conversation ID */ + conversation_id: string; + /** The external contact ID provided in the notification request */ + external_contact_id: string; + /** The Intercom contact ID mapped to the external contact ID */ + contact_id: string; +} diff --git a/src/api/types/CustomObjectInstanceDeleted.ts b/src/api/types/CustomObjectInstanceDeleted.ts new file mode 100644 index 00000000..091e1ec4 --- /dev/null +++ b/src/api/types/CustomObjectInstanceDeleted.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * deleted custom object instance object + */ +export interface CustomObjectInstanceDeleted { + /** The unique identifier of the Custom Object type that defines the structure of the Custom Object instance. */ + object?: string; + /** The Intercom defined id representing the Custom Object instance. */ + id?: string; + /** Whether the Custom Object instance is deleted or not. */ + deleted?: boolean; +} diff --git a/src/api/types/CustomObjectInstanceList.ts b/src/api/types/CustomObjectInstanceList.ts new file mode 100644 index 00000000..30122c7f --- /dev/null +++ b/src/api/types/CustomObjectInstanceList.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Intercom from "../index"; + +/** + * The list of associated custom object instances for a given reference attribute on the parent object. + */ +export interface CustomObjectInstanceList { + type?: string; + /** The list of associated custom object instances for a given reference attribute on the parent object. */ + instances?: (Intercom.CustomObjectInstance | undefined)[]; +} diff --git a/src/api/types/DataAttributeList.ts b/src/api/types/DataAttributeList.ts index 860b9192..d8297a9a 100644 --- a/src/api/types/DataAttributeList.ts +++ b/src/api/types/DataAttributeList.ts @@ -9,7 +9,7 @@ import * as Intercom from "../index"; */ export interface DataAttributeList { /** The type of the object */ - type: "list"; + type?: "list"; /** A list of data attributes */ - data: Intercom.DataAttribute[]; + data?: Intercom.DataAttribute[]; } diff --git a/src/api/types/DataEventList.ts b/src/api/types/DataEventList.ts index 90c73811..28588164 100644 --- a/src/api/types/DataEventList.ts +++ b/src/api/types/DataEventList.ts @@ -9,9 +9,9 @@ import * as Intercom from "../index"; */ export interface DataEventList { /** The type of the object */ - type: "event.list"; + type?: "event.list"; /** A list of data events */ - events: Intercom.DataEvent[]; + events?: Intercom.DataEvent[]; /** Pagination */ pages?: DataEventList.Pages; } diff --git a/src/api/types/DataEventSummary.ts b/src/api/types/DataEventSummary.ts index df7d10fd..1922a09b 100644 --- a/src/api/types/DataEventSummary.ts +++ b/src/api/types/DataEventSummary.ts @@ -9,13 +9,13 @@ import * as Intercom from "../index"; */ export interface DataEventSummary { /** The type of the object */ - type: "event.summary"; + type?: "event.summary"; /** The email address of the user */ - email: string; + email?: string; /** The Intercom user ID of the user */ - intercom_user_id: string; + intercom_user_id?: string; /** The user ID of the user */ - user_id: string; + user_id?: string; /** A summary of data events */ - events: Intercom.DataEventSummaryItem[]; + events: (Intercom.DataEventSummaryItem | undefined)[]; } diff --git a/src/api/types/DataEventSummaryItem.ts b/src/api/types/DataEventSummaryItem.ts index 581a8e54..26f9e3a5 100644 --- a/src/api/types/DataEventSummaryItem.ts +++ b/src/api/types/DataEventSummaryItem.ts @@ -7,13 +7,13 @@ */ export interface DataEventSummaryItem { /** The name of the event */ - name: string; + name?: string; /** The first time the event was sent */ - first: string; + first?: string; /** The last time the event was sent */ - last: string; + last?: string; /** The number of times the event was sent */ - count: number; + count?: number; /** The description of the event */ description?: string; } diff --git a/src/api/types/DataExportCsv.ts b/src/api/types/DataExportCsv.ts index 22f1bf3c..5cc3bea0 100644 --- a/src/api/types/DataExportCsv.ts +++ b/src/api/types/DataExportCsv.ts @@ -7,23 +7,23 @@ */ export interface DataExportCsv { /** The user_id of the user who was sent the message. */ - user_id: string; + user_id?: string; /** The external_user_id of the user who was sent the message */ user_external_id?: string; /** The company ID of the user in relation to the message that was sent. Will return -1 if no company is present. */ - company_id: string; + company_id?: string; /** The users email who was sent the message. */ - email: string; + email?: string; /** The full name of the user receiving the message */ - name: string; + name?: string; /** The id of the message. */ - ruleset_id: string; + ruleset_id?: string; /** The specific content that was received. In an A/B test each version has its own Content ID. */ - content_id: string; + content_id?: string; /** Email, Chat, Post etc. */ - content_type: string; + content_type?: string; /** The title of the content you see in your Intercom workspace. */ - content_title: string; + content_title?: string; /** As you edit content we record new versions. This ID can help you determine which version of a piece of content that was received. */ ruleset_version_id?: string; /** ID for this receipt. Will be included with any related stats in other files to identify this specific delivery of a message. */ diff --git a/src/api/types/DataTableComponent.ts b/src/api/types/DataTableComponent.ts deleted file mode 100644 index 64e38560..00000000 --- a/src/api/types/DataTableComponent.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as Intercom from "../index"; - -/** - * A data-table component is used for rendering a table of key-value pairs. For Messenger, text will wrap around on multiple lines. For Inbox and Frame (ie. Configure) views, we will truncate and use tooltips on hover if the text overflows. - */ -export interface DataTableComponent { - /** The items that will be rendered in the data-table. */ - items: Intercom.DataTableItem[]; -} diff --git a/src/api/types/DataTableItem.ts b/src/api/types/DataTableItem.ts deleted file mode 100644 index f0b9e04f..00000000 --- a/src/api/types/DataTableItem.ts +++ /dev/null @@ -1,15 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -/** - * A field-value pair component for use in a data table. - */ -export interface DataTableItem { - /** The type of component you are rendering. */ - type: "field-value"; - /** The text of the key in your key-value pair. */ - field: string; - /** The text of the value in your key-value pair. */ - value: string; -} diff --git a/src/api/types/Datetime.ts b/src/api/types/Datetime.ts new file mode 100644 index 00000000..c291e607 --- /dev/null +++ b/src/api/types/Datetime.ts @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export type Datetime = + /** + * A date and time following the ISO8601 notation. */ + | string + /** + * A date and time as UNIX timestamp notation. */ + | number; diff --git a/src/api/types/DeletedArticleObject.ts b/src/api/types/DeletedArticleObject.ts index b792af78..2fb626a8 100644 --- a/src/api/types/DeletedArticleObject.ts +++ b/src/api/types/DeletedArticleObject.ts @@ -7,9 +7,9 @@ */ export interface DeletedArticleObject { /** The unique identifier for the article which you provided in the URL. */ - id: string; + id?: string; /** The type of object which was deleted. - article */ - object: "article"; + object?: "article"; /** Whether the article was deleted successfully or not. */ - deleted: boolean; + deleted?: boolean; } diff --git a/src/api/types/DeletedCollectionObject.ts b/src/api/types/DeletedCollectionObject.ts index f01ce8e6..9f09babd 100644 --- a/src/api/types/DeletedCollectionObject.ts +++ b/src/api/types/DeletedCollectionObject.ts @@ -7,9 +7,9 @@ */ export interface DeletedCollectionObject { /** The unique identifier for the collection which you provided in the URL. */ - id: string; + id?: string; /** The type of object which was deleted. - `collection` */ - object: "collection"; + object?: "collection"; /** Whether the collection was deleted successfully or not. */ - deleted: boolean; + deleted?: boolean; } diff --git a/src/api/types/DeletedCompanyObject.ts b/src/api/types/DeletedCompanyObject.ts index e3252c3c..f93f0699 100644 --- a/src/api/types/DeletedCompanyObject.ts +++ b/src/api/types/DeletedCompanyObject.ts @@ -7,9 +7,9 @@ */ export interface DeletedCompanyObject { /** The unique identifier for the company which is given by Intercom. */ - id: string; + id?: string; /** The type of object which was deleted. - `company` */ - object: "company"; + object?: "company"; /** Whether the company was deleted successfully or not. */ - deleted: boolean; + deleted?: boolean; } diff --git a/src/api/types/DeletedInternalArticleObject.ts b/src/api/types/DeletedInternalArticleObject.ts new file mode 100644 index 00000000..45dd858e --- /dev/null +++ b/src/api/types/DeletedInternalArticleObject.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Response returned when an object is deleted + */ +export interface DeletedInternalArticleObject { + /** The unique identifier for the internal article which you provided in the URL. */ + id?: string; + /** The type of object which was deleted. - internal_article */ + object?: "internal_article"; + /** Whether the internal article was deleted successfully or not. */ + deleted?: boolean; +} diff --git a/src/api/types/DeletedObject.ts b/src/api/types/DeletedObject.ts index f0bcc357..613a0f83 100644 --- a/src/api/types/DeletedObject.ts +++ b/src/api/types/DeletedObject.ts @@ -7,9 +7,9 @@ */ export interface DeletedObject { /** The unique identifier for the news item which you provided in the URL. */ - id: string; + id?: string; /** The type of object which was deleted - news-item. */ - object: "news-item"; + object?: "news-item"; /** Whether the news item was deleted successfully or not. */ - deleted: boolean; + deleted?: boolean; } diff --git a/src/api/types/DividerComponent.ts b/src/api/types/DividerComponent.ts deleted file mode 100644 index 7b37b3c8..00000000 --- a/src/api/types/DividerComponent.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -/** - * A divider component is used to separate components with a line. - */ -export interface DividerComponent { - /** A unique identifier for the component. */ - id?: string; - /** Disables a component's margin-bottom of 10px. */ - bottom_margin?: "none"; -} diff --git a/src/api/types/DropdownComponent.ts b/src/api/types/DropdownComponent.ts deleted file mode 100644 index f0d36aaa..00000000 --- a/src/api/types/DropdownComponent.ts +++ /dev/null @@ -1,37 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as Intercom from "../index"; - -/** - * A dropdown component is used to capture a choice from the options that you provide. - * - * When submitted, the dropdown choices are returned in a hash with the id from the dropdown component used as the key and the id from the chosen option as the value. - */ -export interface DropdownComponent { - /** A unique identifier for the component. */ - id: string; - /** The list of options. Can provide 2 to 10. */ - options: Intercom.DropdownOption[]; - /** The text shown above the dropdown. */ - label?: string; - /** The option that is selected by default. */ - value?: string; - /** Styles all options and prevents the action. Default is `unsaved`. Will be overridden if `save_state` is `saved`. */ - save_state?: DropdownComponent.SaveState; - /** Styles all options and prevents the action. Default is false. Will be overridden if save_state is saved. */ - disabled?: boolean; -} - -export namespace DropdownComponent { - /** - * Styles all options and prevents the action. Default is `unsaved`. Will be overridden if `save_state` is `saved`. - */ - export type SaveState = "unsaved" | "saved" | "failed"; - export const SaveState = { - Unsaved: "unsaved", - Saved: "saved", - Failed: "failed", - } as const; -} diff --git a/src/api/types/DropdownOption.ts b/src/api/types/DropdownOption.ts deleted file mode 100644 index 17bd18e5..00000000 --- a/src/api/types/DropdownOption.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -/** - * A dropdown option component that can be selected. - */ -export interface DropdownOption { - /** The type of component you are rendering. */ - type: "option"; - /** A unique identifier for the option. */ - id: string; - /** The text shown within this option. */ - text: string; - /** Styles the option and prevents the action. Default is false. */ - disabled?: boolean; -} diff --git a/src/api/types/EmailAddressHeader.ts b/src/api/types/EmailAddressHeader.ts new file mode 100644 index 00000000..81f30d02 --- /dev/null +++ b/src/api/types/EmailAddressHeader.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Contains data for an email address header for a conversation part that was sent as an email. + */ +export interface EmailAddressHeader { + /** The type of email address header */ + type?: string; + /** The email address */ + email_address?: string; + /** The name associated with the email address */ + name?: string; +} diff --git a/src/api/types/EmailMessageMetadata.ts b/src/api/types/EmailMessageMetadata.ts new file mode 100644 index 00000000..643113ab --- /dev/null +++ b/src/api/types/EmailMessageMetadata.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Intercom from "../index"; + +/** + * Contains metadata if the message was sent as an email + */ +export interface EmailMessageMetadata { + /** The subject of the email */ + subject?: string; + /** A list of an email address headers. */ + email_address_headers?: Intercom.EmailAddressHeader[]; +} diff --git a/src/api/types/Event.ts b/src/api/types/Event.ts deleted file mode 100644 index b6bbe375..00000000 --- a/src/api/types/Event.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -/** - * The event object enables Intercom to know more about the actions that took place in your app. Currently, you can only tell us when an app's flow has been completed. - */ -export interface Event { - /** What action took place. The only value currently accepted is `completed`. */ - type: "completed"; -} diff --git a/src/api/types/EventDetails.ts b/src/api/types/EventDetails.ts new file mode 100644 index 00000000..f39a35c3 --- /dev/null +++ b/src/api/types/EventDetails.ts @@ -0,0 +1,12 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Intercom from "../index"; + +export type EventDetails = + | Intercom.ConversationAttributeUpdatedByWorkflow + | Intercom.ConversationAttributeUpdatedByAdmin + | Intercom.CustomActionStarted + | Intercom.CustomActionFinished + | Intercom.OperatorWorkflowEvent; diff --git a/src/api/types/FileAttribute.ts b/src/api/types/FileAttribute.ts index e33ed602..e0c5f023 100644 --- a/src/api/types/FileAttribute.ts +++ b/src/api/types/FileAttribute.ts @@ -6,17 +6,17 @@ * The value describing a file upload set for a custom attribute */ export interface FileAttribute { - type: string; + type?: string; /** The name of the file */ - name: string; + name?: string; /** The url of the file. This is a temporary URL and will expire after 30 minutes. */ - url: string; + url?: string; /** The type of file */ - content_type: string; + content_type?: string; /** The size of the file in bytes */ - filesize: number; + filesize?: number; /** The width of the file in pixels, if applicable */ - width: number; + width?: number; /** The height of the file in pixels, if applicable */ - height: number; + height?: number; } diff --git a/src/api/types/GroupContent.ts b/src/api/types/GroupContent.ts index 92c493c6..a7fb4506 100644 --- a/src/api/types/GroupContent.ts +++ b/src/api/types/GroupContent.ts @@ -7,9 +7,9 @@ */ export interface GroupContent { /** The type of object - `group_content` . */ - type: "group_content"; + type?: string; /** The name of the collection or section. */ - name: string; + name?: string; /** The description of the collection. Only available for collections. */ - description: string; + description?: string; } diff --git a/src/api/types/GroupTranslatedContent.ts b/src/api/types/GroupTranslatedContent.ts index 8f89cab2..7c865ac1 100644 --- a/src/api/types/GroupTranslatedContent.ts +++ b/src/api/types/GroupTranslatedContent.ts @@ -9,7 +9,7 @@ import * as Intercom from "../index"; */ export interface GroupTranslatedContent { /** The type of object - group_translated_content. */ - type: "group_translated_content"; + type?: string; /** The content of the group in Arabic */ ar?: Intercom.GroupContent; /** The content of the group in Bulgarian */ diff --git a/src/api/types/ImageComponent.ts b/src/api/types/ImageComponent.ts deleted file mode 100644 index 52e8d603..00000000 --- a/src/api/types/ImageComponent.ts +++ /dev/null @@ -1,43 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as Intercom from "../index"; - -/** - * An image component is used to display an image. - * - * HTTPS Images: - * If your request URLs (or website URLs) are over HTTPS, you will need to ensure that images are loaded over HTTPS likewise. Otherwise, they will not work. - */ -export interface ImageComponent { - /** A unique identifier for the component. */ - id?: string; - /** The URL where the image is located. */ - url: string; - /** Aligns the image inside the component. Default is `left`. */ - align?: ImageComponent.Align; - /** The exact width of the image in pixels. */ - width: number; - /** The exact height of the image in pixels. */ - height: number; - /** Rounds the corners of the image. Default is `false`. */ - rounded?: boolean; - /** Disables a component's margin-bottom of 10px. */ - bottom_margin?: "none"; - /** This can be a URL Action only. */ - action?: Intercom.UrlActionComponent; -} - -export namespace ImageComponent { - /** - * Aligns the image inside the component. Default is `left`. - */ - export type Align = "left" | "center" | "right" | "full_width"; - export const Align = { - Left: "left", - Center: "center", - Right: "right", - FullWidth: "full_width", - } as const; -} diff --git a/src/api/types/InitializeRequest.ts b/src/api/types/InitializeRequest.ts deleted file mode 100644 index e3d617b9..00000000 --- a/src/api/types/InitializeRequest.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as Intercom from "../index"; - -/** - * The request payload will have all the data needed for you to understand who is using your app, where they are using it, and how you should respond. There are different request payloads for Messenger capabilities and Inbox capabilities. - */ -export interface InitializeRequest { - /** The workspace ID of the teammate. Attribute is `app_id` for V1.2 and below. */ - workspace_id: string; - /** The Intercom hosted region that this app is located in. */ - workspace_region: string; - /** The Intercom teammate viewing the conversation. */ - admin: Intercom.Admin; - /** Key-value pairs which were given as results in response to the Configure request. */ - card_creation_options: Record; - /** The context of where the app is added, where the user last visited, and information on the Messenger settings. */ - context: Intercom.Context; - /** The conversation your app is being shown for. */ - conversation: Intercom.Conversation; - /** The contact which is currently being viewed by the teammate in the conversation details panel. We send an individual initialize request for each customer when it's a group conversation. */ - contact: Intercom.Contact; -} diff --git a/src/api/types/InitializeResponse.ts b/src/api/types/InitializeResponse.ts deleted file mode 100644 index a675eeaa..00000000 --- a/src/api/types/InitializeResponse.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as Intercom from "../index"; - -/** - * The response object returned when initializing an app, specifying the UI for the first screen using components. - */ -export interface InitializeResponse { - /** The canvas object that defines the UI to be shown for the app. */ - canvas: Intercom.CanvasObject; -} diff --git a/src/api/types/InputComponent.ts b/src/api/types/InputComponent.ts deleted file mode 100644 index cd7f86fb..00000000 --- a/src/api/types/InputComponent.ts +++ /dev/null @@ -1,40 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as Intercom from "../index"; - -/** - * An input component is used to capture text input from the end user. You can submit the value of the input by: - * - * - Adding an `action` to the input component (which will render an inline button) - * - Using a ButtonComponent (which will submit all interactive components in the canvas) - */ -export interface InputComponent { - /** A unique identifier for the component. */ - id: string; - /** The text shown above the input. */ - label?: string; - /** An example value shown inside the component when it's empty. */ - placeholder?: string; - /** An entered value which is already inside the component. */ - value?: string; - /** This can be a Submit Action, URL Action, or Sheets Action. */ - action?: Intercom.ActionComponent; - /** Styles the input. Default is `unsaved`. Prevent action with `saved`. */ - save_state?: InputComponent.SaveState; - /** Styles the input and prevents the action. Default is false. Will be overridden if save_state is saved. */ - disabled?: boolean; -} - -export namespace InputComponent { - /** - * Styles the input. Default is `unsaved`. Prevent action with `saved`. - */ - export type SaveState = "unsaved" | "saved" | "failed"; - export const SaveState = { - Unsaved: "unsaved", - Saved: "saved", - Failed: "failed", - } as const; -} diff --git a/src/api/types/InternalArticleList.ts b/src/api/types/InternalArticleList.ts new file mode 100644 index 00000000..eeadd3b3 --- /dev/null +++ b/src/api/types/InternalArticleList.ts @@ -0,0 +1,18 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Intercom from "../index"; + +/** + * This will return a list of internal articles for the App. + */ +export interface InternalArticleList { + /** The type of the object - `list`. */ + type?: "list"; + pages?: Intercom.CursorPages; + /** A count of the total number of internal articles. */ + total_count?: number; + /** An array of Internal Article objects */ + data?: Intercom.InternalArticleListItem[]; +} diff --git a/src/api/types/LinkedObject.ts b/src/api/types/LinkedObject.ts index 262dd306..d7eaf21d 100644 --- a/src/api/types/LinkedObject.ts +++ b/src/api/types/LinkedObject.ts @@ -7,9 +7,9 @@ */ export interface LinkedObject { /** ticket or conversation */ - type: LinkedObject.Type; + type?: LinkedObject.Type; /** The ID of the linked object */ - id: string; + id?: string; /** Category of the Linked Ticket Object. */ category?: string; } diff --git a/src/api/types/LinkedObjectList.ts b/src/api/types/LinkedObjectList.ts index 043bfe1c..51e2a34d 100644 --- a/src/api/types/LinkedObjectList.ts +++ b/src/api/types/LinkedObjectList.ts @@ -9,11 +9,11 @@ import * as Intercom from "../index"; */ export interface LinkedObjectList { /** Always list. */ - type: "list"; + type?: "list"; /** The total number of linked objects. */ - total_count: number; + total_count?: number; /** Whether or not there are more linked objects than returned. */ - has_more: boolean; + has_more?: boolean; /** An array containing the linked conversations and linked tickets. */ - data: Intercom.LinkedObject[]; + data?: Intercom.LinkedObject[]; } diff --git a/src/api/types/ListComponent.ts b/src/api/types/ListComponent.ts deleted file mode 100644 index b80e900d..00000000 --- a/src/api/types/ListComponent.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as Intercom from "../index"; - -/** - * A list component renders a list of items which you provide in an array. You can make each list item take an action by adding the relevant action object to the item: - * - * - [Trigger a submit request to be sent](https://developers.intercom.com/docs/references/canvas-kit/actioncomponents/submit-action) Inbox Messenger - * - [Open a link in a new page](https://developers.intercom.com/docs/references/canvas-kit/actioncomponents/url-action) Inbox Messenger - * - [Open a sheet](https://developers.intercom.com/docs/references/canvas-kit/actioncomponents/sheets-action) Messenger - */ -export interface ListComponent { - /** The items that will be rendered in the list. */ - items: ListComponent.Items.Item[]; - /** Styles all list items and prevents the action. Default is `false`. */ - disabled?: boolean; -} - -export namespace ListComponent { - export type Items = Items.Item[]; - - export namespace Items { - export type Item = Intercom.ListItemWithImage | Intercom.ListItemWithoutImage; - } -} diff --git a/src/api/types/ListItem.ts b/src/api/types/ListItem.ts deleted file mode 100644 index d85d821c..00000000 --- a/src/api/types/ListItem.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as Intercom from "../index"; - -/** - * A list item component that can be rendered in a list. - */ -export interface ListItem { - /** The type of component you are rendering. */ - type: "item"; - /** A unique identifier for the item. */ - id: string; - /** The text shown as the title for the item. */ - title: string; - /** The text shown underneath the item's title. */ - subtitle?: string; - /** The text shown next to the subtitle, separates by a bullet. */ - tertiary_text?: string; - /** Rounds the corners of the image. Default is `false`. */ - rounded_image?: boolean; - /** Styles all list items and prevents the action. Default is `false`. */ - disabled?: boolean; - /** This can be a Submit Action, URL Action, or Sheets Action. */ - action?: Intercom.ActionComponent; -} diff --git a/src/api/types/ListItemWithImage.ts b/src/api/types/ListItemWithImage.ts deleted file mode 100644 index 4d62f441..00000000 --- a/src/api/types/ListItemWithImage.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as Intercom from "../index"; - -export interface ListItemWithImage extends Intercom.ListItem { - /** An image that will be displayed to the left of the item. */ - image: string; - /** The exact width of the image in pixels. */ - image_width: number; - /** The exact height of the image in pixels. */ - image_height: number; -} diff --git a/src/api/types/ListItemWithoutImage.ts b/src/api/types/ListItemWithoutImage.ts deleted file mode 100644 index d5f911ec..00000000 --- a/src/api/types/ListItemWithoutImage.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as Intercom from "../index"; - -export interface ListItemWithoutImage extends Intercom.ListItem { - /** An image that will be displayed to the left of the item. */ - image?: string; - /** The exact width of the image in pixels. */ - image_width?: number; - /** The exact height of the image in pixels. */ - image_height?: number; -} diff --git a/src/api/types/LiveCanvasRequest.ts b/src/api/types/LiveCanvasRequest.ts deleted file mode 100644 index 4c90a1d5..00000000 --- a/src/api/types/LiveCanvasRequest.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as Intercom from "../index"; - -/** - * Canvases are static by default and require a new request to come through in order to update them. Live canvases however will make requests every time the card is viewed without any interaction needed, meaning the canvas can be kept up-to-date with no action from the user. - * - * This works for every Messenger request that you can respond with a canvas object to. Instead of returning the content object within the canvas object, you should provide a `content_url` attribute instead with the value being the URL you want us to send a POST request to when someone views the app. - */ -export interface LiveCanvasRequest { - /** The workspace ID of the teammate. Attribute is `app_id` for V1.2 and below. */ - workspace_id: string; - /** The Intercom hosted region that this app is located in. */ - workspace_region: string; - /** The current_canvas the teammate can see. */ - canvas: Intercom.CanvasObject; - /** The context of where the app is added, where the user last visited, and information on the Messenger settings. */ - context: Intercom.Context; - /** The contact who viewed the card. */ - contact: Intercom.Contact; -} diff --git a/src/api/types/LiveCanvasResponse.ts b/src/api/types/LiveCanvasResponse.ts deleted file mode 100644 index fca96ef7..00000000 --- a/src/api/types/LiveCanvasResponse.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as Intercom from "../index"; - -/** - * The response object returned when responding to a Live Canvas request. This contains the components you want to show. - */ -export interface LiveCanvasResponse { - /** The content object that defines the components to be shown. */ - content: Intercom.ContentObject; -} diff --git a/src/api/types/MultipleFilterSearchRequest.ts b/src/api/types/MultipleFilterSearchRequest.ts index 8554380e..cdaf21d8 100644 --- a/src/api/types/MultipleFilterSearchRequest.ts +++ b/src/api/types/MultipleFilterSearchRequest.ts @@ -10,7 +10,7 @@ import * as Intercom from "../index"; export interface MultipleFilterSearchRequest { /** An operator to allow boolean inspection between multiple fields. */ operator?: MultipleFilterSearchRequest.Operator; - value?: Intercom.MultipleOrSingleFilterSearchRequest[]; + value?: MultipleFilterSearchRequest.Value; } export namespace MultipleFilterSearchRequest { @@ -22,4 +22,11 @@ export namespace MultipleFilterSearchRequest { And: "AND", Or: "OR", } as const; + export type Value = + /** + * Add mutiple filters. */ + | Intercom.MultipleFilterSearchRequest[] + /** + * Add a single filter field. */ + | Intercom.SingleFilterSearchRequest[]; } diff --git a/src/api/types/MultipleOrSingleFilterSearchRequest.ts b/src/api/types/MultipleOrSingleFilterSearchRequest.ts deleted file mode 100644 index 05b7916a..00000000 --- a/src/api/types/MultipleOrSingleFilterSearchRequest.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as Intercom from "../index"; - -export type MultipleOrSingleFilterSearchRequest = - | Intercom.MultipleFilterSearchRequest - | Intercom.SingleFilterSearchRequest; diff --git a/src/api/types/NotFoundErrorBody.ts b/src/api/types/NotFoundErrorBody.ts new file mode 100644 index 00000000..0893b81e --- /dev/null +++ b/src/api/types/NotFoundErrorBody.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface NotFoundErrorBody { + /** The type is error.list */ + type: string; + /** */ + request_id?: string; + /** An array of one or more error objects */ + errors: NotFoundErrorBody.Errors.Item[]; +} + +export namespace NotFoundErrorBody { + export type Errors = Errors.Item[]; + + export namespace Errors { + export interface Item { + /** ticket_not_found */ + code: string; + /** Ticket not found */ + message?: string; + } + } +} diff --git a/src/api/types/NoteList.ts b/src/api/types/NoteList.ts index e9bf93ee..5ad4657d 100644 --- a/src/api/types/NoteList.ts +++ b/src/api/types/NoteList.ts @@ -9,10 +9,9 @@ import * as Intercom from "../index"; */ export interface NoteList { /** String representing the object's type. Always has the value `list`. */ - type: "list"; + type?: string; /** An array of notes. */ - data: Intercom.Note[]; + data?: Intercom.Note[]; /** A count of the total number of notes. */ - total_count: number; - pages?: Intercom.OffsetPages; + total_count?: number; } diff --git a/src/api/types/OperatorWorkflowEvent.ts b/src/api/types/OperatorWorkflowEvent.ts new file mode 100644 index 00000000..336b4885 --- /dev/null +++ b/src/api/types/OperatorWorkflowEvent.ts @@ -0,0 +1,25 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * Contains details about name of the workflow for conversation part type operator_workflow_event. + */ +export interface OperatorWorkflowEvent { + workflow?: OperatorWorkflowEvent.Workflow; + event?: OperatorWorkflowEvent.Event; +} + +export namespace OperatorWorkflowEvent { + export interface Workflow { + /** The name of the workflow */ + name?: string; + } + + export interface Event { + /** Type of the workflow event initiated */ + type?: string; + /** Result of the workflow event */ + result?: string; + } +} diff --git a/src/api/types/PagesLink.ts b/src/api/types/PagesLink.ts index 9f298e78..4dd36d75 100644 --- a/src/api/types/PagesLink.ts +++ b/src/api/types/PagesLink.ts @@ -8,10 +8,10 @@ * Their responses are likely to contain a pages object that hosts pagination links which a client can use to paginate through the data without having to construct a query. The link relations for the pages field are as follows. */ export interface PagesLink { - type: "pages"; - page: number; + type?: "pages"; + page?: number; /** A link to the next page of results. A response that does not contain a next link does not have further data to fetch. */ next?: string; - per_page: number; - total_pages: number; + per_page?: number; + total_pages?: number; } diff --git a/src/api/types/PaginatedNewsItemResponse.ts b/src/api/types/PaginatedNewsItemResponse.ts deleted file mode 100644 index dcabdedc..00000000 --- a/src/api/types/PaginatedNewsItemResponse.ts +++ /dev/null @@ -1,18 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as Intercom from "../index"; - -/** - * Paginated News Item Response - */ -export interface PaginatedNewsItemResponse { - /** The type of object */ - type: "list"; - pages?: Intercom.CursorPages; - /** A count of the total number of News Items. */ - total_count: number; - /** An array of News Items */ - data: Intercom.NewsItem[]; -} diff --git a/src/api/types/PaginatedNewsfeedResponse.ts b/src/api/types/PaginatedNewsfeedResponse.ts deleted file mode 100644 index 92ded308..00000000 --- a/src/api/types/PaginatedNewsfeedResponse.ts +++ /dev/null @@ -1,18 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as Intercom from "../index"; - -/** - * Paginated Newsfeed Response - */ -export interface PaginatedNewsfeedResponse { - /** The type of object */ - type: "list"; - pages?: Intercom.CursorPages; - /** A count of the total number of Newsfeeds. */ - total_count: number; - /** An array of Newsfeeds */ - data: Intercom.Newsfeed[]; -} diff --git a/src/api/types/PaginatedResponse.ts b/src/api/types/PaginatedResponse.ts new file mode 100644 index 00000000..61dce053 --- /dev/null +++ b/src/api/types/PaginatedResponse.ts @@ -0,0 +1,29 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Intercom from "../index"; + +/** + * Paginated Response + */ +export interface PaginatedResponse { + /** The type of object */ + type?: PaginatedResponse.Type; + pages?: Intercom.CursorPages; + /** A count of the total number of objects. */ + total_count?: number; + /** An array of Objects */ + data?: Intercom.PaginatedResponseDataItem[]; +} + +export namespace PaginatedResponse { + /** + * The type of object + */ + export type Type = "list" | "conversation.list"; + export const Type = { + List: "list", + ConversationList: "conversation.list", + } as const; +} diff --git a/src/api/types/PaginatedResponseDataItem.ts b/src/api/types/PaginatedResponseDataItem.ts new file mode 100644 index 00000000..c26af271 --- /dev/null +++ b/src/api/types/PaginatedResponseDataItem.ts @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Intercom from "../index"; + +export type PaginatedResponseDataItem = + | Intercom.PaginatedResponseDataItem.NewsItem + | Intercom.PaginatedResponseDataItem.Newsfeed; + +export namespace PaginatedResponseDataItem { + export interface NewsItem extends Intercom.NewsItem { + type: "news-item"; + } + + export interface Newsfeed extends Intercom.Newsfeed { + type: "newsfeed"; + } +} diff --git a/src/api/types/PartAttachment.ts b/src/api/types/PartAttachment.ts index e87f566e..690152f9 100644 --- a/src/api/types/PartAttachment.ts +++ b/src/api/types/PartAttachment.ts @@ -7,17 +7,17 @@ */ export interface PartAttachment { /** The type of attachment */ - type: string; + type?: string; /** The name of the attachment */ - name: string; + name?: string; /** The URL of the attachment */ - url: string; + url?: string; /** The content type of the attachment */ - content_type: string; + content_type?: string; /** The size of the attachment */ - filesize: number; + filesize?: number; /** The width of the attachment */ - width: number; + width?: number; /** The height of the attachment */ - height: number; + height?: number; } diff --git a/src/api/types/PhoneSwitch.ts b/src/api/types/PhoneSwitch.ts index 200aa121..3e6aad44 100644 --- a/src/api/types/PhoneSwitch.ts +++ b/src/api/types/PhoneSwitch.ts @@ -7,7 +7,7 @@ */ export interface PhoneSwitch { /** */ - type: "phone_call_redirect"; + type?: "phone_call_redirect"; /** Phone number in E.164 format, that has received the SMS to continue the conversation in the Messenger. */ - phone: string; + phone?: string; } diff --git a/src/api/types/QuickReplyOption.ts b/src/api/types/QuickReplyOption.ts new file mode 100644 index 00000000..379777e5 --- /dev/null +++ b/src/api/types/QuickReplyOption.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface QuickReplyOption { + /** The text to display in this quick reply option. */ + text: string; + /** A unique identifier for this quick reply option. This value will be available within the metadata of the comment conversation part that is created when a user clicks on this reply option. */ + uuid: string; +} diff --git a/src/api/types/Recipient.ts b/src/api/types/Recipient.ts new file mode 100644 index 00000000..25e28bb9 --- /dev/null +++ b/src/api/types/Recipient.ts @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * A recipient of a message + */ +export interface Recipient { + /** The role associated to the contact - `user` or `lead`. */ + type: Recipient.Type; + /** The identifier for the contact which is given by Intercom. */ + id: string; +} + +export namespace Recipient { + /** + * The role associated to the contact - `user` or `lead`. + */ + export type Type = "user" | "lead"; + export const Type = { + User: "user", + Lead: "lead", + } as const; +} diff --git a/src/api/types/Reference.ts b/src/api/types/Reference.ts index 708375f6..b14f584f 100644 --- a/src/api/types/Reference.ts +++ b/src/api/types/Reference.ts @@ -7,7 +7,7 @@ */ export interface Reference { /** */ - type: string; + type?: string; /** */ id?: string; } diff --git a/src/api/types/ResultsResponse.ts b/src/api/types/ResultsResponse.ts deleted file mode 100644 index 118b3e37..00000000 --- a/src/api/types/ResultsResponse.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -/** - * The results object should be sent when you want to end configuration of the app and trigger the [Initialize request](https://developers.intercom.com/docs/canvas-kit/#initialize) to be sent. You provide the key-value pairs of data you want access to and we will send these in the Initialize request within a [card_creation_options object](https://developers.intercom.com/docs/references/canvas-kit/requestobjects/card-creation-options/#card-creation-options). - */ -export interface ResultsResponse { - /** Key-value pairs of data you want access to in the Initialize request */ - results: Record; -} diff --git a/src/api/types/SegmentList.ts b/src/api/types/SegmentList.ts index 3c5636cf..f8e2d8fd 100644 --- a/src/api/types/SegmentList.ts +++ b/src/api/types/SegmentList.ts @@ -9,9 +9,9 @@ import * as Intercom from "../index"; */ export interface SegmentList { /** The type of the object */ - type: "segment.list"; + type?: "segment.list"; /** A list of Segment objects */ - segments: Intercom.Segment[]; + segments?: Intercom.Segment[]; /** A pagination object, which may be empty, indicating no further pages to fetch. */ pages?: Record; } diff --git a/src/api/types/SheetActionComponent.ts b/src/api/types/SheetActionComponent.ts deleted file mode 100644 index 655b7039..00000000 --- a/src/api/types/SheetActionComponent.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -/** - * A sheet action opens the link you give within the Messenger as an embedded iframe. - * - * [More on how Sheets work is in our Canvas Kit documentation.](https://developers.intercom.com/docs/canvas-kit#sheets-optional) - */ -export interface SheetActionComponent { - /** The link which hosts your sheet. */ - url: string; -} diff --git a/src/api/types/SingleFilterSearchRequest.ts b/src/api/types/SingleFilterSearchRequest.ts index 94aa9dfc..767069fe 100644 --- a/src/api/types/SingleFilterSearchRequest.ts +++ b/src/api/types/SingleFilterSearchRequest.ts @@ -34,5 +34,5 @@ export namespace SingleFilterSearchRequest { /** * The value that you want to search on. */ - export type Value = string | number | string[] | number[]; + export type Value = string | number | (string | number)[]; } diff --git a/src/api/types/SingleSelectComponent.ts b/src/api/types/SingleSelectComponent.ts deleted file mode 100644 index 04f9cf85..00000000 --- a/src/api/types/SingleSelectComponent.ts +++ /dev/null @@ -1,42 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as Intercom from "../index"; - -/** - * A single-select component is used to capture a choice from up to 10 options that you provide. You can submit the value of the select option by: - * - * - Adding an `action` to the single-select component - * - Using a ButtonComponent (which will submit all interactive components in the canvas) - * - * When a submit action takes place, the results are given in a hash with the `id` from the single-select component used as the key and the `id` from the chosen option as the value. - */ -export interface SingleSelectComponent { - /** A unique identifier for the component. */ - id: string; - /** The list of options. Can provide 2 to 10. */ - options: Intercom.SingleSelectOption[]; - /** The text shown above the options. */ - label?: string; - /** The option that is selected by default. */ - value?: string; - /** Styles the input. Default is `unsaved`. Prevent action with `saved`. */ - save_state?: SingleSelectComponent.SaveState; - /** Styles all options and prevents the action. Default is false. Will be overridden if save_state is saved. */ - disabled?: boolean; - /** This can be a Submit Action, URL Action, or Sheets Action. */ - action?: Intercom.ActionComponent; -} - -export namespace SingleSelectComponent { - /** - * Styles the input. Default is `unsaved`. Prevent action with `saved`. - */ - export type SaveState = "unsaved" | "saved" | "failed"; - export const SaveState = { - Unsaved: "unsaved", - Saved: "saved", - Failed: "failed", - } as const; -} diff --git a/src/api/types/SingleSelectOption.ts b/src/api/types/SingleSelectOption.ts deleted file mode 100644 index 4fc06e87..00000000 --- a/src/api/types/SingleSelectOption.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -/** - * A single select option component that can be selected. - */ -export interface SingleSelectOption { - /** The type of component you are rendering. */ - type: "option"; - /** A unique identifier for the option. */ - id: string; - /** The text shown within this option. */ - text: string; - /** Styles the option and prevents the action. Default is false. */ - disabled?: boolean; -} diff --git a/src/api/types/SlaApplied.ts b/src/api/types/SlaApplied.ts index 086c6c17..1a7049bb 100644 --- a/src/api/types/SlaApplied.ts +++ b/src/api/types/SlaApplied.ts @@ -8,16 +8,16 @@ */ export interface SlaApplied { /** object type */ - type: string; + type?: string; /** The name of the SLA as given by the teammate when it was created. */ - sla_name: string; + sla_name?: string; /** * SLA statuses: * - `hit`: If there’s at least one hit event in the underlying sla_events table, and no “missed” or “canceled” events for the conversation. * - `missed`: If there are any missed sla_events for the conversation and no canceled events. If there’s even a single missed sla event, the status will always be missed. A missed status is not applied when the SLA expires, only the next time a teammate replies. * - `active`: An SLA has been applied to a conversation, but has not yet been fulfilled. SLA status is active only if there are no “hit, “missed”, or “canceled” events. */ - sla_status: SlaApplied.SlaStatus; + sla_status?: SlaApplied.SlaStatus; } export namespace SlaApplied { diff --git a/src/api/types/SocialProfile.ts b/src/api/types/SocialProfile.ts index 90befe00..b7e86922 100644 --- a/src/api/types/SocialProfile.ts +++ b/src/api/types/SocialProfile.ts @@ -7,9 +7,9 @@ */ export interface SocialProfile { /** value is "social_profile" */ - type: "social_profile"; + type?: "social_profile"; /** The name of the Social media profile */ - name: string; + name?: string; /** The name of the Social media profile */ - url: string; + url?: string; } diff --git a/src/api/types/SpacerComponent.ts b/src/api/types/SpacerComponent.ts deleted file mode 100644 index d8215aa3..00000000 --- a/src/api/types/SpacerComponent.ts +++ /dev/null @@ -1,27 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -/** - * A spacer component is used to create empty space between components. - */ -export interface SpacerComponent { - /** A unique identifier for the component. */ - id?: string; - /** The amount of space between components. Default is `s`. */ - size?: SpacerComponent.Size; -} - -export namespace SpacerComponent { - /** - * The amount of space between components. Default is `s`. - */ - export type Size = "xs" | "s" | "m" | "l" | "xl"; - export const Size = { - Xs: "xs", - S: "s", - M: "m", - L: "l", - Xl: "xl", - } as const; -} diff --git a/src/api/types/StartingAfterPaging.ts b/src/api/types/StartingAfterPaging.ts index df4feb10..e2d31e3f 100644 --- a/src/api/types/StartingAfterPaging.ts +++ b/src/api/types/StartingAfterPaging.ts @@ -4,7 +4,7 @@ export interface StartingAfterPaging { /** The number of results to fetch per page. */ - per_page: number; + per_page?: number; /** The cursor to use in the next request to get the next page of results. */ starting_after?: string; } diff --git a/src/api/types/SubmitActionComponent.ts b/src/api/types/SubmitActionComponent.ts deleted file mode 100644 index c1eec8c9..00000000 --- a/src/api/types/SubmitActionComponent.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -/** - * A submit action triggers a [Submit Request](https://developers.intercom.com/docs/canvas-kit#submit-request) to be sent. This request will include all values which have been entered into all the interactive components on the current canvas. - */ -export interface SubmitActionComponent {} diff --git a/src/api/types/SubmitRequest.ts b/src/api/types/SubmitRequest.ts deleted file mode 100644 index 38aa3f2c..00000000 --- a/src/api/types/SubmitRequest.ts +++ /dev/null @@ -1,31 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as Intercom from "../index"; - -/** - * The Submit request is triggered when a component with a submit action is interacted with in Messenger Inbox. - */ -export interface SubmitRequest { - /** The workspace ID of the teammate. Attribute is `app_id` for V1.2 and below. */ - workspace_id: string; - /** The Intercom hosted region that this app is located in. */ - workspace_region: string; - /** The Intercom teammate viewing the conversation. */ - admin: Intercom.Admin; - /** The id of the component clicked by the teammate to trigger the request. */ - component_id: string; - /** The context of where the app is added, where the user last visited, and information on the Messenger settings. */ - context: Intercom.Context; - /** The conversation where your app is being shown. */ - conversation: Intercom.Conversation; - /** The current canvas the teammate can see. */ - current_canvas: Intercom.CurrentCanvas; - /** The contact which is currently being viewed by the teammate in the conversation details panel. */ - contact: Intercom.Contact; - /** A list of key/value pairs of data, inputted by the teammate on the current canvas. */ - input_values: Record; - /** The user who took the action. */ - user: Intercom.Contact; -} diff --git a/src/api/types/SubmitResponse.ts b/src/api/types/SubmitResponse.ts deleted file mode 100644 index 9e2ff974..00000000 --- a/src/api/types/SubmitResponse.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -import * as Intercom from "../index"; - -/** - * The response object returned when submitting an app interaction. This will replace the previous canvas that was visible until the app was interacted with. - * - * You can optionally provide an event object with the attribute `type` given as `completed` to tell us if the app has completed its purpose. For example, an email collector app would be complete when the end-user submits their email address. - * - * Apps in conversation details can also optionally insert an app into the conversation reply: - * - * 1. You respond with a card_creation_options object (https://developers.intercom.com/canvas-kit-reference/reference/card-creation-options) - * 2. We send a request to the initialize URL for Messenger capabilities (https://developers.intercom.com/docs/build-an-integration/getting-started/build-an-app-for-your-messenger/request-flows) with the card_creation_options object present - * 3. You respond with a canvas object with the components you want to insert into the conversation reply - */ -export interface SubmitResponse { - /** The canvas object that defines the new UI to be shown. */ - canvas: Intercom.CanvasObject; - /** Optional. Key-value pairs that will be sent in the initialize request to insert an app into the conversation reply. */ - card_creation_options?: Record; - /** Optional. Indicates if the app has completed its purpose. */ - event?: Intercom.Event; -} diff --git a/src/api/types/SubscriptionTypeList.ts b/src/api/types/SubscriptionTypeList.ts index 39b5ec38..dd128066 100644 --- a/src/api/types/SubscriptionTypeList.ts +++ b/src/api/types/SubscriptionTypeList.ts @@ -9,7 +9,7 @@ import * as Intercom from "../index"; */ export interface SubscriptionTypeList { /** The type of the object */ - type: "list"; + type?: "list"; /** A list of subscription type objects associated with the workspace . */ - data: Intercom.SubscriptionType[]; + data?: Intercom.SubscriptionType[]; } diff --git a/src/api/types/TagList.ts b/src/api/types/TagList.ts index 4e658c56..40b7a35c 100644 --- a/src/api/types/TagList.ts +++ b/src/api/types/TagList.ts @@ -9,7 +9,7 @@ import * as Intercom from "../index"; */ export interface TagList { /** The type of the object */ - type: "list"; + type?: "list"; /** A list of tags objects associated with the workspace . */ - data: Intercom.Tag[]; + data?: Intercom.Tag[]; } diff --git a/src/api/types/Tags.ts b/src/api/types/Tags.ts index b1257d7d..d8456225 100644 --- a/src/api/types/Tags.ts +++ b/src/api/types/Tags.ts @@ -9,7 +9,7 @@ import * as Intercom from "../index"; */ export interface Tags { /** The type of the object */ - type: "tag.list"; + type?: "tag.list"; /** A list of tags objects associated with the conversation. */ - tags: Intercom.Tag[]; + tags?: Intercom.Tag[]; } diff --git a/src/api/types/TeamList.ts b/src/api/types/TeamList.ts index b7833bf3..1e592011 100644 --- a/src/api/types/TeamList.ts +++ b/src/api/types/TeamList.ts @@ -9,7 +9,7 @@ import * as Intercom from "../index"; */ export interface TeamList { /** The type of the object */ - type: "team.list"; + type?: "team.list"; /** A list of team objects */ - teams: Intercom.Team[]; + teams?: Intercom.Team[]; } diff --git a/src/api/types/TextAreaComponent.ts b/src/api/types/TextAreaComponent.ts deleted file mode 100644 index 1a2d215c..00000000 --- a/src/api/types/TextAreaComponent.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -/** - * A text area component is used to capture a large amount of text as input with a multi-line text box. You can submit the value of the text area by: - * - * - Using a ButtonComponent (which will submit all interactive components in the canvas) - */ -export interface TextAreaComponent { - /** A unique identifier for the component. */ - id: string; - /** The text shown above the text area. */ - label?: string; - /** An example value shown inside the component when it's empty. */ - placeholder?: string; - /** An entered value which is already inside the component. */ - value?: string; - /** Styles the input as failed. Default is false. */ - error?: boolean; - /** Styles the input and prevents the action. Default is false. */ - disabled?: boolean; -} diff --git a/src/api/types/TextComponent.ts b/src/api/types/TextComponent.ts deleted file mode 100644 index 1fe6bce2..00000000 --- a/src/api/types/TextComponent.ts +++ /dev/null @@ -1,41 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -/** - * A text component is used for rendering blocks of text. Links and bold font can be rendered through Markdown. There are different styles provided which edit the color, weight, and font size. These cannot be edited through Markdown. - */ -export interface TextComponent { - /** A unique identifier for the component. */ - id?: string; - /** The text that will be rendered. */ - text: string; - /** Aligns the text. Default is `left`. */ - align?: TextComponent.Align; - /** Styles the text. Default is `paragraph`. */ - style?: TextComponent.Style; - /** Disables a component's margin-bottom of 10px. */ - bottom_margin?: "none"; -} - -export namespace TextComponent { - /** - * Aligns the text. Default is `left`. - */ - export type Align = "left" | "center" | "right"; - export const Align = { - Left: "left", - Center: "center", - Right: "right", - } as const; - /** - * Styles the text. Default is `paragraph`. - */ - export type Style = "header" | "paragraph" | "muted" | "error"; - export const Style = { - Header: "header", - Paragraph: "paragraph", - Muted: "muted", - Error: "error", - } as const; -} diff --git a/src/api/types/TicketList.ts b/src/api/types/TicketList.ts index 5cfdf4fe..31593e3c 100644 --- a/src/api/types/TicketList.ts +++ b/src/api/types/TicketList.ts @@ -9,10 +9,10 @@ import * as Intercom from "../index"; */ export interface TicketList { /** Always ticket.list */ - type: "ticket.list"; + type?: "ticket.list"; /** The list of ticket objects */ - tickets: Intercom.Ticket[]; + tickets?: (Intercom.Ticket | undefined)[]; /** A count of the total number of objects. */ - total_count: number; + total_count?: number; pages?: Intercom.CursorPages; } diff --git a/src/api/types/TicketPartAuthor.ts b/src/api/types/TicketPartAuthor.ts index c09f0739..6dc2eb3b 100644 --- a/src/api/types/TicketPartAuthor.ts +++ b/src/api/types/TicketPartAuthor.ts @@ -7,13 +7,13 @@ */ export interface TicketPartAuthor { /** The type of the author */ - type: TicketPartAuthor.Type; + type?: TicketPartAuthor.Type; /** The id of the author */ - id: string; + id?: string; /** The name of the author */ name?: string; /** The email of the author */ - email: string; + email?: string; } export namespace TicketPartAuthor { diff --git a/src/api/types/TicketParts.ts b/src/api/types/TicketParts.ts index f6d4ee25..6ec04ff9 100644 --- a/src/api/types/TicketParts.ts +++ b/src/api/types/TicketParts.ts @@ -9,9 +9,9 @@ import * as Intercom from "../index"; */ export interface TicketParts { /** */ - type: "ticket_part.list"; + type?: "ticket_part.list"; /** A list of Ticket Part objects for each ticket. There is a limit of 500 parts. */ - ticket_parts: Intercom.TicketPart[]; + ticket_parts?: Intercom.TicketPart[]; /** */ - total_count: number; + total_count?: number; } diff --git a/src/api/types/TicketReply.ts b/src/api/types/TicketReply.ts index 7c3b7f11..81a692d6 100644 --- a/src/api/types/TicketReply.ts +++ b/src/api/types/TicketReply.ts @@ -9,15 +9,15 @@ import * as Intercom from "../index"; */ export interface TicketReply { /** Always ticket_part */ - type: "ticket_part"; + type?: "ticket_part"; /** The id representing the part. */ - id: string; + id?: string; /** Type of the part */ - part_type: TicketReply.PartType; + part_type?: TicketReply.PartType; /** The message body, which may contain HTML. */ body?: string; /** The time the note was created. */ - created_at: number; + created_at?: number; /** The last time the note was updated. */ updated_at?: number; author?: Intercom.TicketPartAuthor; diff --git a/src/api/types/TicketStateList.ts b/src/api/types/TicketStateList.ts new file mode 100644 index 00000000..40071956 --- /dev/null +++ b/src/api/types/TicketStateList.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as Intercom from "../index"; + +/** + * A list of ticket states associated with a given ticket type. + */ +export interface TicketStateList { + /** String representing the object's type. Always has the value `list`. */ + type?: string; + /** A list of ticket states associated with a given ticket type. */ + data?: (Intercom.TicketStateDetailed | undefined)[]; +} diff --git a/src/api/types/TicketTypeAttribute.ts b/src/api/types/TicketTypeAttribute.ts index a0267806..992d3c4b 100644 --- a/src/api/types/TicketTypeAttribute.ts +++ b/src/api/types/TicketTypeAttribute.ts @@ -7,37 +7,37 @@ */ export interface TicketTypeAttribute { /** String representing the object's type. Always has the value `ticket_type_attribute`. */ - type: "ticket_type_attribute"; + type?: string; /** The id representing the ticket type attribute. */ - id: string; + id?: string; /** The id of the workspace that the ticket type attribute belongs to. */ - workspace_id: string; + workspace_id?: string; /** The name of the ticket type attribute */ - name: string; + name?: string; /** The description of the ticket type attribute */ - description: string; + description?: string; /** The type of the data attribute (allowed values: "string list integer decimal boolean datetime files") */ - data_type: TicketTypeAttribute.DataType; + data_type?: TicketTypeAttribute.DataType; /** Input options for the attribute */ - input_options: Record; + input_options?: Record; /** The order of the attribute against other attributes */ - order: number; + order?: number; /** Whether the attribute is required or not for teammates. */ - required_to_create: boolean; + required_to_create?: boolean; /** Whether the attribute is required or not for contacts. */ - required_to_create_for_contacts: boolean; + required_to_create_for_contacts?: boolean; /** Whether the attribute is visible or not to teammates. */ - visible_on_create: boolean; + visible_on_create?: boolean; /** Whether the attribute is visible or not to contacts. */ - visible_to_contacts: boolean; + visible_to_contacts?: boolean; /** Whether the attribute is built in or not. */ - default: boolean; + default?: boolean; /** The id of the ticket type that the attribute belongs to. */ - ticket_type_id: number; + ticket_type_id?: number; /** Whether the ticket type attribute is archived or not. */ - archived: boolean; + archived?: boolean; /** The date and time the ticket type attribute was created. */ - created_at: number; + created_at?: number; /** The date and time the ticket type attribute was last updated. */ updated_at?: number; } diff --git a/src/api/types/TicketTypeAttributeList.ts b/src/api/types/TicketTypeAttributeList.ts index 011e3cc2..c666a70a 100644 --- a/src/api/types/TicketTypeAttributeList.ts +++ b/src/api/types/TicketTypeAttributeList.ts @@ -9,7 +9,7 @@ import * as Intercom from "../index"; */ export interface TicketTypeAttributeList { /** String representing the object's type. Always has the value `ticket_type_attributes.list`. */ - type: "ticket_type_attributes.list"; + type?: string; /** A list of ticket type attributes associated with a given ticket type. */ - ticket_type_attributes: Intercom.TicketTypeAttribute[]; + ticket_type_attributes?: (Intercom.TicketTypeAttribute | undefined)[]; } diff --git a/src/api/types/TicketTypeList.ts b/src/api/types/TicketTypeList.ts index 3a4d2b86..00e62f94 100644 --- a/src/api/types/TicketTypeList.ts +++ b/src/api/types/TicketTypeList.ts @@ -8,8 +8,8 @@ import * as Intercom from "../index"; * A list of ticket types associated with a given workspace. */ export interface TicketTypeList { - /** String representing the object's type. Always has the value `ticket_type.list`. */ - type: "ticket_type_attributes.list"; + /** String representing the object's type. Always has the value `list`. */ + type?: string; /** A list of ticket_types associated with a given workspace. */ - ticket_types: Intercom.TicketType[]; + data?: (Intercom.TicketType | undefined)[]; } diff --git a/src/api/types/Translation.ts b/src/api/types/Translation.ts index 19b73881..9807efeb 100644 --- a/src/api/types/Translation.ts +++ b/src/api/types/Translation.ts @@ -7,9 +7,9 @@ */ export interface Translation { /** The localised name of the subscription type. */ - name: string; + name?: string; /** The localised description of the subscription type. */ - description: string; + description?: string; /** The two character identifier for the language of the translation object. */ - locale: string; + locale?: string; } diff --git a/src/api/types/UntagCompanyRequest.ts b/src/api/types/UntagCompanyRequest.ts index dd179dde..b970ebc4 100644 --- a/src/api/types/UntagCompanyRequest.ts +++ b/src/api/types/UntagCompanyRequest.ts @@ -18,11 +18,11 @@ export namespace UntagCompanyRequest { export namespace Companies { export interface Item { /** The Intercom defined id representing the company. */ - id: string; + id?: string; /** The company id you have defined for the company. */ - company_id: string; + company_id?: string; /** Always set to true */ - untag: true; + untag?: boolean; } } } diff --git a/src/api/types/UpdateArticleRequestBody.ts b/src/api/types/UpdateArticleRequestBody.ts new file mode 100644 index 00000000..7fdfcd71 --- /dev/null +++ b/src/api/types/UpdateArticleRequestBody.ts @@ -0,0 +1,15 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface UpdateArticleRequestBody { + parent_type?: UpdateArticleRequestBody.ParentType; +} + +export namespace UpdateArticleRequestBody { + export type ParentType = "collection" | "section"; + export const ParentType = { + Collection: "collection", + Section: "section", + } as const; +} diff --git a/src/api/types/UpdateDataAttributeRequestBody.ts b/src/api/types/UpdateDataAttributeRequestBody.ts new file mode 100644 index 00000000..c2d7dbe9 --- /dev/null +++ b/src/api/types/UpdateDataAttributeRequestBody.ts @@ -0,0 +1,14 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +/** + * + */ +export type UpdateDataAttributeRequestBody = + | { + options: { + value?: string | undefined; + }[]; + } + | unknown; diff --git a/src/api/types/UrlActionComponent.ts b/src/api/types/UrlActionComponent.ts deleted file mode 100644 index 34d44dcf..00000000 --- a/src/api/types/UrlActionComponent.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -/** - * A URL action opens a given link in a new browser tab. - */ -export interface UrlActionComponent { - /** The link you want to open. */ - url: string; -} diff --git a/src/api/types/Visitor.ts b/src/api/types/Visitor.ts index 6865b074..ccac4fd2 100644 --- a/src/api/types/Visitor.ts +++ b/src/api/types/Visitor.ts @@ -9,15 +9,15 @@ import * as Intercom from "../index"; */ export interface Visitor { /** Value is 'visitor' */ - type: "visitor"; + type?: "visitor"; /** The Intercom defined id representing the Visitor. */ - id: string; + id?: string; /** Automatically generated identifier for the Visitor. */ - user_id: string; + user_id?: string; /** Identifies if this visitor is anonymous. */ - anonymous: boolean; + anonymous?: boolean; /** The email of the visitor. */ - email: string; + email?: string; /** The phone number of the visitor. */ phone?: string; /** The name of the visitor. */ @@ -26,17 +26,17 @@ export interface Visitor { pseudonym?: string; avatar?: Visitor.Avatar; /** The id of the app the visitor is associated with. */ - app_id: string; + app_id?: string; companies?: Visitor.Companies; location_data?: Visitor.LocationData; /** The time the Lead last recorded making a request. */ las_request_at?: number; /** The time the Visitor was added to Intercom. */ - created_at: number; + created_at?: number; /** The time the Visitor was added to Intercom. */ remote_created_at?: number; /** The time the Visitor signed up for your product. */ - signed_up_at: number; + signed_up_at?: number; /** The last time the Visitor was updated. */ updated_at?: number; /** The number of sessions the Visitor has had. */ diff --git a/src/api/types/VisitorDeletedObject.ts b/src/api/types/VisitorDeletedObject.ts index 3195b30d..6d2dcfd3 100644 --- a/src/api/types/VisitorDeletedObject.ts +++ b/src/api/types/VisitorDeletedObject.ts @@ -7,9 +7,9 @@ */ export interface VisitorDeletedObject { /** The unique identifier for the visitor which is given by Intercom. */ - id: string; + id?: string; /** The type of object which was deleted */ - type: "visitor"; + type?: "visitor"; /** Automatically generated identifier for the Visitor. */ - user_id: string; + user_id?: string; } diff --git a/src/api/types/WhatsappMessageStatusList.ts b/src/api/types/WhatsappMessageStatusList.ts new file mode 100644 index 00000000..71377c21 --- /dev/null +++ b/src/api/types/WhatsappMessageStatusList.ts @@ -0,0 +1,71 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +export interface WhatsappMessageStatusList { + type: "list"; + /** The provided ruleset ID */ + ruleset_id: string; + pages: WhatsappMessageStatusList.Pages; + /** Total number of events */ + total_count: number; + events: WhatsappMessageStatusList.Events.Item[]; +} + +export namespace WhatsappMessageStatusList { + export interface Pages { + type: "pages"; + /** Number of results per page */ + per_page: number; + /** Total number of pages */ + total_pages: number; + /** Information for fetching next page (null if no more pages) */ + next?: Pages.Next; + } + + export namespace Pages { + /** + * Information for fetching next page (null if no more pages) + */ + export interface Next { + /** Cursor for the next page */ + starting_after?: string; + } + } + + export type Events = Events.Item[]; + + export namespace Events { + export interface Item { + /** Event ID */ + id: string; + /** ID of the conversation */ + conversation_id: string; + /** Current status of the message */ + status: Item.Status; + /** Event type */ + type: "broadcast_outbound"; + /** Creation timestamp */ + created_at: number; + /** Last update timestamp */ + updated_at: number; + /** WhatsApp's message identifier */ + whatsapp_message_id: string; + /** Name of the WhatsApp template used */ + template_name?: string; + } + + export namespace Item { + /** + * Current status of the message + */ + export type Status = "sent" | "delivered" | "read" | "failed"; + export const Status = { + Sent: "sent", + Delivered: "delivered", + Read: "read", + Failed: "failed", + } as const; + } + } +} diff --git a/src/api/types/index.ts b/src/api/types/index.ts index 2a4c1060..4f4919cb 100644 --- a/src/api/types/index.ts +++ b/src/api/types/index.ts @@ -1,4 +1,5 @@ -export * from "./ActionComponent"; +export * from "./NotFoundErrorBody"; +export * from "./Datetime"; export * from "./ActivityLog"; export * from "./ActivityLogList"; export * from "./ActivityLogMetadata"; @@ -10,27 +11,21 @@ export * from "./AdminReplyTicketRequest"; export * from "./AdminWithApp"; export * from "./App"; export * from "./ArticleContent"; +export * from "./InternalArticleList"; export * from "./ArticleList"; export * from "./ArticleStatistics"; export * from "./ArticleTranslatedContent"; export * from "./AssignConversationRequest"; -export * from "./ButtonComponent"; -export * from "./CanvasObject"; -export * from "./CheckboxOption"; -export * from "./CheckboxComponent"; +export * from "./AwayStatusReason"; export * from "./CloseConversationRequest"; export * from "./CollectionList"; export * from "./CompanyAttachedContacts"; export * from "./CompanyAttachedSegments"; export * from "./CompanyList"; export * from "./CompanyScroll"; -export * from "./Component"; -export * from "./ConfigureRequest"; -export * from "./ConfigureResponse"; -export * from "./ContactArchived"; export * from "./ContactAttachedCompanies"; export * from "./ContactCompanies"; -export * from "./ContactCompany"; +export * from "./CompanyData"; export * from "./ContactDeleted"; export * from "./ContactList"; export * from "./ContactLocation"; @@ -49,89 +44,93 @@ export * from "./ContactSegments"; export * from "./ContactSocialProfiles"; export * from "./ContactSubscriptionTypes"; export * from "./ContactTags"; +export * from "./ContactArchived"; export * from "./ContactUnarchived"; -export * from "./ContentObject"; +export * from "./ContactBlocked"; export * from "./ContentSourcesList"; -export * from "./Context"; export * from "./ConversationAttachmentFiles"; export * from "./ConversationContacts"; +export * from "./ConversationDeleted"; export * from "./ConversationFirstContactReply"; -export * from "./PaginatedConversationResponse"; +export * from "./ConversationList"; export * from "./ConversationPart"; export * from "./ConversationPartAuthor"; export * from "./ConversationParts"; +export * from "./ConversationPartMetadata"; export * from "./ConversationRating"; +export * from "./ConversationResponseTime"; export * from "./ConversationSource"; export * from "./ConversationStatistics"; export * from "./ConversationTeammates"; +export * from "./CreateArticleRequest"; +export * from "./CreateInternalArticleRequest"; export * from "./CreateContactRequest"; +export * from "./CreateDataAttributeRequest"; export * from "./CreateDataEventRequest"; export * from "./CreateMessageRequest"; +export * from "./Recipient"; +export * from "./CreateOrUpdateCompanyRequest"; export * from "./CreateOrUpdateTagRequest"; +export * from "./CreatePhoneSwitchRequest"; export * from "./CreateTicketReplyWithCommentRequest"; -export * from "./CreateTicketRequest"; -export * from "./CurrentCanvas"; +export * from "./CreateTicketRequestBody"; +export * from "./CreateTicketTypeRequest"; export * from "./CursorPages"; +export * from "./CallList"; +export * from "./CustomAttributes"; +export * from "./CustomObjectInstanceDeleted"; +export * from "./CustomObjectInstanceList"; export * from "./CustomerRequest"; export * from "./DataAttributeList"; export * from "./DataEventList"; export * from "./DataEventSummary"; export * from "./DataEventSummaryItem"; export * from "./DataExportCsv"; -export * from "./DataTableItem"; -export * from "./DataTableComponent"; export * from "./DeletedArticleObject"; +export * from "./DeletedInternalArticleObject"; export * from "./DeletedCollectionObject"; export * from "./DeletedCompanyObject"; export * from "./DeletedObject"; -export * from "./DividerComponent"; -export * from "./DropdownOption"; -export * from "./DropdownComponent"; +export * from "./EmailAddressHeader"; +export * from "./EmailMessageMetadata"; +export * from "./Metadata"; +export * from "./ConversationAttributeUpdatedByWorkflow"; +export * from "./ConversationAttributeUpdatedByAdmin"; +export * from "./CustomActionStarted"; +export * from "./CustomChannelAttribute"; +export * from "./CustomChannelBaseEvent"; +export * from "./CustomChannelContact"; +export * from "./CustomChannelNotificationResponse"; +export * from "./CustomActionFinished"; +export * from "./OperatorWorkflowEvent"; +export * from "./EventDetails"; export * from "./Error_"; -export * from "./Event"; export * from "./FileAttribute"; export * from "./GroupContent"; export * from "./GroupTranslatedContent"; -export * from "./ImageComponent"; -export * from "./InitializeRequest"; -export * from "./InitializeResponse"; -export * from "./InputComponent"; export * from "./LinkedObject"; export * from "./LinkedObjectList"; -export * from "./ListItem"; -export * from "./ListItemWithImage"; -export * from "./ListItemWithoutImage"; -export * from "./ListComponent"; -export * from "./LiveCanvasRequest"; -export * from "./LiveCanvasResponse"; -export * from "./MultipleOrSingleFilterSearchRequest"; +export * from "./WhatsappMessageStatusList"; export * from "./MultipleFilterSearchRequest"; export * from "./NewsItemRequest"; export * from "./NoteList"; export * from "./OpenConversationRequest"; export * from "./PagesLink"; -export * from "./PaginatedNewsItemResponse"; -export * from "./PaginatedNewsfeedResponse"; +export * from "./PaginatedResponseDataItem"; +export * from "./PaginatedResponse"; export * from "./PartAttachment"; export * from "./PhoneSwitch"; +export * from "./QuickReplyOption"; export * from "./RedactConversationRequest"; export * from "./Reference"; export * from "./ReplyConversationRequest"; -export * from "./ResultsResponse"; export * from "./SearchRequest"; export * from "./SegmentList"; -export * from "./SheetActionComponent"; export * from "./SingleFilterSearchRequest"; -export * from "./SingleSelectOption"; -export * from "./SingleSelectComponent"; export * from "./SlaApplied"; export * from "./SnoozeConversationRequest"; export * from "./SocialProfile"; -export * from "./SpacerComponent"; export * from "./StartingAfterPaging"; -export * from "./SubmitActionComponent"; -export * from "./SubmitRequest"; -export * from "./SubmitResponse"; export * from "./SubscriptionTypeList"; export * from "./TagCompanyRequest"; export * from "./TagList"; @@ -139,27 +138,25 @@ export * from "./TagMultipleUsersRequest"; export * from "./Tags"; export * from "./TeamList"; export * from "./TeamPriorityLevel"; -export * from "./TextComponent"; -export * from "./TextAreaComponent"; export * from "./TicketCustomAttributes"; export * from "./TicketList"; export * from "./TicketPartAuthor"; export * from "./TicketParts"; export * from "./TicketReply"; export * from "./TicketRequestCustomAttributes"; +export * from "./TicketStateList"; export * from "./TicketTypeAttribute"; export * from "./TicketTypeAttributeList"; export * from "./TicketTypeList"; export * from "./Translation"; export * from "./UntagCompanyRequest"; +export * from "./UpdateDataAttributeRequestBody"; export * from "./UpdateVisitorRequest"; -export * from "./UrlActionComponent"; export * from "./Visitor"; export * from "./VisitorDeletedObject"; -export * from "./CustomAttributes"; +export * from "./UpdateArticleRequestBody"; export * from "./OffsetPages"; export * from "./CreateContactRequestTwo"; export * from "./CreateDataEventRequestTwo"; -export * from "./CreateMessageRequestTwo"; -export * from "./Metadata"; +export * from "./CreateMessageRequestThree"; export * from "./UpdateVisitorRequestOne"; diff --git a/src/version.ts b/src/version.ts index 1420c168..6bb53d57 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const SDK_VERSION = "6.4.0"; +export const SDK_VERSION = "7.0.0"; diff --git a/yarn.lock b/yarn.lock index c9de42eb..b0c651ec 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,14 +2,6 @@ # yarn lockfile v1 -"@ampproject/remapping@^2.2.0": - version "2.3.0" - resolved "https://registry.yarnpkg.com/@ampproject/remapping/-/remapping-2.3.0.tgz#ed441b6fa600072520ce18b43d2c8cc8caecc7f4" - integrity sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw== - dependencies: - "@jridgewell/gen-mapping" "^0.3.5" - "@jridgewell/trace-mapping" "^0.3.24" - "@babel/code-frame@^7.0.0", "@babel/code-frame@^7.12.13", "@babel/code-frame@^7.27.1": version "7.27.1" resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.27.1.tgz#200f715e66d52a23b221a9435534a91cc13ad5be" @@ -20,40 +12,40 @@ picocolors "^1.1.1" "@babel/compat-data@^7.27.2": - version "7.27.5" - resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.27.5.tgz#7d0658ec1a8420fc866d1df1b03bea0e79934c82" - integrity sha512-KiRAp/VoJaWkkte84TvUd9qjdbZAdiqyvMxrGl1N6vzFogKmaLgoM3L1kgtLicp2HP5fBJS8JrZKLVIZGVJAVg== + version "7.28.4" + resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.28.4.tgz#96fdf1af1b8859c8474ab39c295312bfb7c24b04" + integrity sha512-YsmSKC29MJwf0gF8Rjjrg5LQCmyh+j/nD8/eP7f+BeoQTKYqs9RoWbjGOdy0+1Ekr68RJZMUOPVQaQisnIo4Rw== "@babel/core@^7.11.6", "@babel/core@^7.12.3", "@babel/core@^7.23.9": - version "7.27.4" - resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.27.4.tgz#cc1fc55d0ce140a1828d1dd2a2eba285adbfb3ce" - integrity sha512-bXYxrXFubeYdvB0NhD/NBB3Qi6aZeV20GOWVI47t2dkecCEoneR4NPVcb7abpXDEvejgrUfFtG6vG/zxAKmg+g== + version "7.28.4" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.28.4.tgz#12a550b8794452df4c8b084f95003bce1742d496" + integrity sha512-2BCOP7TN8M+gVDj7/ht3hsaO/B/n5oDbiAyyvnRlNOs+u1o+JWNYTQrmpuNp1/Wq2gcFrI01JAW+paEKDMx/CA== dependencies: - "@ampproject/remapping" "^2.2.0" "@babel/code-frame" "^7.27.1" - "@babel/generator" "^7.27.3" + "@babel/generator" "^7.28.3" "@babel/helper-compilation-targets" "^7.27.2" - "@babel/helper-module-transforms" "^7.27.3" - "@babel/helpers" "^7.27.4" - "@babel/parser" "^7.27.4" + "@babel/helper-module-transforms" "^7.28.3" + "@babel/helpers" "^7.28.4" + "@babel/parser" "^7.28.4" "@babel/template" "^7.27.2" - "@babel/traverse" "^7.27.4" - "@babel/types" "^7.27.3" + "@babel/traverse" "^7.28.4" + "@babel/types" "^7.28.4" + "@jridgewell/remapping" "^2.3.5" convert-source-map "^2.0.0" debug "^4.1.0" gensync "^1.0.0-beta.2" json5 "^2.2.3" semver "^6.3.1" -"@babel/generator@^7.27.3", "@babel/generator@^7.7.2": - version "7.27.5" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.27.5.tgz#3eb01866b345ba261b04911020cbe22dd4be8c8c" - integrity sha512-ZGhA37l0e/g2s1Cnzdix0O3aLYm66eF8aufiVteOgnwxgnRP8GoyMj7VWsgWnQbVKXyge7hqrFh2K2TQM6t1Hw== +"@babel/generator@^7.28.3", "@babel/generator@^7.7.2": + version "7.28.3" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.28.3.tgz#9626c1741c650cbac39121694a0f2d7451b8ef3e" + integrity sha512-3lSpxGgvnmZznmBkCRnVREPUFJv2wrv9iAoFDvADJc0ypmdOxdUtcLeBgBJ6zE0PMeTKnxeQzyk0xTBq4Ep7zw== dependencies: - "@babel/parser" "^7.27.5" - "@babel/types" "^7.27.3" - "@jridgewell/gen-mapping" "^0.3.5" - "@jridgewell/trace-mapping" "^0.3.25" + "@babel/parser" "^7.28.3" + "@babel/types" "^7.28.2" + "@jridgewell/gen-mapping" "^0.3.12" + "@jridgewell/trace-mapping" "^0.3.28" jsesc "^3.0.2" "@babel/helper-compilation-targets@^7.27.2": @@ -67,6 +59,11 @@ lru-cache "^5.1.1" semver "^6.3.1" +"@babel/helper-globals@^7.28.0": + version "7.28.0" + resolved "https://registry.yarnpkg.com/@babel/helper-globals/-/helper-globals-7.28.0.tgz#b9430df2aa4e17bc28665eadeae8aa1d985e6674" + integrity sha512-+W6cISkXFa1jXsDEdYA8HeevQT/FULhxzR99pxphltZcVaugps53THCeiWA8SguxxpSp3gKPiuYfSWopkLQ4hw== + "@babel/helper-module-imports@^7.27.1": version "7.27.1" resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.27.1.tgz#7ef769a323e2655e126673bb6d2d6913bbead204" @@ -75,14 +72,14 @@ "@babel/traverse" "^7.27.1" "@babel/types" "^7.27.1" -"@babel/helper-module-transforms@^7.27.3": - version "7.27.3" - resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.27.3.tgz#db0bbcfba5802f9ef7870705a7ef8788508ede02" - integrity sha512-dSOvYwvyLsWBeIRyOeHXp5vPj5l1I011r52FM1+r1jCERv+aFXYk4whgQccYEGYxK2H3ZAIA8nuPkQ0HaUo3qg== +"@babel/helper-module-transforms@^7.28.3": + version "7.28.3" + resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.28.3.tgz#a2b37d3da3b2344fe085dab234426f2b9a2fa5f6" + integrity sha512-gytXUbs8k2sXS9PnQptz5o0QnpLL51SwASIORY6XaBKF88nsOT0Zw9szLqlSGQDP/4TljBAD5y98p2U1fqkdsw== dependencies: "@babel/helper-module-imports" "^7.27.1" "@babel/helper-validator-identifier" "^7.27.1" - "@babel/traverse" "^7.27.3" + "@babel/traverse" "^7.28.3" "@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.10.4", "@babel/helper-plugin-utils@^7.12.13", "@babel/helper-plugin-utils@^7.14.5", "@babel/helper-plugin-utils@^7.27.1", "@babel/helper-plugin-utils@^7.8.0": version "7.27.1" @@ -104,20 +101,20 @@ resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.27.1.tgz#fa52f5b1e7db1ab049445b421c4471303897702f" integrity sha512-YvjJow9FxbhFFKDSuFnVCe2WxXk1zWc22fFePVNEaWJEu8IrZVlda6N0uHwzZrUM1il7NC9Mlp4MaJYbYd9JSg== -"@babel/helpers@^7.27.4": - version "7.27.6" - resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.27.6.tgz#6456fed15b2cb669d2d1fabe84b66b34991d812c" - integrity sha512-muE8Tt8M22638HU31A3CgfSUciwz1fhATfoVai05aPXGor//CdWDCbnlY1yvBPo07njuVOCNGCSp/GTt12lIug== +"@babel/helpers@^7.28.4": + version "7.28.4" + resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.28.4.tgz#fe07274742e95bdf7cf1443593eeb8926ab63827" + integrity sha512-HFN59MmQXGHVyYadKLVumYsA9dBFun/ldYxipEjzA4196jpLZd8UjEEBLkbEkvfYreDqJhZxYAWFPtrfhNpj4w== dependencies: "@babel/template" "^7.27.2" - "@babel/types" "^7.27.6" + "@babel/types" "^7.28.4" -"@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.20.7", "@babel/parser@^7.23.9", "@babel/parser@^7.27.2", "@babel/parser@^7.27.4", "@babel/parser@^7.27.5": - version "7.27.5" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.27.5.tgz#ed22f871f110aa285a6fd934a0efed621d118826" - integrity sha512-OsQd175SxWkGlzbny8J3K8TnnDD0N3lrIUtB92xwyRpzaenGZhxDvxN/JgU00U3CDZNj9tPuDJ5H0WS4Nt3vKg== +"@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.20.7", "@babel/parser@^7.23.9", "@babel/parser@^7.27.2", "@babel/parser@^7.28.3", "@babel/parser@^7.28.4": + version "7.28.4" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.28.4.tgz#da25d4643532890932cc03f7705fe19637e03fa8" + integrity sha512-yZbBqeM6TkpP9du/I2pUZnJsRMGGvOuIrhjzC1AwHwW+6he4mni6Bp/m8ijn0iOuZuPI2BfkCoSRunpyjnrQKg== dependencies: - "@babel/types" "^7.27.3" + "@babel/types" "^7.28.4" "@babel/plugin-syntax-async-generators@^7.8.4": version "7.8.4" @@ -247,23 +244,23 @@ "@babel/parser" "^7.27.2" "@babel/types" "^7.27.1" -"@babel/traverse@^7.27.1", "@babel/traverse@^7.27.3", "@babel/traverse@^7.27.4": - version "7.27.4" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.27.4.tgz#b0045ac7023c8472c3d35effd7cc9ebd638da6ea" - integrity sha512-oNcu2QbHqts9BtOWJosOVJapWjBDSxGCpFvikNR5TGDYDQf3JwpIoMzIKrvfoti93cLfPJEG4tH9SPVeyCGgdA== +"@babel/traverse@^7.27.1", "@babel/traverse@^7.28.3", "@babel/traverse@^7.28.4": + version "7.28.4" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.28.4.tgz#8d456101b96ab175d487249f60680221692b958b" + integrity sha512-YEzuboP2qvQavAcjgQNVgsvHIDv6ZpwXvcvjmyySP2DIMuByS/6ioU5G9pYrWHM6T2YDfc7xga9iNzYOs12CFQ== dependencies: "@babel/code-frame" "^7.27.1" - "@babel/generator" "^7.27.3" - "@babel/parser" "^7.27.4" + "@babel/generator" "^7.28.3" + "@babel/helper-globals" "^7.28.0" + "@babel/parser" "^7.28.4" "@babel/template" "^7.27.2" - "@babel/types" "^7.27.3" + "@babel/types" "^7.28.4" debug "^4.3.1" - globals "^11.1.0" -"@babel/types@^7.0.0", "@babel/types@^7.20.7", "@babel/types@^7.27.1", "@babel/types@^7.27.3", "@babel/types@^7.27.6", "@babel/types@^7.3.3": - version "7.27.6" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.27.6.tgz#a434ca7add514d4e646c80f7375c0aa2befc5535" - integrity sha512-ETyHEk2VHHvl9b9jZP5IHPavHYk57EhanlRRuae9XCpb/j5bDCbPPMOBfCWhnl/7EDJz0jEMCi/RhccCE8r1+Q== +"@babel/types@^7.0.0", "@babel/types@^7.20.7", "@babel/types@^7.27.1", "@babel/types@^7.28.2", "@babel/types@^7.28.4", "@babel/types@^7.3.3": + version "7.28.4" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.28.4.tgz#0a4e618f4c60a7cd6c11cb2d48060e4dbe38ac3a" + integrity sha512-bkFqkLhh3pMBUQQkpVgWDWq/lqzc2678eUyDlTBhRqhCHFguYYGM0Efga7tYk4TogG/3x0EEl66/OQ+WGbWB/Q== dependencies: "@babel/helper-string-parser" "^7.27.1" "@babel/helper-validator-identifier" "^7.27.1" @@ -481,13 +478,20 @@ "@types/yargs" "^17.0.8" chalk "^4.0.0" -"@jridgewell/gen-mapping@^0.3.5": - version "0.3.8" - resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.8.tgz#4f0e06362e01362f823d348f1872b08f666d8142" - integrity sha512-imAbBGkb+ebQyxKgzv5Hu2nmROxoDOXHh80evxdoXNOrvAnVx7zimzc1Oo5h9RlfV4vPXaE2iM5pOFbvOCClWA== +"@jridgewell/gen-mapping@^0.3.12", "@jridgewell/gen-mapping@^0.3.5": + version "0.3.13" + resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz#6342a19f44347518c93e43b1ac69deb3c4656a1f" + integrity sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA== + dependencies: + "@jridgewell/sourcemap-codec" "^1.5.0" + "@jridgewell/trace-mapping" "^0.3.24" + +"@jridgewell/remapping@^2.3.5": + version "2.3.5" + resolved "https://registry.yarnpkg.com/@jridgewell/remapping/-/remapping-2.3.5.tgz#375c476d1972947851ba1e15ae8f123047445aa1" + integrity sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ== dependencies: - "@jridgewell/set-array" "^1.2.1" - "@jridgewell/sourcemap-codec" "^1.4.10" + "@jridgewell/gen-mapping" "^0.3.5" "@jridgewell/trace-mapping" "^0.3.24" "@jridgewell/resolve-uri@^3.1.0": @@ -495,28 +499,23 @@ resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz#7a0ee601f60f99a20c7c7c5ff0c80388c1189bd6" integrity sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw== -"@jridgewell/set-array@^1.2.1": - version "1.2.1" - resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.2.1.tgz#558fb6472ed16a4c850b889530e6b36438c49280" - integrity sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A== - "@jridgewell/source-map@^0.3.3": - version "0.3.6" - resolved "https://registry.yarnpkg.com/@jridgewell/source-map/-/source-map-0.3.6.tgz#9d71ca886e32502eb9362c9a74a46787c36df81a" - integrity sha512-1ZJTZebgqllO79ue2bm3rIGud/bOe0pP5BjSRCRxxYkEZS8STV7zN84UBbiYu7jy+eCKSnVIUgoWWE/tt+shMQ== + version "0.3.11" + resolved "https://registry.yarnpkg.com/@jridgewell/source-map/-/source-map-0.3.11.tgz#b21835cbd36db656b857c2ad02ebd413cc13a9ba" + integrity sha512-ZMp1V8ZFcPG5dIWnQLr3NSI1MiCU7UETdS/A0G8V/XWHvJv3ZsFqutJn1Y5RPmAPX6F3BiE397OqveU/9NCuIA== dependencies: "@jridgewell/gen-mapping" "^0.3.5" "@jridgewell/trace-mapping" "^0.3.25" -"@jridgewell/sourcemap-codec@^1.4.10", "@jridgewell/sourcemap-codec@^1.4.14": - version "1.5.0" - resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz#3188bcb273a414b0d215fd22a58540b989b9409a" - integrity sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ== +"@jridgewell/sourcemap-codec@^1.4.14", "@jridgewell/sourcemap-codec@^1.5.0": + version "1.5.5" + resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz#6912b00d2c631c0d15ce1a7ab57cd657f2a8f8ba" + integrity sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og== -"@jridgewell/trace-mapping@^0.3.12", "@jridgewell/trace-mapping@^0.3.18", "@jridgewell/trace-mapping@^0.3.24", "@jridgewell/trace-mapping@^0.3.25": - version "0.3.25" - resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz#15f190e98895f3fc23276ee14bc76b675c2e50f0" - integrity sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ== +"@jridgewell/trace-mapping@^0.3.12", "@jridgewell/trace-mapping@^0.3.18", "@jridgewell/trace-mapping@^0.3.24", "@jridgewell/trace-mapping@^0.3.25", "@jridgewell/trace-mapping@^0.3.28": + version "0.3.31" + resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz#db15d6781c931f3a251a3dac39501c98a6082fd0" + integrity sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw== dependencies: "@jridgewell/resolve-uri" "^3.1.0" "@jridgewell/sourcemap-codec" "^1.4.14" @@ -572,11 +571,11 @@ "@babel/types" "^7.0.0" "@types/babel__traverse@*", "@types/babel__traverse@^7.0.6": - version "7.20.7" - resolved "https://registry.yarnpkg.com/@types/babel__traverse/-/babel__traverse-7.20.7.tgz#968cdc2366ec3da159f61166428ee40f370e56c2" - integrity sha512-dkO5fhS7+/oos4ciWxyEyjWe48zmG6wbCheo/G2ZnHx4fs3EU6YC6UM8rk56gAjNJ9P3MTH2jo5jb92/K6wbng== + version "7.28.0" + resolved "https://registry.yarnpkg.com/@types/babel__traverse/-/babel__traverse-7.28.0.tgz#07d713d6cce0d265c9849db0cbe62d3f61f36f74" + integrity sha512-8PvcXf70gTDZBgt9ptxJ8elBeBjcLOAcOtoO/mPJjtji1+CdGbHgm77om1GrsPxsiE+uXIpNSK64UYaIwQXd4Q== dependencies: - "@babel/types" "^7.20.7" + "@babel/types" "^7.28.2" "@types/eslint-scope@^3.7.7": version "3.7.7" @@ -594,7 +593,7 @@ "@types/estree" "*" "@types/json-schema" "*" -"@types/estree@*", "@types/estree@^1.0.6": +"@types/estree@*", "@types/estree@^1.0.8": version "1.0.8" resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.8.tgz#958b91c991b1867ced318bedea0e215ee050726e" integrity sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w== @@ -648,24 +647,24 @@ integrity sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA== "@types/node-fetch@^2.6.12": - version "2.6.12" - resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.6.12.tgz#8ab5c3ef8330f13100a7479e2cd56d3386830a03" - integrity sha512-8nneRWKCg3rMtF69nLQJnOYUcbafYeFSjqkw3jCRLsqkWFlHaoQrr5mXmofFGOx3DKn7UfmBMyov8ySvLRVldA== + version "2.6.13" + resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.6.13.tgz#e0c9b7b5edbdb1b50ce32c127e85e880872d56ee" + integrity sha512-QGpRVpzSaUs30JBSGPjOg4Uveu384erbHBoT1zeONvyCfwQxIkUshLAOqN/k9EjGviPRmWTTe6aH2qySWKTVSw== dependencies: "@types/node" "*" - form-data "^4.0.0" + form-data "^4.0.4" "@types/node@*": - version "24.0.4" - resolved "https://registry.yarnpkg.com/@types/node/-/node-24.0.4.tgz#dbae889912bda33a7f57669fb8587c1a56bc0c1f" - integrity sha512-ulyqAkrhnuNq9pB76DRBTkcS6YsmDALy6Ua63V8OhrOBgbcYt6IOdzpw5P1+dyRIyMerzLkeYWBeOXPpA9GMAA== + version "24.3.1" + resolved "https://registry.yarnpkg.com/@types/node/-/node-24.3.1.tgz#b0a3fb2afed0ef98e8d7f06d46ef6349047709f3" + integrity sha512-3vXmQDXy+woz+gnrTvuvNrPzekOi+Ds0ReMxw0LzBiK3a+1k0kQn9f2NWk+lgD4rJehFUmYy2gMhJ2ZI+7YP9g== dependencies: - undici-types "~7.8.0" + undici-types "~7.10.0" "@types/node@^18.19.70": - version "18.19.112" - resolved "https://registry.yarnpkg.com/@types/node/-/node-18.19.112.tgz#cd2aee9c075402e0e1942a44101428881dbeb110" - integrity sha512-i+Vukt9POdS/MBI7YrrkkI5fMfwFtOjphSmt4WXYLfwqsfr6z/HdCx7LqT9M7JktGob8WNgj8nFB4TbGNE4Cog== + version "18.19.124" + resolved "https://registry.yarnpkg.com/@types/node/-/node-18.19.124.tgz#6f49e4fab8274910691a900e8a14316cbf3c7a31" + integrity sha512-hY4YWZFLs3ku6D2Gqo3RchTd9VRCcrjqp/I0mmohYeUVA5Y8eCXKJEasHxLAJVZRJuQogfd1GiJ9lgogBgKeuQ== dependencies: undici-types "~5.26.4" @@ -859,6 +858,11 @@ acorn-globals@^7.0.0: acorn "^8.1.0" acorn-walk "^8.0.2" +acorn-import-phases@^1.0.3: + version "1.0.4" + resolved "https://registry.yarnpkg.com/acorn-import-phases/-/acorn-import-phases-1.0.4.tgz#16eb850ba99a056cb7cbfe872ffb8972e18c8bd7" + integrity sha512-wKmbr/DDiIXzEOiWrTTUcDm24kQ2vGfZQvM2fwg2vXqR5uW6aapr7ObPtj1th32b9u90/Pf4AItvdTh42fBmVQ== + acorn-walk@^8.0.2: version "8.3.4" resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.3.4.tgz#794dd169c3977edf4ba4ea47583587c5866236b7" @@ -866,7 +870,7 @@ acorn-walk@^8.0.2: dependencies: acorn "^8.11.0" -acorn@^8.1.0, acorn@^8.11.0, acorn@^8.14.0, acorn@^8.8.1: +acorn@^8.1.0, acorn@^8.11.0, acorn@^8.15.0, acorn@^8.8.1: version "8.15.0" resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.15.0.tgz#a360898bc415edaac46c8241f6383975b930b816" integrity sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg== @@ -941,11 +945,6 @@ argparse@^1.0.7: dependencies: sprintf-js "~1.0.2" -async@^3.2.3: - version "3.2.6" - resolved "https://registry.yarnpkg.com/async/-/async-3.2.6.tgz#1b0728e14929d51b85b449b7f06e27c1145e38ce" - integrity sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA== - asynckit@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" @@ -986,9 +985,9 @@ babel-plugin-jest-hoist@^29.6.3: "@types/babel__traverse" "^7.0.6" babel-preset-current-node-syntax@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.1.0.tgz#9a929eafece419612ef4ae4f60b1862ebad8ef30" - integrity sha512-ldYss8SbBlWva1bs28q78Ju5Zq1F+8BrqBZZ0VFhLBvhh6lCpC2o3gDJi/5DRLs9FgYZCnmPYIVFU4lRXCkyUw== + version "1.2.0" + resolved "https://registry.yarnpkg.com/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.2.0.tgz#20730d6cdc7dda5d89401cab10ac6a32067acde6" + integrity sha512-E/VlAEzRrsLEb2+dv8yp3bo4scof3l9nR4lrld+Iy5NyVqgVYUJnDAmunkhPMisRI32Qc4iRiz425d8vM++2fg== dependencies: "@babel/plugin-syntax-async-generators" "^7.8.4" "@babel/plugin-syntax-bigint" "^7.8.3" @@ -1032,13 +1031,6 @@ brace-expansion@^1.1.7: balanced-match "^1.0.0" concat-map "0.0.1" -brace-expansion@^2.0.1: - version "2.0.2" - resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-2.0.2.tgz#54fc53237a613d854c7bd37463aad17df87214e7" - integrity sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ== - dependencies: - balanced-match "^1.0.0" - braces@^3.0.3: version "3.0.3" resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.3.tgz#490332f40919452272d55a8480adc0c441358789" @@ -1047,12 +1039,12 @@ braces@^3.0.3: fill-range "^7.1.1" browserslist@^4.24.0: - version "4.25.1" - resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.25.1.tgz#ba9e8e6f298a1d86f829c9b975e07948967bb111" - integrity sha512-KGj0KoOMXLpSNkkEI6Z6mShmQy0bc1I+T7K9N81k4WWMrfz+6fQ6es80B/YLAeRoKvjYE1YSHHOW1qe9xIVzHw== + version "4.25.4" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.25.4.tgz#ebdd0e1d1cf3911834bab3a6cd7b917d9babf5af" + integrity sha512-4jYpcjabC606xJ3kw2QwGEZKX0Aw7sgQdZCvIK9dhVSPh76BKo+C+btT1RRofH7B+8iNpEbgGNVWiLki5q93yg== dependencies: - caniuse-lite "^1.0.30001726" - electron-to-chromium "^1.5.173" + caniuse-lite "^1.0.30001737" + electron-to-chromium "^1.5.211" node-releases "^2.0.19" update-browserslist-db "^1.1.3" @@ -1114,12 +1106,12 @@ camelcase@^6.2.0: resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz#5685b95eb209ac9c0c177467778c9c84df58ba9a" integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== -caniuse-lite@^1.0.30001726: - version "1.0.30001726" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001726.tgz#a15bd87d5a4bf01f6b6f70ae7c97fdfd28b5ae47" - integrity sha512-VQAUIUzBiZ/UnlM28fSp2CRF3ivUn1BWEvxMcVTNwpw91Py1pGbPIyIKtd+tzct9C3ouceCVdGAXxZOpZAsgdw== +caniuse-lite@^1.0.30001737: + version "1.0.30001741" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001741.tgz#67fb92953edc536442f3c9da74320774aa523143" + integrity sha512-QGUGitqsc8ARjLdgAfxETDhRbJ0REsP6O3I96TAth/mVjh2cYzN2u+3AzPP3aVSm2FehEItaJw1xd+IGBXWeSw== -chalk@^4.0.0, chalk@^4.0.2, chalk@^4.1.0: +chalk@^4.0.0, chalk@^4.1.0: version "4.1.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== @@ -1256,14 +1248,14 @@ debug@4, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1: ms "^2.1.3" decimal.js@^10.4.2: - version "10.5.0" - resolved "https://registry.yarnpkg.com/decimal.js/-/decimal.js-10.5.0.tgz#0f371c7cf6c4898ce0afb09836db73cd82010f22" - integrity sha512-8vDa8Qxvr/+d94hSh5P3IJwI5t8/c0KsMp+g8bNw9cY2icONa5aPfvKeieW1WlG0WQYwwhJ7mjui2xtiePQSXw== + version "10.6.0" + resolved "https://registry.yarnpkg.com/decimal.js/-/decimal.js-10.6.0.tgz#e649a43e3ab953a72192ff5983865e509f37ed9a" + integrity sha512-YpgQiITW3JXGntzdUmyUR1V812Hn8T1YVXhCu+wO3OpS4eU9l4YdD3qjyiKdV6mvV29zapkMeD390UVEf2lkUg== dedent@^1.0.0: - version "1.6.0" - resolved "https://registry.yarnpkg.com/dedent/-/dedent-1.6.0.tgz#79d52d6389b1ffa67d2bcef59ba51847a9d503b2" - integrity sha512-F1Z+5UCFpmQUzJa11agbyPVMbpgT/qA3/SKyJ1jyBgm7dUcUEa8v9JwDkerSQXfakBwFljIxhOJqGkjUwZ9FSA== + version "1.7.0" + resolved "https://registry.yarnpkg.com/dedent/-/dedent-1.7.0.tgz#c1f9445335f0175a96587be245a282ff451446ca" + integrity sha512-HGFtf8yhuhGhqO07SV79tRp+br4MnbdjeVxotpn1QBl30pcLLCQjX5b2295ll0fv8RKDKsmWYrl05usHM9CewQ== deepmerge@^4.2.2: version "4.3.1" @@ -1301,17 +1293,10 @@ dunder-proto@^1.0.1: es-errors "^1.3.0" gopd "^1.2.0" -ejs@^3.1.10: - version "3.1.10" - resolved "https://registry.yarnpkg.com/ejs/-/ejs-3.1.10.tgz#69ab8358b14e896f80cc39e62087b88500c3ac3b" - integrity sha512-UeJmFfOrAQS8OJWPZ4qtgHyWExa088/MtK5UEyoJGFH67cDEXkZSviOiKRCZ4Xij0zxI3JECgYs3oKx+AizQBA== - dependencies: - jake "^10.8.5" - -electron-to-chromium@^1.5.173: - version "1.5.173" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.173.tgz#1aeba57204fe19425921a29946ef543653f5e896" - integrity sha512-2bFhXP2zqSfQHugjqJIDFVwa+qIxyNApenmXTp9EjaKtdPrES5Qcn9/aSFy/NaP2E+fWG/zxKu/LBvY36p5VNQ== +electron-to-chromium@^1.5.211: + version "1.5.217" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.217.tgz#71285850356ef48bc08275b26f0f355721e0f17d" + integrity sha512-Pludfu5iBxp9XzNl0qq2G87hdD17ZV7h5T4n6rQXDi3nCyloBV3jreE9+8GC6g4X/5yxqVgXEURpcLtM0WS4jA== emittery@^0.13.1: version "0.13.1" @@ -1323,10 +1308,10 @@ emoji-regex@^8.0.0: resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== -enhanced-resolve@^5.0.0, enhanced-resolve@^5.17.1: - version "5.18.2" - resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-5.18.2.tgz#7903c5b32ffd4b2143eeb4b92472bd68effd5464" - integrity sha512-6Jw4sE1maoRJo3q8MsSIn2onJFbLTOjY9hlx4DZXmOKvLRd1Ok2kXmAGXaafL2+ijsJZ1ClYbl/pmqr9+k4iUQ== +enhanced-resolve@^5.0.0, enhanced-resolve@^5.17.3: + version "5.18.3" + resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-5.18.3.tgz#9b5f4c5c076b8787c78fe540392ce76a88855b44" + integrity sha512-d4lC8xfavMeBjzGr2vECC3fsGXziXZQyJxD868h2M/mBI3PwAuODxAkLkq5HYuvrPYcUtiLzsTo8U3PgX3Ocww== dependencies: graceful-fs "^4.2.4" tapable "^2.2.0" @@ -1483,9 +1468,9 @@ fast-json-stable-stringify@2.x, fast-json-stable-stringify@^2.1.0: integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== fast-uri@^3.0.1: - version "3.0.6" - resolved "https://registry.yarnpkg.com/fast-uri/-/fast-uri-3.0.6.tgz#88f130b77cfaea2378d56bf970dea21257a68748" - integrity sha512-Atfo14OibSv5wAp4VWNsFYE1AchQRTv9cBGWET4pZWHzYshFSS9NQI6I57rdKn9croWVMbYFbLhJ+yJvmZIIHw== + version "3.1.0" + resolved "https://registry.yarnpkg.com/fast-uri/-/fast-uri-3.1.0.tgz#66eecff6c764c0df9b762e62ca7edcfb53b4edfa" + integrity sha512-iPeeDKJSWf4IEOasVVrknXpaBV0IApz/gp7S2bb7Z4Lljbl2MGJRqInZiUrQwV16cpzw/D3S5j5Julj/gT52AA== fb-watchman@^2.0.0: version "2.0.2" @@ -1494,13 +1479,6 @@ fb-watchman@^2.0.0: dependencies: bser "2.1.1" -filelist@^1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/filelist/-/filelist-1.0.4.tgz#f78978a1e944775ff9e62e744424f215e58352b5" - integrity sha512-w1cEuf3S+DrLCQL7ET6kz+gmlJdbq9J7yXCSjK/OZCPA+qEN1WyF4ZAf0YYJa4/shHJra2t/d/r8SV4Ji+x+8Q== - dependencies: - minimatch "^5.0.1" - fill-range@^7.1.1: version "7.1.1" resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.1.1.tgz#44265d3cac07e3ea7dc247516380643754a05292" @@ -1516,7 +1494,7 @@ find-up@^4.0.0, find-up@^4.1.0: locate-path "^5.0.0" path-exists "^4.0.0" -form-data@^4.0.0: +form-data@^4.0.0, form-data@^4.0.4: version "4.0.4" resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.4.tgz#784cdcce0669a9d68e94d11ac4eea98088edd2c4" integrity sha512-KrGhL9Q4zjj0kiUt5OO4Mr/A/jlI2jDYs5eHBpYHPcBEVSiipAvn2Ko2HnPe20rmcuuvMHNdZFp+4IlGTMF0Ow== @@ -1608,11 +1586,6 @@ glob@^7.1.3, glob@^7.1.4: once "^1.3.0" path-is-absolute "^1.0.0" -globals@^11.1.0: - version "11.12.0" - resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e" - integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA== - gopd@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/gopd/-/gopd-1.2.0.tgz#89f56b8217bdbc8802bd299df6d7f1081d7e51a1" @@ -1623,6 +1596,18 @@ graceful-fs@^4.1.2, graceful-fs@^4.2.11, graceful-fs@^4.2.4, graceful-fs@^4.2.9: resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3" integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ== +handlebars@^4.7.8: + version "4.7.8" + resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.7.8.tgz#41c42c18b1be2365439188c77c6afae71c0cd9e9" + integrity sha512-vafaFqs8MZkRrSX7sFVUdo3ap/eNiLnb4IakshzvP56X5Nr1iGKAIqdX6tMlm6HcNRIkr6AxO5jFEoJzzpT8aQ== + dependencies: + minimist "^1.2.5" + neo-async "^2.6.2" + source-map "^0.6.1" + wordwrap "^1.0.0" + optionalDependencies: + uglify-js "^3.1.4" + has-flag@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" @@ -1807,23 +1792,13 @@ istanbul-lib-source-maps@^4.0.0: source-map "^0.6.1" istanbul-reports@^3.1.3: - version "3.1.7" - resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-3.1.7.tgz#daed12b9e1dca518e15c056e1e537e741280fa0b" - integrity sha512-BewmUXImeuRk2YY0PVbxgKAysvhRPUQE0h5QRM++nVWyubKGV0l8qQ5op8+B2DOmwSe63Jivj0BjkPQVf8fP5g== + version "3.2.0" + resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-3.2.0.tgz#cb4535162b5784aa623cee21a7252cf2c807ac93" + integrity sha512-HGYWWS/ehqTV3xN10i23tkPkpH46MLCIMFNCaaKNavAXTF1RkqxawEPtnjnGZ6XKSInBKkiOA5BKS+aZiY3AvA== dependencies: html-escaper "^2.0.0" istanbul-lib-report "^3.0.0" -jake@^10.8.5: - version "10.9.2" - resolved "https://registry.yarnpkg.com/jake/-/jake-10.9.2.tgz#6ae487e6a69afec3a5e167628996b59f35ae2b7f" - integrity sha512-2P4SQ0HrLQ+fw6llpLnOaGAvN2Zu6778SJMrCUwns4fOoG9ayrTiZk3VV8sCPkVZF8ab0zksVpS8FDY5pRCNBA== - dependencies: - async "^3.2.3" - chalk "^4.0.2" - filelist "^1.0.4" - minimatch "^3.1.2" - jest-changed-files@^29.7.0: version "29.7.0" resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-29.7.0.tgz#1c06d07e77c78e1585d020424dedc10d6e17ac3a" @@ -2368,19 +2343,17 @@ mimic-fn@^2.1.0: resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== -minimatch@^3.0.4, minimatch@^3.1.1, minimatch@^3.1.2: +minimatch@^3.0.4, minimatch@^3.1.1: version "3.1.2" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== dependencies: brace-expansion "^1.1.7" -minimatch@^5.0.1: - version "5.1.6" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-5.1.6.tgz#1cfcb8cf5522ea69952cd2af95ae09477f122a96" - integrity sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g== - dependencies: - brace-expansion "^2.0.1" +minimist@^1.2.5: + version "1.2.8" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c" + integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA== ms@^2.1.3: version "2.1.3" @@ -2410,9 +2383,9 @@ node-int64@^0.4.0: integrity sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw== node-releases@^2.0.19: - version "2.0.19" - resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.19.tgz#9e445a52950951ec4d177d843af370b411caf314" - integrity sha512-xxOWJsBKtzAq7DY0J+DTzuz58K8e7sJbdgwkbMWQe8UYB6ekmsQ45q0M/tJDsGaZmbC+l7n57UV8Hl5tHxO9uw== + version "2.0.20" + resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.20.tgz#e26bb79dbdd1e64a146df389c699014c611cbc27" + integrity sha512-7gK6zSXEH6neM212JgfYFXe+GmZQM+fia5SsusuBIUgnPheLFBmIPhtFoAQRj8/7wASYQnbDlHPVwY0BefoFgA== normalize-path@^3.0.0: version "3.0.0" @@ -2427,9 +2400,9 @@ npm-run-path@^4.0.1: path-key "^3.0.0" nwsapi@^2.2.2: - version "2.2.20" - resolved "https://registry.yarnpkg.com/nwsapi/-/nwsapi-2.2.20.tgz#22e53253c61e7b0e7e93cef42c891154bcca11ef" - integrity sha512-/ieB+mDe4MrrKMT8z+mQL8klXydZWGR5Dowt4RAGKbJ3kIGEx3X4ljUo+6V73IXtUPWgfOlU5B9MlGxFO5T+cA== + version "2.2.22" + resolved "https://registry.yarnpkg.com/nwsapi/-/nwsapi-2.2.22.tgz#109f9530cda6c156d6a713cdf5939e9f0de98b9d" + integrity sha512-ujSMe1OWVn55euT1ihwCI1ZcAaAU3nxUiDwfDQldc51ZXaB9m2AyOn6/jh1BLe2t/G8xd6uKG1UBF2aZJeg2SQ== object-inspect@^1.13.3: version "1.13.4" @@ -2536,9 +2509,9 @@ pkg-dir@^4.2.0: find-up "^4.0.0" prettier@^3.4.2: - version "3.6.1" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.6.1.tgz#cc3bce21c09a477b1e987b76ce9663925d86ae44" - integrity sha512-5xGWRa90Sp2+x1dQtNpIpeOQpTDBs9cZDmA/qs2vDNN2i18PdapqY7CmBeyLlMuGqXJRIOPaCaVZTLNQRWUH/A== + version "3.6.2" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.6.2.tgz#ccda02a1003ebbb2bfda6f83a074978f608b9393" + integrity sha512-I7AIg5boAr5R0FFtJ6rCfD+LFsWHp81dolrFD8S79U9tb8Az2nGrJncnMSnys+bpQJfRUzqs9hnA81OAA3hCuQ== pretty-format@^29.0.0, pretty-format@^29.7.0: version "29.7.0" @@ -2788,9 +2761,9 @@ source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.1: integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== source-map@^0.7.4: - version "0.7.4" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.7.4.tgz#a9bbe705c9d8846f4e08ff6765acf0f1b0898656" - integrity sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA== + version "0.7.6" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.7.6.tgz#a3658ab87e5b6429c8a1f3ba0083d4c61ca3ef02" + integrity sha512-i5uvt8C3ikiWeNZSVZNWcfZPItFQOsYTUAOkcUPGd8DqDy1uOUikjt5dG+uRlwyvR108Fb9DOd4GvXfT0N2/uQ== sprintf-js@~1.0.2: version "1.0.3" @@ -2875,9 +2848,9 @@ symbol-tree@^3.2.4: integrity sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw== tapable@^2.1.1, tapable@^2.2.0: - version "2.2.2" - resolved "https://registry.yarnpkg.com/tapable/-/tapable-2.2.2.tgz#ab4984340d30cb9989a490032f086dbb8b56d872" - integrity sha512-Re10+NauLTMCudc7T5WLFLAwDhQ0JWdrMK+9B2M8zR5hRExKmsRDCBA7/aV/pNJFltmBFO5BAMlQFi/vq3nKOg== + version "2.2.3" + resolved "https://registry.yarnpkg.com/tapable/-/tapable-2.2.3.tgz#4b67b635b2d97578a06a2713d2f04800c237e99b" + integrity sha512-ZL6DDuAlRlLGghwcfmSn9sK3Hr6ArtyudlSAiCqQ6IfE+b+HHbydbYDIG15IfS5do+7XQQBdBiubF/cV2dnDzg== terser-webpack-plugin@^5.3.11: version "5.3.14" @@ -2891,12 +2864,12 @@ terser-webpack-plugin@^5.3.11: terser "^5.31.1" terser@^5.31.1: - version "5.43.1" - resolved "https://registry.yarnpkg.com/terser/-/terser-5.43.1.tgz#88387f4f9794ff1a29e7ad61fb2932e25b4fdb6d" - integrity sha512-+6erLbBm0+LROX2sPXlUYx/ux5PyE9K/a92Wrt6oA+WDAoFTdpHE5tCYCI5PNzq2y8df4rA+QgHLJuR4jNymsg== + version "5.44.0" + resolved "https://registry.yarnpkg.com/terser/-/terser-5.44.0.tgz#ebefb8e5b8579d93111bfdfc39d2cf63879f4a82" + integrity sha512-nIVck8DK+GM/0Frwd+nIhZ84pR/BX7rmXMfYwyg+Sri5oGVE99/E3KvXqpC2xHFxyqXyGHTKBSioxxplrO4I4w== dependencies: "@jridgewell/source-map" "^0.3.3" - acorn "^8.14.0" + acorn "^8.15.0" commander "^2.20.0" source-map-support "~0.5.20" @@ -2944,13 +2917,13 @@ tr46@~0.0.3: integrity sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw== ts-jest@^29.1.1: - version "29.4.0" - resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-29.4.0.tgz#bef0ee98d94c83670af7462a1617bf2367a83740" - integrity sha512-d423TJMnJGu80/eSgfQ5w/R+0zFJvdtTxwtF9KzFFunOpSeD+79lHJQIiAhluJoyGRbvj9NZJsl9WjCUo0ND7Q== + version "29.4.1" + resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-29.4.1.tgz#42d33beb74657751d315efb9a871fe99e3b9b519" + integrity sha512-SaeUtjfpg9Uqu8IbeDKtdaS0g8lS6FT6OzM3ezrDfErPJPHNDo/Ey+VFGP1bQIDfagYDLyRpd7O15XpG1Es2Uw== dependencies: bs-logger "^0.2.6" - ejs "^3.1.10" fast-json-stable-stringify "^2.1.0" + handlebars "^4.7.8" json5 "^2.2.3" lodash.memoize "^4.1.2" make-error "^1.3.6" @@ -2959,9 +2932,9 @@ ts-jest@^29.1.1: yargs-parser "^21.1.1" ts-loader@^9.5.1: - version "9.5.2" - resolved "https://registry.yarnpkg.com/ts-loader/-/ts-loader-9.5.2.tgz#1f3d7f4bb709b487aaa260e8f19b301635d08020" - integrity sha512-Qo4piXvOTWcMGIgRiuFa6nHNm+54HbYaZCKqc9eeZCLRy3XqafQgwX2F7mofrbJG3g7EEb+lkiR+z2Lic2s3Zw== + version "9.5.4" + resolved "https://registry.yarnpkg.com/ts-loader/-/ts-loader-9.5.4.tgz#44b571165c10fb5a90744aa5b7e119233c4f4585" + integrity sha512-nCz0rEwunlTZiy6rXFByQU1kVVpCIgUpc/psFiKVrUwrizdnIbRFu8w7bxhUF0X613DYwT4XzrZHpVyMe758hQ== dependencies: chalk "^4.1.0" enhanced-resolve "^5.0.0" @@ -2989,15 +2962,20 @@ typescript@~5.7.2: resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.7.3.tgz#919b44a7dbb8583a9b856d162be24a54bf80073e" integrity sha512-84MVSjMEHP+FQRPy3pX9sTVV/INIex71s9TL2Gm5FG/WG1SqXeKyZ0k7/blY/4FdOzI12CBy1vGc4og/eus0fw== +uglify-js@^3.1.4: + version "3.19.3" + resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.19.3.tgz#82315e9bbc6f2b25888858acd1fff8441035b77f" + integrity sha512-v3Xu+yuwBXisp6QYTcH4UbH+xYJXqnq2m/LtQVWKWzYc1iehYnLixoQDN9FH6/j9/oybfd6W9Ghwkl8+UMKTKQ== + undici-types@~5.26.4: version "5.26.5" resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617" integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA== -undici-types@~7.8.0: - version "7.8.0" - resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-7.8.0.tgz#de00b85b710c54122e44fbfd911f8d70174cd294" - integrity sha512-9UJ2xGDvQ43tYyVMpuHlsgApydB8ZKfVYTsLDhXkFL/6gfkp+U8xTGdh8pMJv1SpZna0zxG1DwsKZsreLbXBxw== +undici-types@~7.10.0: + version "7.10.0" + resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-7.10.0.tgz#4ac2e058ce56b462b056e629cc6a02393d3ff350" + integrity sha512-t5Fy/nfn+14LuOc2KNYg75vZqClpAiqscVvMygNnlsHBFpSXdJaYtXMcdNLpl/Qvc3P2cB3s6lOV51nqsFq4ag== universalify@^0.2.0: version "0.2.0" @@ -3066,26 +3044,27 @@ webidl-conversions@^7.0.0: resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-7.0.0.tgz#256b4e1882be7debbf01d05f0aa2039778ea080a" integrity sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g== -webpack-sources@^3.2.3: +webpack-sources@^3.3.3: version "3.3.3" resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-3.3.3.tgz#d4bf7f9909675d7a070ff14d0ef2a4f3c982c723" integrity sha512-yd1RBzSGanHkitROoPFd6qsrxt+oFhg/129YzheDGqeustzX0vTZJZsSsQjVQC4yzBQ56K55XU8gaNCtIzOnTg== webpack@^5.97.1: - version "5.99.9" - resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.99.9.tgz#d7de799ec17d0cce3c83b70744b4aedb537d8247" - integrity sha512-brOPwM3JnmOa+7kd3NsmOUOwbDAj8FT9xDsG3IW0MgbN9yZV7Oi/s/+MNQ/EcSMqw7qfoRyXPoeEWT8zLVdVGg== + version "5.101.3" + resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.101.3.tgz#3633b2375bb29ea4b06ffb1902734d977bc44346" + integrity sha512-7b0dTKR3Ed//AD/6kkx/o7duS8H3f1a4w3BYpIriX4BzIhjkn4teo05cptsxvLesHFKK5KObnadmCHBwGc+51A== dependencies: "@types/eslint-scope" "^3.7.7" - "@types/estree" "^1.0.6" + "@types/estree" "^1.0.8" "@types/json-schema" "^7.0.15" "@webassemblyjs/ast" "^1.14.1" "@webassemblyjs/wasm-edit" "^1.14.1" "@webassemblyjs/wasm-parser" "^1.14.1" - acorn "^8.14.0" + acorn "^8.15.0" + acorn-import-phases "^1.0.3" browserslist "^4.24.0" chrome-trace-event "^1.0.2" - enhanced-resolve "^5.17.1" + enhanced-resolve "^5.17.3" es-module-lexer "^1.2.1" eslint-scope "5.1.1" events "^3.2.0" @@ -3099,7 +3078,7 @@ webpack@^5.97.1: tapable "^2.1.1" terser-webpack-plugin "^5.3.11" watchpack "^2.4.1" - webpack-sources "^3.2.3" + webpack-sources "^3.3.3" whatwg-encoding@^2.0.0: version "2.0.0" @@ -3136,6 +3115,11 @@ which@^2.0.1: dependencies: isexe "^2.0.0" +wordwrap@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" + integrity sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q== + wrap-ansi@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" @@ -3159,9 +3143,9 @@ write-file-atomic@^4.0.2: signal-exit "^3.0.7" ws@^8.11.0: - version "8.18.2" - resolved "https://registry.yarnpkg.com/ws/-/ws-8.18.2.tgz#42738b2be57ced85f46154320aabb51ab003705a" - integrity sha512-DMricUmwGZUVr++AEAe2uiVM7UoO9MAVZMDu05UQOaUII0lp+zOzLLU4Xqh/JvTqklB1T4uELaaPBKyjE1r4fQ== + version "8.18.3" + resolved "https://registry.yarnpkg.com/ws/-/ws-8.18.3.tgz#b56b88abffde62791c639170400c93dcb0c95472" + integrity sha512-PEIGCY5tSlUt50cqyMXfCzX+oOPqN0vuGqWzbcJ2xvnkzkq46oOpz7dQaTDBdfICb4N14+GARUDw2XV2N4tvzg== xml-name-validator@^4.0.0: version "4.0.0"