### Installation Source: https://github.com/intercom/intercom-php/blob/master/_autodocs/README.md Install the Intercom PHP SDK using Composer. ```APIDOC ## Installation ### Description Install the Intercom PHP SDK using Composer. ### Method `composer require intercom/intercom-php` ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ``` -------------------------------- ### Install Intercom PHP Library Source: https://github.com/intercom/intercom-php/blob/master/README.md Use Composer to install the Intercom PHP library. This is the first step to integrating Intercom's API into your PHP application. ```sh composer require intercom/intercom-php ``` -------------------------------- ### GET /help_center/help_centers Source: https://github.com/intercom/intercom-php/blob/master/reference.md List all Help Centers. ```APIDOC ## GET /help_center/help_centers ### Description You can list all Help Centers by making a GET request to this endpoint. ### Method GET ### Endpoint https://api.intercom.io/help_center/help_centers ### Parameters #### Query Parameters - **page** (int) - Optional - The page of results to fetch. Defaults to first page. - **perPage** (int) - Optional - How many results to display per page. Defaults to 15. ``` -------------------------------- ### Event Metadata Examples Source: https://github.com/intercom/intercom-php/blob/master/reference.md Examples of supported JSON metadata types for event tracking. Note that nested JSON structures are not supported. ```json "source":"desktop" ``` ```json "load": 3.67 ``` ```json "contact_date": 1392036272 ``` ```json "article": "https://example.org/ab1de.html" ``` ```json "article": {"url": "https://example.org/ab1de.html", "value":"the dude abides"} ``` ```json "price": {"amount": 34999, "currency": "eur"} ``` -------------------------------- ### GET /macros/list Source: https://github.com/intercom/intercom-php/blob/master/reference.md Lists all macros in the workspace. ```APIDOC ## GET /macros/list ### Description Fetch a list of all macros (saved replies) in the workspace, returned in descending order by updated_at. ### Parameters #### Request Body - **perPage** (int) - Optional - The number of results per page - **startingAfter** (string) - Optional - Base64-encoded cursor for pagination - **updatedSince** (int) - Optional - Unix timestamp to filter macros ``` -------------------------------- ### GET /tags Source: https://github.com/intercom/intercom-php/blob/master/reference.md Fetches a list of all tags for a given workspace. ```APIDOC ## GET /tags ### Description Fetches a list of all tags for a given workspace. ### Method GET ### Endpoint /tags ### Response #### Success Response (200) - **tags** (array) - A list of tag objects. #### Response Example { "tags": [ { "id": "7522907", "name": "example-tag-1" }, { "id": "7522908", "name": "example-tag-2" } ] } ``` -------------------------------- ### GET /workflows/export Source: https://github.com/intercom/intercom-php/blob/master/reference.md Exports a workflow configuration. ```APIDOC ## GET /workflows/export ### Description Export a workflow configuration by its ID, including steps, targeting rules, and attributes. This is an unstable API. ### Parameters #### Request Body - **id** (string) - Required - The unique identifier for the workflow. ``` -------------------------------- ### Create an In-App Message (Specific) Source: https://github.com/intercom/intercom-php/blob/master/_autodocs/08-messages-api.md This example demonstrates creating an in-app message with specific content for a contact. ```php $request = new CreateMessageRequest([ 'from' => ['type' => 'admin', 'id' => 5], 'to' => ['type' => 'contact', 'id' => 'contact_123'], 'body' => 'Welcome to our app!', 'messageType' => 'inapp', ]); ``` -------------------------------- ### GET /emails Source: https://github.com/intercom/intercom-php/blob/master/reference.md Lists all sender email address settings for the workspace. ```APIDOC ## GET /emails ### Description Lists all sender email address settings for the workspace. ### Method GET ### Endpoint /emails ``` -------------------------------- ### Install Intercom PHP SDK via Composer Source: https://github.com/intercom/intercom-php/blob/master/_autodocs/01-getting-started.md Use Composer to add the Intercom PHP SDK to your project dependencies. ```bash composer require intercom/intercom-php ``` -------------------------------- ### GET /ai_content/import_sources Source: https://github.com/intercom/intercom-php/blob/master/reference.md Retrieve a list of all content import sources for a workspace. ```APIDOC ## GET /ai_content/import_sources ### Description You can retrieve a list of all content import sources for a workspace. ``` -------------------------------- ### GET /help_center/help_center/ Source: https://github.com/intercom/intercom-php/blob/master/reference.md Fetches the details of a specific Help Center by its ID. ```APIDOC ## GET /help_center/help_center/ ### Description Fetches the details of a single Help Center by its ID. ### Method GET ### Endpoint https://api.intercom.io/help_center/help_center/ ### Parameters #### Path Parameters - **id** (string) - Required - The ID of the Help Center. ### Response #### Success Response (200) - **HelpCenter** (object) - Details of the Help Center. #### Response Example ```json { "type": "HelpCenter", "id": "123", "name": "Example Help Center", "url": "https://example.intercom.com" } ``` ``` -------------------------------- ### SDK Initialization Source: https://github.com/intercom/intercom-php/blob/master/_autodocs/14-quick-reference.md Demonstrates how to initialize the IntercomClient with or without explicit API tokens and options. ```APIDOC ## SDK Initialization ### Description Initializes the Intercom PHP SDK client. Can be done using an environment variable for the API token, or by providing the token and optional configuration settings like timeout and retry attempts. ### Usage ```php use Intercom\IntercomClient; // From environment variable $client = new IntercomClient(); // With explicit token $client = new IntercomClient(token: 'your_api_token'); // With options $client = new IntercomClient( token: 'your_api_token', options: [ 'timeout' => 60.0, 'maxRetries' => 3, ] ); ``` ``` -------------------------------- ### Configuration Source: https://github.com/intercom/intercom-php/blob/master/_autodocs/README.md Details on constructor options, environment variables, and tuning the SDK client. ```APIDOC ## Configuration ### Description Details on constructor options, environment variables, and tuning the SDK client. ### Method Refer to [Configuration](11-configuration.md) for detailed information. ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ``` -------------------------------- ### JSON Number Data Type Example Source: https://github.com/intercom/intercom-php/blob/master/reference.md Example of a Number data type for event metadata. ```json "load": 3.67 ``` -------------------------------- ### JSON String Data Type Example Source: https://github.com/intercom/intercom-php/blob/master/reference.md Example of a String data type for event metadata. ```json "source":"desktop" ``` -------------------------------- ### Create and Tag a Contact Source: https://github.com/intercom/intercom-php/blob/master/_autodocs/00-index.md This example demonstrates how to create a new contact and subsequently tag them. It requires the contact ID obtained after creation. ```php $contact = $client->contacts->create( new CreateContactRequestWithEmail([ 'email' => 'newuser@example.com', 'name' => 'New User', ]) ); $client->tags->tagContact( new TagContactRequest([ 'contactId' => $contact->getContact()->getId(), 'tagName' => 'trial_user', ]) ); ``` -------------------------------- ### JSON Link Data Type Example Source: https://github.com/intercom/intercom-php/blob/master/reference.md Example of a Link data type for event metadata, where the value is a HTTP or HTTPS URI. ```json "article": "https://example.org/ab1de.html" ``` -------------------------------- ### Setting INTERCOM_API_KEY Environment Variable Source: https://github.com/intercom/intercom-php/blob/master/_autodocs/11-configuration.md Example of setting the INTERCOM_API_KEY environment variable in bash. ```bash export INTERCOM_API_KEY=your_api_token_here ``` -------------------------------- ### Tagging Customer Journey Example Source: https://github.com/intercom/intercom-php/blob/master/_autodocs/09-tags-api.md Demonstrates tagging a contact as a trial user, then upgrading to premium, and finally removing the trial tag. ```php $client = new IntercomClient(token: 'api_key'); // Tag a contact as a trial user $request = new TagContactRequest([ 'contactId' => 'contact_123', 'tagName' => 'trial_user', ]); $client->tags->tagContact($request); // Later, upgrade to premium $request = new TagContactRequest([ 'contactId' => 'contact_123', 'tagName' => 'premium_customer', ]); $client->tags->tagContact($request); // Remove trial tag $request = new UntagContactRequest([ 'contactId' => 'contact_123', 'tagName' => 'trial_user', ]); $client->tags->untagContact($request); ``` -------------------------------- ### GET /help_center/collections Source: https://github.com/intercom/intercom-php/blob/master/reference.md Fetch a list of all Help Center collections, returned in descending order by updated_at. ```APIDOC ## GET /help_center/collections ### Description Fetch a list of all collections. Results are returned in descending order based on the updated_at attribute. ### Method GET ### Endpoint https://api.intercom.io/help_center/collections ### Parameters #### Query Parameters - **page** (int) - Optional - The page of results to fetch. Defaults to first page. - **perPage** (int) - Optional - How many results to display per page. Defaults to 15. ``` -------------------------------- ### JSON Rich Link Data Type Example Source: https://github.com/intercom/intercom-php/blob/master/reference.md Example of a Rich Link data type for event metadata, containing 'url' and 'value' keys. ```json "article": {"url": "https://example.org/ab1de.html", "value":"the dude abides"} ``` -------------------------------- ### create() Source: https://github.com/intercom/intercom-php/blob/master/_autodocs/06-articles-api.md Creates a new article in the help center. ```APIDOC ## create() ### Description Create a new article in the help center. ### Method `create` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **title** (string) - Required - Article title - **body** (string) - Required - Article content - **state** (string) - Required - State: draft or published - **parentId** (?int) - Optional - Parent collection ID ### Request Example ```php $request = new CreateArticleRequest([ 'title' => 'Getting Started Guide', 'body' => '

