You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: readme.md
+63-2Lines changed: 63 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,8 +33,69 @@ Once you got your access token, open the `config/services.php` in your laravel p
33
33
]
34
34
35
35
36
-
The package will automatically pick out the token to authenticate any Api call to your own intercom data.
36
+
The package will automatically pick out the token to authenticate any api request to your own intercom data.
37
37
38
+
## Usage
39
+
40
+
You can resolve the intercom `Client` in many ways:
41
+
42
+
```php
43
+
use Mediumart\Intercom\Client;
44
+
45
+
/**
46
+
* Manually resolving from the container
47
+
* */
48
+
$intercom = app('intercom');
49
+
// or
50
+
$intercom = app(Client::class);
51
+
52
+
53
+
/**
54
+
* using type hinting and laravel's automatic resolution
55
+
* */
56
+
public function index(Client $intercom)
57
+
{
58
+
/.../
59
+
}
60
+
61
+
62
+
/**
63
+
* Simply leverage the facade
64
+
* */
65
+
$intercomUsers = Intercom::users();
66
+
```
67
+
68
+
Using the `intance` or the `facade`, any resource type is mirrored as a method on the `Client`, that can be used to gain the corresponding resource object :
69
+
```php
70
+
// facade
71
+
$leads = Intercom::leads();
72
+
73
+
// instance
74
+
$intercom = app('intercom');
75
+
$conversations = $intercom->conversations();
76
+
```
77
+
Using the `intance` approach you can also resolve the resource instance as a property of the `Client`:
78
+
```php
79
+
$conversations = $intercom->conversations;
80
+
```
81
+
82
+
Here is the list of all the Intercom resources types :
83
+
84
+
-`users`
85
+
-`events`
86
+
-`companies`
87
+
-`messages`
88
+
-`conversations`
89
+
-`leads`
90
+
-`admins`
91
+
-`tags`
92
+
-`segments`
93
+
-`counts`
94
+
-`bulk`
95
+
-`notes`
96
+
97
+
You can find related informations on their [official documentation page](https://developers.intercom.com/v2.0/reference#introduction).
98
+
38
99
## License
39
100
40
-
Mediumart Intercom is an open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT).
101
+
Mediumart Intercom is an open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT).
0 commit comments