Clio Intergration

Status
Not open for further replies.

Rhys Haskell

Advanced Certified
Joined
Jul 30, 2018
Messages
314
Reaction score
74
Hello,

I am trying to build an intergration with Clio CRM.

There isnt a specific contact lookup URL, you have to first lookup all contacts and then get the contact ID to query the contact on its own.

If I queriy all contacts I am returned:

{
"meta": {
"paging": {},
"records": 2
},
"data": [
{
"id": 2814688,
"primary_phone_number": "PHONE_NUM_HERE",
"first_name": "Rhys",
"last_name": "Haskell"
},
{
"id": 2814835,
"primary_phone_number": "PHONE_NUM_HERE",
"first_name": "Test",
"last_name": "2"
}
]

Is there any way I can get this intergration working?
 
You will need to create a custom template using this tool:
https://www.3cx.com/docs/crm-integration/
Hello,

I have now created a template however I am returned the below error:
1608214154181.png

The log shows:
Started scenario with empty id
Started Auth
Request text: https://eu.app.clio.com/oauth/token
Request form value refresh_token set to XXX
Request form value grant_type set to refresh_token
Request form value client_id set to XXX
Request form value client_secret set to XXX
Response text: {"access_token":"XXX","token_type":"bearer","expires_in":2592000}
Response finished
Variable AccessToken set to XXX
Variable ExpiresIn set to 2592000
Finished Auth
Request text: https://eu.app.clio.com/api/v4/cont...ame,last_name,primary_phone_number,id,company
Response text: {"meta":{"paging":{},"records":1},"data":[{"first_name":"Test","last_name":"2","primary_phone_number":"01462417100","id":2814835,"company":null}]}
Response finished
Finished scenario with empty id

The template is here:
<?xml version="1.0"?>
<Crm xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Country="US" Name="Clio V4" Version="1">
<Number Prefix="AsIs" MaxLength="[MaxLength]" />
<Connection MaxConcurrentRequests="2" />
<Parameters>
<Parameter Name="ClientId" Type="String" Parent="General Configuration" Editor="String" Title="Client ID:" />
<Parameter Name="ClientSecret" Type="String" Parent="General Configuration" Editor="String" Title="Client Secret:" />
<Parameter Name="RefreshToken" Type="OAuth" Parent="General Configuration" Editor="String" Title="Refresh Token:" RequestUrl="https://eu.app.clio.com/oauth/authorize" RequestUrlParameters="response_type=code&amp;client_id=[ClientId]&amp;redirect_uri=[RedirectUri]&amp;state=[State]" ResponseScenario="OAuthGetRefreshToken" />
</Parameters>
<Authentication Type="Scenario">
<Value>Auth</Value>
</Authentication>
<Scenarios>
<Scenario Id="Auth" Type="REST">
<Request Url="https://eu.app.clio.com/oauth/token" MessagePasses="0" RequestContentType="application/x-www-form-urlencoded" RequestEncoding="UrlEncoded" RequestType="Post" ResponseType="Json">
<PostValues>
<Value Key="refresh_token" Passes="0" Type="String">[RefreshToken]</Value>
<Value Key="grant_type" Passes="0" Type="String">refresh_token</Value>
<Value Key="client_id" Passes="0" Type="String">[ClientId]</Value>
<Value Key="client_secret" Passes="0" Type="String">[ClientSecret]</Value>
</PostValues>
</Request>
<Rules>
<Rule Type="Any">access_token</Rule>
</Rules>
<Variables>
<Variable Name="AccessToken" Path="access_token">
<Filter />
</Variable>
<Variable Name="ExpiresIn" Path="expires_in">
<Filter />
</Variable>
</Variables>
<Outputs AllowEmpty="false">
<Output Type="HeaderName" Passes="0" Value="Authorization" />
<Output Type="HeaderValue" Passes="0" Value="Bearer [AccessToken]" />
<Output Type="BearerExpiration" Passes="0" Value="[ExpiresIn]" />
</Outputs>
</Scenario>
<Scenario Id="OAuthGetRefreshToken" Type="REST">
<Request Url="https://eu.app.clio.com/oauth/token" MessagePasses="0" RequestContentType="application/x-www-form-urlencoded" RequestEncoding="UrlEncoded" RequestType="Post" ResponseType="Json">
<PostValues>
<Value Key="code" Passes="0" Type="String">
Code:
</Value>
          <Value Key="grant_type" Passes="0" Type="String">authorization_code</Value>
          <Value Key="client_id" Passes="0" Type="String">[ClientId]</Value>
          <Value Key="client_secret" Passes="0" Type="String">[ClientSecret]</Value>
          <Value Key="redirect_uri" Passes="0" Type="String">[RedirectUri]</Value>
          <Value Key="state" Passes="0" Type="String">[state]</Value>
        </PostValues>
      </Request>
      <Rules>
        <Rule Type="Any">refresh_token</Rule>
      </Rules>
      <Variables>
        <Variable Name="Result" Path="refresh_token">
          <Filter />
        </Variable>
      </Variables>
      <Outputs AllowEmpty="false">
        <Output Type="Result" Passes="0" Value="[Result]" />
      </Outputs>
    </Scenario>
    <Scenario Id="" Type="REST">
      <Request Url="https://eu.app.clio.com/api/v4/contacts?query=[Number]&amp;fields=first_name,last_name,primary_phone_number,id,company" MessagePasses="0" RequestEncoding="UrlEncoded" RequestType="Get" ResponseType="Json" />
      <Rules>
        <Rule Type="Any">id</Rule>
      </Rules>
      <Variables>
        <Variable Name="ContactID" Path="id">
          <Filter />
        </Variable>
        <Variable Name="FirstName" Path="first_name">
          <Filter />
        </Variable>
        <Variable Name="LastName" Path="last_name">
          <Filter />
        </Variable>
        <Variable Name="PhoneMobile" Path="primary_phone_number">
          <Filter />
        </Variable>
      </Variables>
      <Outputs AllowEmpty="false">
        <Output Type="ContactID" Passes="0" Value="[ContactID]" />
        <Output Type="FirstName" Passes="0" Value="[FirstName]" />
        <Output Type="LastName" Passes="0" Value="[LastName]" />
        <Output Type="PhoneMobile" Passes="0" Value="[PhoneMobile]" />
        <Output Type="ContactUrl" Passes="0" Value="https://eu.app.clio.com/nc/#/contacts/[ContactID]" />
      </Outputs>
    </Scenario>
  </Scenarios>
</Crm>

Any ideas?
 
Hello,

I have now created a template however I am returned the below error:
View attachment 19713

The log shows:
Started scenario with empty id
Started Auth
Request text: https://eu.app.clio.com/oauth/token
Request form value refresh_token set to XXX
Request form value grant_type set to refresh_token
Request form value client_id set to XXX
Request form value client_secret set to XXX
Response text: {"access_token":"XXX","token_type":"bearer","expires_in":2592000}
Response finished
Variable AccessToken set to XXX
Variable ExpiresIn set to 2592000
Finished Auth
Request text: https://eu.app.clio.com/api/v4/cont...ame,last_name,primary_phone_number,id,company
Response text: {"meta":{"paging":{},"records":1},"data":[{"first_name":"Test","last_name":"2","primary_phone_number":"01462417100","id":2814835,"company":null}]}
Response finished
Finished scenario with empty id

The template is here:
<?xml version="1.0"?>
<Crm xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Country="US" Name="Clio V4" Version="1">
<Number Prefix="AsIs" MaxLength="[MaxLength]" />
<Connection MaxConcurrentRequests="2" />
<Parameters>
<Parameter Name="ClientId" Type="String" Parent="General Configuration" Editor="String" Title="Client ID:" />
<Parameter Name="ClientSecret" Type="String" Parent="General Configuration" Editor="String" Title="Client Secret:" />
<Parameter Name="RefreshToken" Type="OAuth" Parent="General Configuration" Editor="String" Title="Refresh Token:" RequestUrl="https://eu.app.clio.com/oauth/authorize" RequestUrlParameters="response_type=code&amp;client_id=[ClientId]&amp;redirect_uri=[RedirectUri]&amp;state=[State]" ResponseScenario="OAuthGetRefreshToken" />
</Parameters>
<Authentication Type="Scenario">
<Value>Auth</Value>
</Authentication>
<Scenarios>
<Scenario Id="Auth" Type="REST">
<Request Url="https://eu.app.clio.com/oauth/token" MessagePasses="0" RequestContentType="application/x-www-form-urlencoded" RequestEncoding="UrlEncoded" RequestType="Post" ResponseType="Json">
<PostValues>
<Value Key="refresh_token" Passes="0" Type="String">[RefreshToken]</Value>
<Value Key="grant_type" Passes="0" Type="String">refresh_token</Value>
<Value Key="client_id" Passes="0" Type="String">[ClientId]</Value>
<Value Key="client_secret" Passes="0" Type="String">[ClientSecret]</Value>
</PostValues>
</Request>
<Rules>
<Rule Type="Any">access_token</Rule>
</Rules>
<Variables>
<Variable Name="AccessToken" Path="access_token">
<Filter />
</Variable>
<Variable Name="ExpiresIn" Path="expires_in">
<Filter />
</Variable>
</Variables>
<Outputs AllowEmpty="false">
<Output Type="HeaderName" Passes="0" Value="Authorization" />
<Output Type="HeaderValue" Passes="0" Value="Bearer [AccessToken]" />
<Output Type="BearerExpiration" Passes="0" Value="[ExpiresIn]" />
</Outputs>
</Scenario>
<Scenario Id="OAuthGetRefreshToken" Type="REST">
<Request Url="https://eu.app.clio.com/oauth/token" MessagePasses="0" RequestContentType="application/x-www-form-urlencoded" RequestEncoding="UrlEncoded" RequestType="Post" ResponseType="Json">
<PostValues>
<Value Key="code" Passes="0" Type="String">
Code:
</Value>
          <Value Key="grant_type" Passes="0" Type="String">authorization_code</Value>
          <Value Key="client_id" Passes="0" Type="String">[ClientId]</Value>
          <Value Key="client_secret" Passes="0" Type="String">[ClientSecret]</Value>
          <Value Key="redirect_uri" Passes="0" Type="String">[RedirectUri]</Value>
          <Value Key="state" Passes="0" Type="String">[state]</Value>
        </PostValues>
      </Request>
      <Rules>
        <Rule Type="Any">refresh_token</Rule>
      </Rules>
      <Variables>
        <Variable Name="Result" Path="refresh_token">
          <Filter />
        </Variable>
      </Variables>
      <Outputs AllowEmpty="false">
        <Output Type="Result" Passes="0" Value="[Result]" />
      </Outputs>
    </Scenario>
    <Scenario Id="" Type="REST">
      <Request Url="https://eu.app.clio.com/api/v4/contacts?query=[Number]&amp;fields=first_name,last_name,primary_phone_number,id,company" MessagePasses="0" RequestEncoding="UrlEncoded" RequestType="Get" ResponseType="Json" />
      <Rules>
        <Rule Type="Any">id</Rule>
      </Rules>
      <Variables>
        <Variable Name="ContactID" Path="id">
          <Filter />
        </Variable>
        <Variable Name="FirstName" Path="first_name">
          <Filter />
        </Variable>
        <Variable Name="LastName" Path="last_name">
          <Filter />
        </Variable>
        <Variable Name="PhoneMobile" Path="primary_phone_number">
          <Filter />
        </Variable>
      </Variables>
      <Outputs AllowEmpty="false">
        <Output Type="ContactID" Passes="0" Value="[ContactID]" />
        <Output Type="FirstName" Passes="0" Value="[FirstName]" />
        <Output Type="LastName" Passes="0" Value="[LastName]" />
        <Output Type="PhoneMobile" Passes="0" Value="[PhoneMobile]" />
        <Output Type="ContactUrl" Passes="0" Value="https://eu.app.clio.com/nc/#/contacts/[ContactID]" />
      </Outputs>
    </Scenario>
  </Scenarios>
</Crm>

Any ideas?

Change this:
Code:
<Rules>
        <Rule Type="Any">id</Rule>
      </Rules>
      <Variables>
        <Variable Name="ContactID" Path="id">
          <Filter />
        </Variable>
        <Variable Name="FirstName" Path="first_name">
          <Filter />
        </Variable>
        <Variable Name="LastName" Path="last_name">
          <Filter />
        </Variable>
        <Variable Name="PhoneMobile" Path="primary_phone_number">
          <Filter />
        </Variable>
      </Variables>

to

Code:
<Rules>
        <Rule Type="Any">data.id</Rule>
      </Rules>
      <Variables>
        <Variable Name="ContactID" Path="data.id">
          <Filter />
        </Variable>
        <Variable Name="FirstName" Path="data.first_name">
          <Filter />
        </Variable>
        <Variable Name="LastName" Path="data.last_name">
          <Filter />
        </Variable>
        <Variable Name="PhoneMobile" Path="data.primary_phone_number">
          <Filter />
        </Variable>
      </Variables>
 
  • Like
Reactions: edossantos
Status
Not open for further replies.

Latest Posts

Forum statistics

Threads
112,324
Messages
591,897
Members
165,475
Latest member
lastshadow