This is the article content...

', 'state' => 'published', 'parentId' => 123, ]); $article = $client->articles->create($request); echo "Created article ID: " . $article->getId(); ``` ### Response #### Success Response (200) `Article` - Created article object. #### Response Example None provided in source. ### Throws - `IntercomException` - On client error - `IntercomApiException` - On API error ``` -------------------------------- ### Basic Usage of IntercomClient to Find an Admin Source: https://github.com/intercom/intercom-php/blob/master/_autodocs/01-getting-started.md Demonstrates how to create an IntercomClient and use a resource client (admins) to find a specific admin by ID. ```php use Intercom\IntercomClient; use Intercom\Admins\Requests\FindAdminRequest; $client = new IntercomClient(token: 'YOUR_API_KEY'); // Access a specific resource client $admin = $client->admins->find( new FindAdminRequest(['adminId' => '123']) ); echo $admin->getName(); ``` -------------------------------- ### Article Object Initialization and Access Source: https://github.com/intercom/intercom-php/blob/master/_autodocs/13-common-types.md Illustrates creating an Article object and accessing its properties. Article states can be 'draft' or 'published'. ```php $article = new Article([ 'id' => 'article_123', 'type' => 'article', 'title' => 'Getting Started', 'description' => 'This article explains how to get started', 'body' => '

