Intercom api can be authenticate via two method one is OAuth method and other is basic authentication method.
OAuth Method:
For OAuth flow can be initiate through thia call url https://app.intercom.io/oauth with the following parameters.
– Client_id (Required) // Get client id from you intercom account credentials
– state (Not required but recommended)
– redirect_uri (Not required)
Basic Authorization Method:
This is the quite simple and easiest way to do intercom authentication. Get the App Id and APi Key from intercom account. See the below image to get API keys info.
Create New User in Intercom via Basic Authentication Method:
Using this method you can create, delete and update the user. check below code for that:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
<?php $headers = array( 'Content-Type: application/json', 'Accept: application/json' ); $data1 = array( 'user_id' => '********', ); $mydatse=json_encode($data1); $url = 'https://api.intercom.io/users'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_USERPWD, "app id:api key"); curl_setopt($ch, CURLOPT_POSTFIELDS, $mydatse); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // Execute post $result = json_decode(curl_exec($ch)); curl_close($ch); echo "<pre>"; print_r($result); ?> |
Hope above description will help you to configure Intercom api and use provided method as per your requirements.