{"id":19235597,"url":"https://github.com/mediumart/intercom","last_synced_at":"2025-04-21T05:32:07.825Z","repository":{"id":37547110,"uuid":"82809289","full_name":"mediumart/intercom","owner":"mediumart","description":"Intercom API [Macroable] client adapter for laravel","archived":false,"fork":false,"pushed_at":"2022-06-21T17:43:24.000Z","size":142,"stargazers_count":8,"open_issues_count":6,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-11T16:13:22.721Z","etag":null,"topics":["api","intercom","laravel","php"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mediumart.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-02-22T13:46:30.000Z","updated_at":"2022-01-13T11:26:09.000Z","dependencies_parsed_at":"2022-08-18T03:01:30.969Z","dependency_job_id":null,"html_url":"https://github.com/mediumart/intercom","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mediumart%2Fintercom","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mediumart%2Fintercom/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mediumart%2Fintercom/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mediumart%2Fintercom/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mediumart","download_url":"https://codeload.github.com/mediumart/intercom/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250002271,"owners_count":21359083,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","intercom","laravel","php"],"created_at":"2024-11-09T16:17:28.953Z","updated_at":"2025-04-21T05:32:07.545Z","avatar_url":"https://github.com/mediumart.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mediumart Intercom\n\n[![Build Status](https://travis-ci.org/mediumart/intercom.svg?branch=master)](https://travis-ci.org/mediumart/intercom)\n[![Coverage Status](https://coveralls.io/repos/github/mediumart/intercom/badge.svg)](https://coveralls.io/github/mediumart/intercom)\n[![Latest Stable Version](https://poser.pugx.org/mediumart/intercom/v/stable)](https://packagist.org/packages/mediumart/intercom)\n[![License](https://poser.pugx.org/mediumart/intercom/license)](https://packagist.org/packages/mediumart/intercom)\n[![Total Downloads](https://poser.pugx.org/mediumart/intercom/downloads)](https://packagist.org/packages/mediumart/intercom)\n\n\u003e Mediumart Intercom Client is macroable !\n\n## Installation\n\nTo install, first require the package via composer:\n\n```\n$ composer require mediumart/intercom\n```\n\nNext add the following to your `config/app.php` inside the `'providers'` array:\n\n```php\nMediumart\\Intercom\\IntercomServiceProvider::class\n```\n\nand the facade reference inside the `'aliases'` array:\n\n```php\n'Intercom' =\u003e Mediumart\\Intercom\\Intercom::class\n```\n\n## Configuration\n\nYou need to create an `app` with an associated `access_token` from your [intercom.io](https://app.intercom.io/admins/sign_in) account. You can find informations on how to do that [here](https://developers.intercom.com/building-apps/docs/authorization).\n\nOnce you got your access token, open the `config/services.php` in your laravel project and add a key for the `intercom` service like this:\n\n    'intercom' =\u003e [\n        'access_token' =\u003e '\u003cyour_access_token\u003e'\n    ]\n\n\nThe package will automatically pick out the token to authenticate any api request to your own intercom data.\n\n## Usage\n\nYou can resolve the intercom `Client` in many ways:\n\n```php\nuse Mediumart\\Intercom\\Client;\n\n/** \n* Manually resolving from the container \n* */\n$intercom = app('intercom');\n// or\n$intercom = app(Client::class);\n\n\n/** \n* using type hinting and laravel's automatic resolution\n* */\npublic function index(Client $intercom) \n{\n    /.../\n}\n\n\n/**\n* Simply leverage the facade\n* */\n$intercomUsers = Intercom::users();\n```\n\nUsing the `instance` or the `facade`, any resource type is mirrored as a method on the `Client`, that can be used to gain the corresponding resource object :\n```php\n// facade\n$leads = Intercom::leads();\n\n// instance\n$intercom = app('intercom');\n$conversations = $intercom-\u003econversations();\n```\nUsing the `instance` approach you can also resolve the resource instance as a property of the `Client`:\n```php\n$conversations = $intercom-\u003econversations;\n```\n\nHere is the list of all the Intercom resources types :\n\n - `users`\n - `events`\n - `companies`\n - `messages`\n - `conversations`\n - `leads`\n - `visitors`\n - `admins`\n - `tags`\n - `segments`\n - `counts`\n - `bulk`\n - `notes`\n \nYou can find related informations on their [official documentation page](https://developers.intercom.com/intercom-api-reference/reference#users) and the api usage for each resource [here](https://github.com/intercom/intercom-php/blob/master/README.md#users).\n\nIn addition, you can also set the token in a fluent way, after the `Client` has been resolved, using the `setToken` method:\n\n    $intercom-\u003esetToken($token)-\u003eusers-\u003egetUser($id);\n\n \n## Defining Macros\n\nTo create a macro function, you can use the `macro` method on either the `facade` or the `instance`, this method accepts a `name` as its first argument, and a `callable` as its second.\n\n```php\n// facade\nIntercom::macro('usersEmails', function () {\n   return // your logic here ... \n});\n\n// instance\n$intercom-\u003emacro('usersEmails', function () use ($intercom) {\n   return // your logic here ... \n});\n```\n\nYour `macro` can now be called as a regular method on intercom facade or instance\n\n```php\n// facade\n$userEmails = Intercom::usersEmails();\n\n// instance\n$userEmails = $intercom-\u003eusersEmails();\n```\n\n## License\n\nMediumart Intercom is an open-sourced software licensed under the [MIT license](https://github.com/mediumart/intercom/blob/master/LICENSE.txt).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmediumart%2Fintercom","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmediumart%2Fintercom","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmediumart%2Fintercom/lists"}