HTML content here

', 'state' => 'published', // 'draft' or 'published' 'author' => [ 'type' => 'admin', 'id' => 5, ], 'createdAt' => 1234567890, 'updatedAt' => 1234567890, ]); // Access properties echo $article->getId(); echo $article->getTitle(); echo $article->getBody(); echo $article->getState(); ``` -------------------------------- ### JSON Monetary Amount Data Type Example Source: https://github.com/intercom/intercom-php/blob/master/reference.md Example of a Monetary Amount data type for event metadata. 'amount' is in cents and 'currency' specifies the currency code. ```json "price": {"amount": 34999, "currency": "eur"} ``` -------------------------------- ### Minimal IntercomClient Configuration Source: https://github.com/intercom/intercom-php/blob/master/_autodocs/11-configuration.md Instantiate IntercomClient using the API token from the INTERCOM_API_KEY environment variable. ```php use Intercom\IntercomClient; // Requires INTERCOM_API_KEY environment variable $client = new IntercomClient(); ``` -------------------------------- ### JSON Date Data Type Example Source: https://github.com/intercom/intercom-php/blob/master/reference.md Example of a Date data type for event metadata. The key must end with '_date' and the value is a Unix timestamp in UTC. ```json "contact_date": 1392036272 ``` -------------------------------- ### Create and Use Intercom Client Source: https://github.com/intercom/intercom-php/blob/master/_autodocs/00-index.md Instantiate the IntercomClient with your API token and use its resource clients to interact with the Intercom API. This example shows how to find a contact. ```php use Intercom\IntercomClient; // Create client $client = new IntercomClient(token: 'YOUR_API_KEY'); // Use any resource client $contact = $client->contacts->find( new FindContactRequest(['id' => 'contact_123']) ); echo $contact->getName(); ``` -------------------------------- ### Get Event Summaries Source: https://github.com/intercom/intercom-php/blob/master/_autodocs/07-events-api.md Obtain a summary of event counts for a customer, including events older than 90 days. This method is useful for getting an overall count of customer interactions. ```php $request = new ListEventSummariesRequest([ 'type' => 'user', 'userId' => 'user_123', ]); $summary = $client->events->listSummaries($request); echo "Total events: " . $summary->getTotalCount(); ``` -------------------------------- ### Create Content Import Source - PHP Source: https://github.com/intercom/intercom-php/blob/master/reference.md Create a new content import source by specifying the sync behavior and the URL of the content. The `syncBehavior` should be set to 'api' for API-driven content creation. ```php $client->aiContent->createContentImportSource( new CreateContentImportSourceRequest([ 'syncBehavior' => 'api', 'url' => 'https://www.example.com', ]), ); ``` -------------------------------- ### Instantiate and Use IntercomClient Source: https://github.com/intercom/intercom-php/blob/master/README.md Instantiate the IntercomClient with your API token and use it to interact with Intercom's AI Content API. Ensure you have the correct token and import necessary classes. ```php ', ); $client->aiContent->createContentImportSourceRequest( new CreateContentImportSourceRequest([ 'syncBehavior' => 'api', 'url' => 'https://www.example.com', ]), ); ``` -------------------------------- ### Create an AI Content Import Source Source: https://github.com/intercom/intercom-php/blob/master/_autodocs/12-additional-clients.md Use the AiContent client to create a new content import source for AI-powered features. Ensure the `IntercomClient` is initialized with your API key. ```php $client = new IntercomClient(token: 'api_key'); $request = new CreateContentImportSourceRequest([ 'url' => 'https://www.example.com/knowledge-base', 'syncBehavior' => 'api', ]); $source = $client->aiContent->createContentImportSource($request); echo "Created content source: " . $source->getId(); ``` -------------------------------- ### Admin Object Initialization and Access Source: https://github.com/intercom/intercom-php/blob/master/_autodocs/13-common-types.md Shows how to instantiate an Admin object and retrieve its attributes. Properties like 'awayModeEnabled' and 'hasInboxSeat' are boolean. ```php $admin = new Admin([ 'id' => 5, 'type' => 'admin', 'name' => 'John Administrator', 'email' => 'john@company.com', 'jobTitle' => 'Support Manager', 'awayModeEnabled' => false, 'awayModeReassign' => true, 'hasInboxSeat' => true, 'teamIds' => [1, 2, 3], 'avatar' => 'https://...', ]); // Access properties echo $admin->getId(); echo $admin->getName(); echo $admin->getEmail(); echo $admin->getJobTitle(); echo $admin->getAwayModeEnabled(); echo $admin->getHasInboxSeat(); ``` -------------------------------- ### Get Ticket Source: https://github.com/intercom/intercom-php/blob/master/reference.md Retrieves the details of a single ticket. ```APIDOC ## GET /tickets/{id} ### Description You can fetch the details of a single ticket. ### Method GET ### Endpoint /tickets/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier for the ticket which is given by Intercom. ### Response #### Success Response (200) - **id** (string) - The unique identifier for the ticket. - **subject** (string) - The subject of the ticket. - **description** (string) - The description of the ticket. - **status** (string) - The current status of the ticket. #### Response Example ```json { "id": "ticket_abc123", "subject": "Issue with login", "description": "User is unable to log in.", "status": "open" } ``` ``` -------------------------------- ### listTicketStates Source: https://github.com/intercom/intercom-php/blob/master/reference.md Get a list of all ticket states for a workspace. ```APIDOC ## listTicketStates ### Description You can get a list of all ticket states for a workspace. ``` -------------------------------- ### Create an SMS Message Source: https://github.com/intercom/intercom-php/blob/master/_autodocs/08-messages-api.md This example shows how to send an SMS message to a contact. Ensure the SMS channel is enabled for your Intercom account. ```php $request = new CreateMessageRequest([ 'from' => ['type' => 'admin', 'id' => 5], 'to' => ['type' => 'contact', 'id' => 'contact_123'], 'body' => 'Your verification code is: 123456', 'messageType' => 'sms', ]); ``` -------------------------------- ### GET /news Source: https://github.com/intercom/intercom-php/blob/master/reference.md Fetches a list of all news items. ```APIDOC ## GET /news ### Description Fetches a list of all news items. ``` -------------------------------- ### IntercomClient Configuration with Explicit Token Source: https://github.com/intercom/intercom-php/blob/master/_autodocs/11-configuration.md Instantiate IntercomClient by providing the API token directly. ```php use Intercom\IntercomClient; $client = new IntercomClient(token: 'your_api_token_here'); ``` -------------------------------- ### Tag Object Initialization and Access Source: https://github.com/intercom/intercom-php/blob/master/_autodocs/13-common-types.md Illustrates the creation of a Tag object and accessing its details, such as ID, name, and applied count. ```php $tag = new Tag([ 'id' => 456, 'type' => 'tag', 'name' => 'vip_customer', 'appliedCount' => 25, 'createdAt' => 1234567890, ]); // Access properties echo $tag->getId(); echo $tag->getName(); echo $tag->getAppliedCount(); ``` -------------------------------- ### GET /dataExport/download Source: https://github.com/intercom/intercom-php/blob/master/reference.md Downloads a completed data export. ```APIDOC ## GET /dataExport/download ### Description Downloads exported data when a job status is complete. Requires the Accept: application/octet-stream header. ### Parameters #### Request Body - **jobIdentifier** (string) - Required - The unique identifier for the job. ``` -------------------------------- ### Use Legacy Intercom SDK Source: https://github.com/intercom/intercom-php/blob/master/README.md Import and use the legacy SDK alongside the new SDK by aliasing `Intercom Legacy IntercomClient`. This facilitates a gradual migration from the older version. ```php use Intercom\IntercomClient; use Intercom\Legacy\IntercomClient as LegacyIntercomClient; $intercom = new IntercomClient(); $legacyClient = new LegacyIntercomClient(); ``` -------------------------------- ### GET /unstable/subscriptionTypes Source: https://github.com/intercom/intercom-php/blob/master/reference.md Lists all available subscription types. ```APIDOC ## GET /unstable/subscriptionTypes ### Description You can list all subscription types. A list of subscription type objects will be returned. ``` -------------------------------- ### List All Help Centers Source: https://github.com/intercom/intercom-php/blob/master/reference.md Retrieve a list of all available Help Centers. Supports pagination with `page` and `perPage` parameters. ```php $client->helpCenters->list( new ListHelpCentersRequest([]), ); ``` -------------------------------- ### GET /calls Source: https://github.com/intercom/intercom-php/blob/master/reference.md Retrieve a paginated list of calls. ```APIDOC ## GET /calls ### Description Retrieve a paginated list of calls. ### Parameters #### Query Parameters - **page** (int) - Optional - The page of results to fetch. Defaults to first page. - **perPage** (int) - Optional - How many results to display per page. Defaults to 25. Max 25. ``` -------------------------------- ### Segment Object Initialization and Access Source: https://github.com/intercom/intercom-php/blob/master/_autodocs/13-common-types.md Demonstrates how to initialize a Segment object and retrieve its properties like ID, name, and count. ```php $segment = new Segment([ 'id' => 'segment_123', 'type' => 'segment', 'name' => 'Premium Users', 'count' => 150, 'createdAt' => 1234567890, 'updatedAt' => 1234567890, ]); // Access properties echo $segment->getId(); echo $segment->getName(); echo $segment->getCount(); ``` -------------------------------- ### GET /subscription_types Source: https://github.com/intercom/intercom-php/blob/master/reference.md List all available subscription types. ```APIDOC ## GET /subscription_types ### Description You can list all subscription types. A list of subscription type objects will be returned. ``` -------------------------------- ### Configure Intercom Client with Options Source: https://github.com/intercom/intercom-php/blob/master/_autodocs/01-getting-started.md Create an IntercomClient instance and provide custom options such as base URL, timeout, retry limits, custom headers, or a custom Guzzle client. ```php $client = new IntercomClient( token: 'YOUR_API_KEY', options: [ 'baseUrl' => 'https://api.intercom.io', 'timeout' => 30.0, 'maxRetries' => 2, 'headers' => ['X-Custom-Header' => 'value'], 'client' => new \GuzzleHttp\Client() ] ); ``` -------------------------------- ### GET /internal_articles Source: https://github.com/intercom/intercom-php/blob/master/reference.md Fetch a list of all internal articles. ```APIDOC ## GET /internal_articles ### Description You can fetch a list of all internal articles by making a GET request to this endpoint. ### Method GET ### Endpoint https://api.intercom.io/internal_articles ``` -------------------------------- ### GET /intercom/intercom-php/calls/{id} Source: https://github.com/intercom/intercom-php/blob/master/reference.md Retrieve a single call by its ID. ```APIDOC ## GET /intercom/intercom-php/calls/{id} ### Description Retrieve a single call by its ID. ### Method GET ### Endpoint /intercom/intercom-php/calls/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The ID of the call to retrieve. ### Response #### Success Response (200) - **call** (Call) - The retrieved call object. #### Response Example ```json { "call": { "id": "call-id-123", "...details...": "..." } } ``` ``` -------------------------------- ### POST createCustomObjectInstances Source: https://github.com/intercom/intercom-php/blob/master/reference.md Create or update a custom object instance. ```APIDOC ## POST createCustomObjectInstances ### Description Create or update a custom object instance. ### Request Example { "customObjectTypeIdentifier": "Order", "externalId": "123", "externalCreatedAt": 1392036272, "externalUpdatedAt": 1392036272, "customAttributes": { "order_number": "ORDER-12345", "total_amount": "custom_attributes" } } ``` -------------------------------- ### GET /unstable/conversations Source: https://github.com/intercom/intercom-php/blob/master/reference.md Fetch a list of all conversations with optional pagination. ```APIDOC ## GET /unstable/conversations ### 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. ### Parameters #### Query Parameters - **perPage** (int) - Optional - How many results per page - **startingAfter** (string) - Optional - String used to get the next page of conversations. ### Request Example ```php $client->conversations->list( new ListConversationsRequest([ 'perPage' => 1, 'startingAfter' => 'starting_after', ]), ); ``` ``` -------------------------------- ### POST /help_center/collections Source: https://github.com/intercom/intercom-php/blob/master/reference.md Create a new collection in the Help Center. ```APIDOC ## POST /help_center/collections ### Description Create a new collection by making a POST request. ### Method POST ### Endpoint https://api.intercom.io/help_center/collections ### Parameters #### Request Body - **name** (string) - Required - The name of the collection. - **description** (string) - Optional - The description of the collection. - **translatedContent** (GroupTranslatedContent) - Optional - Translated content object. - **parentId** (string) - Optional - The id of the parent collection. - **helpCenterId** (int) - Optional - The id of the help center where the collection will be created. ``` -------------------------------- ### POST /ai_content/import_sources Source: https://github.com/intercom/intercom-php/blob/master/reference.md Create a new content import source. ```APIDOC ## POST /ai_content/import_sources ### Description You can create a new content import source by sending a POST request to this endpoint. ### Parameters #### Request Body - **syncBehavior** (string) - Required - If you intend to create or update External Pages via the API, this should be set to api. - **status** (string) - Optional - The status of the content import source. - **url** (string) - Required - The URL of the content import source. ``` -------------------------------- ### GET /ai_content/external_pages Source: https://github.com/intercom/intercom-php/blob/master/reference.md Retrieve a list of all external pages for a workspace. ```APIDOC ## GET /ai_content/external_pages ### Description You can retrieve a list of all external pages for a workspace. ``` -------------------------------- ### GET /admins/{id} Source: https://github.com/intercom/intercom-php/blob/master/reference.md Retrieve the details of a single admin. ```APIDOC ## GET /admins/{id} ### Description You can retrieve the details of a single admin. ### Parameters #### Path Parameters - **id** (int) - Required - The unique identifier of a given admin ``` -------------------------------- ### GET /calls/{callId} Source: https://github.com/intercom/intercom-php/blob/master/reference.md Retrieve a single call by its ID. ```APIDOC ## GET /calls/{callId} ### Description Retrieve a single call by id. ### Parameters #### Path Parameters - **callId** (string) - Required - The id of the call to retrieve. ``` -------------------------------- ### Message Object Initialization and Access Source: https://github.com/intercom/intercom-php/blob/master/_autodocs/13-common-types.md Demonstrates how to create a Message object and access its properties using getter methods. The 'messageType' can be 'inapp', 'email', or 'sms'. ```php $message = new Message([ 'id' => 'msg_123', 'type' => 'message', 'subject' => 'Subject', 'body' => 'Message body content', 'messageType' => 'inapp', // 'inapp', 'email', 'sms' 'createdAt' => 1234567890, 'author' => [ 'type' => 'contact', 'id' => 'contact_123', ], ]); // Access properties echo $message->getId(); echo $message->getBody(); echo $message->getMessageType(); echo $message->getAuthor(); ``` -------------------------------- ### GET getCustomObjectInstancesByExternalId Source: https://github.com/intercom/intercom-php/blob/master/reference.md Fetch a Custom Object Instance by external_id. ```APIDOC ## GET getCustomObjectInstancesByExternalId ### Description Fetch a Custom Object Instance by external_id. ### Parameters #### Query Parameters - **customObjectTypeIdentifier** (string) - Required - The unique identifier of the custom object type. - **externalId** (string) - Required - The external ID of the instance. ### Request Example { "customObjectTypeIdentifier": "Order", "externalId": "external_id" } ``` -------------------------------- ### Basic Usage Source: https://github.com/intercom/intercom-php/blob/master/_autodocs/README.md Demonstrates basic usage of the IntercomClient to find a contact. ```APIDOC ## Basic Usage ### Description Demonstrates basic usage of the IntercomClient to find a contact. ### Method ```php use Intercom\IntercomClient; $client = new IntercomClient(token: 'YOUR_API_KEY'); $contact = $client->contacts->find( new FindContactRequest(['id' => 'contact_123']) ); ``` ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ``` -------------------------------- ### Ticket Object Initialization and Access Source: https://github.com/intercom/intercom-php/blob/master/_autodocs/13-common-types.md Shows the creation of a Ticket object and accessing its key attributes. Ticket states include 'open', 'resolved', 'in_progress', 'waiting_on_customer', and priorities include 'low', 'medium', 'high', 'urgent'. ```php $ticket = new Ticket([ 'id' => 'ticket_123', 'type' => 'ticket', 'ticketId' => 'TICKET-001', 'title' => 'Payment not processing', 'description' => 'Customer cannot process payment', 'state' => 'open', // 'open', 'resolved', 'in_progress', 'waiting_on_customer' 'priority' => 'high', // 'low', 'medium', 'high', 'urgent' 'ticketType' => [ 'id' => 'type_123', 'name' => 'Bug Report', ], 'assignee' => [...], 'createdAt' => 1234567890, 'updatedAt' => 1234567890, ]); // Access properties echo $ticket->getId(); echo $ticket->getTicketId(); echo $ticket->getTitle(); echo $ticket->getState(); echo $ticket->getPriority(); ``` -------------------------------- ### GET /conversations Source: https://github.com/intercom/intercom-php/blob/master/reference.md Fetches a list of all conversations with optional pagination. ```APIDOC ## GET /conversations ### 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. ### Parameters #### Query Parameters - **perPage** (int) - Optional - How many results per page - **startingAfter** (string) - Optional - String used to get the next page of conversations. ### Request Example { "perPage": 1, "startingAfter": "starting_after" } ``` -------------------------------- ### Authenticate Intercom Client via Environment Variable Source: https://github.com/intercom/intercom-php/blob/master/_autodocs/01-getting-started.md Instantiate the IntercomClient without arguments; it will automatically use the INTERCOM_API_KEY environment variable. ```php $client = new IntercomClient(); ``` -------------------------------- ### GET /notes/{noteId} Source: https://github.com/intercom/intercom-php/blob/master/reference.md Fetches the details of a single note. ```APIDOC ## GET /notes/{noteId} ### Description You can fetch the details of a single note. ### Path Parameters - **noteId** (int) - Required - The unique identifier of a given note. ``` -------------------------------- ### Create a Help Center Collection - Intercom PHP Source: https://github.com/intercom/intercom-php/blob/master/reference.md Creates a new help center collection. Requires a `name` and optionally accepts `description`, `translatedContent`, `parentId`, and `helpCenterId`. ```php $client->helpCenters->collections->create( new CreateCollectionRequest([ 'name' => 'Thanks for everything', ]), ); ``` -------------------------------- ### GET /companies Source: https://github.com/intercom/intercom-php/blob/master/reference.md List companies with pagination and ordering options. ```APIDOC ## GET /companies ### Description List all companies associated with the account. ### Parameters #### Query Parameters - **page** (int) - Optional - The page of results to fetch. Defaults to first page. - **perPage** (int) - Optional - How many results to return per page. Defaults to 15. - **order** (string) - Optional - 'asc' or 'desc'. Return the companies in ascending or descending order. Defaults to desc. ### Request Example $client->companies->list(new ListCompaniesRequest(['page' => 1, 'perPage' => 1, 'order' => 'desc'])); ``` -------------------------------- ### GET /articles/search Source: https://github.com/intercom/intercom-php/blob/master/reference.md Searches for articles based on specified criteria. ```APIDOC ## GET /articles/search ### Description Searches for articles using a phrase, state, help center ID, and highlighting option. ### Method GET ### Endpoint `https://api.intercom.io/articles/search` ### Query Parameters - **phrase** (string) - Optional - The phrase within your articles to search for. - **state** (string) - Optional - The state of the Articles returned. One of `published`, `draft` or `all`. - **helpCenterId** (int) - Optional - The ID of the Help Center to search in. - **highlight** (boolean) - Optional - Return a highlighted version of the matching content within your articles. ### Request Example ```php $client->articles->search( new SearchArticlesRequest([ 'phrase' => 'Getting started', 'state' => 'published', 'helpCenterId' => 1, 'highlight' => true, ]), ); ``` ### Response #### Success Response (200) Returns a list of articles matching the search criteria. #### Response Example ```json { "type": "list", "data": [ { "type": "article", "id": "123", "title": "Getting Started Guide" } ] } ``` #### Error Response (400) Invalid search parameters. ``` -------------------------------- ### GET /aiContent/listExternalPages Source: https://github.com/intercom/intercom-php/blob/master/reference.md Retrieves a list of all external pages for a workspace. ```APIDOC ## GET /aiContent/listExternalPages ### Description Retrieves a list of all external pages for a workspace. ### Method GET ### Endpoint /aiContent/listExternalPages ### Parameters ### Request Example ```json {} ``` ### Response #### Success Response (200) - **[Response fields not specified in the provided text]** #### Response Example ```json { "example": "[Response body example not specified in the provided text]" } ``` ``` -------------------------------- ### IntercomClient Configuration with Multiple Customizations Source: https://github.com/intercom/intercom-php/blob/master/_autodocs/11-configuration.md Instantiate IntercomClient with a combination of custom options, including a custom Guzzle client with middleware, retries, timeout, and headers. ```php use Intercom\IntercomClient; use GuzzleHttp\Client as GuzzleClient; use GuzzleHttp\HandlerStack; // Create custom Guzzle client with middleware $handlerStack = HandlerStack::create(); $handlerStack->push(function ($handler) { return function ($request, $options) use ($handler) { // Custom middleware logic return $handler($request, $options); }; }); $guzzleClient = new GuzzleClient([ 'handler' => $handlerStack, 'timeout' => 15.0, ]); $client = new IntercomClient( token: 'your_api_token', options: [ 'client' => $guzzleClient, 'maxRetries' => 3, 'timeout' => 30.0, 'headers' => [ 'X-Request-ID' => uniqid(), ] ] ); ``` -------------------------------- ### Create a Note Source: https://github.com/intercom/intercom-php/blob/master/_autodocs/12-additional-clients.md Use the Notes client to create an internal note on a contact. Specify the contact ID and the note body. ```php $request = new CreateNoteRequest([ 'contactId' => 'contact_123', 'body' => 'This customer is interested in the enterprise plan', ]); $note = $client->notes->create($request); ``` -------------------------------- ### GET /brands/{id} Source: https://github.com/intercom/intercom-php/blob/master/reference.md Fetches a specific brand by its unique identifier. ```APIDOC ## GET /brands/{id} ### Description Fetches a specific brand by its unique identifier. ### Method GET ### Endpoint /brands/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the brand ``` -------------------------------- ### GET /brands Source: https://github.com/intercom/intercom-php/blob/master/reference.md Retrieves all brands for the workspace, including the default brand. ```APIDOC ## GET /brands ### Description Retrieves all brands for the workspace, including the default brand. The default brand id always matches the workspace. ### Method GET ### Endpoint /brands ``` -------------------------------- ### Create a New Article Source: https://github.com/intercom/intercom-php/blob/master/_autodocs/06-articles-api.md Use this snippet to create a new article in the help center. You can specify the title, body, state (draft or published), and an optional parent collection ID. ```php $request = new CreateArticleRequest([ 'title' => 'Getting Started Guide', 'body' => '

This is the article content...

', 'state' => 'published', 'parentId' => 123, ]); $article = $client->articles->create($request); echo "Created article ID: " . $article->getId(); ``` -------------------------------- ### List All Tags Source: https://github.com/intercom/intercom-php/blob/master/reference.md Fetches a list of all tags available in the workspace. ```php $client->tags->list(); ``` -------------------------------- ### Get Ticket Type Source: https://github.com/intercom/intercom-php/blob/master/reference.md Retrieves the details of a specific ticket type. ```APIDOC ## GET /ticketTypes/{id} ### Description You can fetch the details of a single ticket type. ### Method GET ### Endpoint /ticketTypes/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier for the ticket type which is given by Intercom. ### Response #### Success Response (200) - **id** (string) - The unique identifier for the ticket type. - **key** (string) - The key of the ticket type. #### Response Example ```json { "id": "12345", "key": "value" } ``` ``` -------------------------------- ### Retrieve a Help Center - PHP Source: https://github.com/intercom/intercom-php/blob/master/reference.md Fetches the details of a single Help Center. You need to provide the Help Center's unique ID. ```php $client->unstable->helpCenter->retrieveHelpCenter( new RetrieveHelpCenterRequest([ 'id' => 1, ]), ); ``` -------------------------------- ### GET /unstable/tags/{id} Source: https://github.com/intercom/intercom-php/blob/master/reference.md Fetch the details of a specific tag by its ID. ```APIDOC ## GET /unstable/tags/{id} ### Description You can fetch the details of tags that are on the workspace by their id. This will return a tag object. ### Parameters #### Request Body - **id** (string) - Required - The unique identifier of a given tag ### Request Example ```php $client->unstable->tags->findTag( new FindTagRequest([ 'id' => '123', ]), ); ``` ``` -------------------------------- ### Get Current Admin Source: https://github.com/intercom/intercom-php/blob/master/_autodocs/14-quick-reference.md Retrieves information about the currently authenticated admin. ```APIDOC ## Get Current Admin ### Description Retrieves details of the currently authenticated admin user. ### Method GET (implied) ### Endpoint /admins/me ### Parameters None ### Response #### Success Response - **name** (string) - The name of the admin. ### Request Example ```php $admin = $client->admins->identify(); echo $admin->getName(); ``` ``` -------------------------------- ### List Available Datasets and Attributes Source: https://github.com/intercom/intercom-php/blob/master/reference.md Lists all available datasets and their associated attributes for reporting exports. ```php $client->export->listAvailableDatasetsAndAttributes(); ``` -------------------------------- ### HelpCenters Client Source: https://github.com/intercom/intercom-php/blob/master/_autodocs/12-additional-clients.md Manage help center workspaces. ```APIDOC ## HelpCenters Client Manage help center workspaces. ### Methods - `list()` - List all help centers - `find()` - Get help center details - `create()` - Create help center - `update()` - Update help center - `delete()` - Delete help center ### Sub-resources - `collections` - Manage article collections ``` -------------------------------- ### GET /articles Source: https://github.com/intercom/intercom-php/blob/master/reference.md Fetches a list of all articles, sorted by the most recently updated. ```APIDOC ## GET /articles ### Description You can fetch a list of all articles by making a GET request to `https://api.intercom.io/articles`. Articles will be returned in descending order on the `updated_at` attribute. ### Method GET ### Endpoint /articles ### Query Parameters - **sort** (string) - Optional - Specifies the sorting order. Default is `updated_at` descending. - **order** (string) - Optional - Specifies the order direction. Default is `desc`. ### Request Example ```php $client->articles->list( new ListArticlesRequest([]), ); ``` ### Response #### Success Response (200) - **data** (array) - An array of article objects. - **total_count** (int) - The total number of articles. - **next_page_url** (string) - URL for the next page of results, if any. #### Response Example ```json { "data": [ { "id": "123", "title": "Example Article", "updated_at": 1678886400 } ], "total_count": 1, "next_page_url": null } ``` ``` -------------------------------- ### GET /aiContent/getExternalPage Source: https://github.com/intercom/intercom-php/blob/master/reference.md Retrieves details for a specific external page by its ID. ```APIDOC ## GET /aiContent/getExternalPage ### Description Retrieves an existing external page. ### Parameters #### Query Parameters - **id** (string) - Required - The unique identifier for the external page. ``` -------------------------------- ### Initialize Intercom Client Source: https://github.com/intercom/intercom-php/blob/master/_autodocs/14-quick-reference.md Initialize the Intercom client using an environment variable, an explicit API token, or with custom options like timeout and max retries. ```php use Intercom\IntercomClient; // From environment variable $client = new IntercomClient(); // With explicit token $client = new IntercomClient(token: 'your_api_token'); // With options $client = new IntercomClient( token: 'your_api_token', options: [ 'timeout' => 60.0, 'maxRetries' => 3, ] ); ``` -------------------------------- ### GET /help_center/collections/ Source: https://github.com/intercom/intercom-php/blob/master/reference.md Fetch the details of a single collection by its ID. ```APIDOC ## GET /help_center/collections/ ### Description Fetch the details of a single collection. ### Method GET ### Endpoint https://api.intercom.io/help_center/collections/ ### Parameters #### Path Parameters - **collectionId** (int) - Required - The unique identifier for the collection. ``` -------------------------------- ### Get Ticket Details Source: https://github.com/intercom/intercom-php/blob/master/reference.md Retrieves information for a single ticket by its ID. ```php $client->tickets->get( new FindTicketRequest([ 'ticketId' => 'ticket_id', ]), ); ``` -------------------------------- ### Authenticate Intercom Client via Constructor Source: https://github.com/intercom/intercom-php/blob/master/_autodocs/01-getting-started.md Instantiate the IntercomClient by passing your API token directly to the constructor. ```php use Intercom\IntercomClient; $client = new IntercomClient(token: 'YOUR_INTERCOM_API_KEY'); ``` -------------------------------- ### Create Article using Intercom PHP SDK Source: https://github.com/intercom/intercom-php/blob/master/reference.md Creates a new article via a POST request. Ensure all required parameters are included in the request payload. ```php $client->unstable->articles->createArticle( [ 'key' => "value", ], ); ``` -------------------------------- ### GET /segments/{segmentId} Source: https://github.com/intercom/intercom-php/blob/master/reference.md Find a specific segment by its unique identifier. ```APIDOC ## GET /segments/{segmentId} ### Description Find a specific segment by its unique identifier. ### Parameters #### Request Body - **segmentId** (string) - Required - The unique identifier of a given segment. ### Request Example { "segmentId": "123" } ``` -------------------------------- ### GET /segments/{id} Source: https://github.com/intercom/intercom-php/blob/master/reference.md Fetches the details of a single segment by its ID. ```APIDOC ## GET /segments/{id} ### Description You can fetch the details of a single segment. ### Method GET ### Endpoint /segments/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the segment. ### Response #### Success Response (200 OK) Returns the details of the specified segment. #### Error Responses - **404 Not Found**: Segment not found. - **500 Internal Server Error**: Server error. ``` -------------------------------- ### Basic Intercom Client Usage Source: https://github.com/intercom/intercom-php/blob/master/_autodocs/README.md Instantiate the IntercomClient with your API token and find a contact using their ID. Ensure you have the correct API key. ```php use Intercom\IntercomClient; $client = new IntercomClient(token: 'YOUR_API_KEY'); $contact = $client->contacts->find( new FindContactRequest(['id' => 'contact_123']) ); ``` -------------------------------- ### List all email settings Source: https://github.com/intercom/intercom-php/blob/master/reference.md Lists all sender email address settings for the workspace. ```php $client->unstable->emails->listEmails(); ``` -------------------------------- ### GET /notes Source: https://github.com/intercom/intercom-php/blob/master/reference.md Fetches a list of notes associated with a specific contact. ```APIDOC ## GET /notes ### Description You can fetch a list of notes that are associated to a contact. ### Query Parameters - **contactId** (string) - Required - The unique identifier of a contact. - **page** (int) - Optional - The page of results to fetch. - **perPage** (int) - Optional - How many results to display per page. ```