SuiteCRM Integration: Has anybody done?

Status
Not open for further replies.

oguruma1218

Forum User
Joined
May 3, 2019
Messages
89
Reaction score
9
SuiteCRM has a RESTful API using OAuth2. From what I gather, there is no reason why it wouldn't work.

I've tried experimenting with the Template Generator, and I've given up.

I've spent hours basically plugging in every permutation of fields to map them correctly.

Has anybody ever dug up documentation on how to do this for SuiteCRM?

Does 3CX ever plan on adding support for it out of the box (without having to build the template yourself)? I believe it to be a pretty major player in the CRM space, so I am surprised it's not yet alreayd supported....
 
Integrating with SuiteCRM should be pretty straightforward. What does your template looks like right now?
 
Code:
<?xml version="1.0"?>
<Crm xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Country="US" Name="RMNCRM" 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="Client Credentials" Type="OAuth" Parent="General Configuration" Editor="String" Title="Refresh Token:" RequestUrl="http://mycrm.com/Api/V8/OAuth2" 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="http://mycrm.com/Api/access_token" MessagePasses="0" RequestContentType="application/x-www-form-urlencoded" RequestEncoding="UrlEncoded" RequestType="Post" ResponseType="Json">
        <PostValues>
         <!-- <Value Key="client_credentials" Passes="0" Type="String">[Client Credentials]</Value> -->
          <Value Key="grant_type" Passes="0" Type="String">client_credentials</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="" Type="REST">
      <Request SkipIf="" Url="http://mycrm.com/API/V8/module/Contacts?filter{{phone_mobile}}{{eq}}=[Number]" MessagePasses="0" RequestEncoding="UrlEncoded" RequestType="Get" ResponseType="Json" />
      <Rules>
        <Rule Type="Any">data.id</Rule>
      </Rules>
      <Variables>
        <Variable Name="ContactID" Path="data.id">
          <Filter />
        </Variable>
        <Variable Name="FirstName" Path="data.attributes.name">
          <Filter />
        </Variable>
        <Variable Name="PhoneBusiness" Path="data.attributes.phone_mobile">
          <Filter />
        </Variable>
      </Variables>
      <Outputs AllowEmpty="false">
        <Output Type="ContactID" Passes="0" Value="[ContactID]" />
        <Output Type="FirstName" Passes="0" Value="[FirstName]" />
        <Output Type="PhoneBusiness" Passes="0" Value="[PhoneBusiness]" />
        <Output Type="ContactUrl" Passes="0" Value="http://mycrm.com/API/V8/module/Contacts/?filter{{id}}{{eq}}=[ContactID]" />
      </Outputs>
    </Scenario>
  </Scenarios>
</Crm>
 
DM me. I might be able to help. I did multiple custom integrations.
 
As an update, when I try to "Test" the CRM install I get message :3CX Management console is not responding. This may be be a browser issue - Clear your browser cache, refresh and try again."
 
Can you test this from the CRM tool? You don't need to use the management console for testing, and you can also test other scenarios from the tool (call journaling).

What error do you get when you do the testing from the tool?
 
  • Like
Reactions: Evolute IT
In the CRM generator tool, under the "Parameter Values" seciton, there is only fields for Client ID and Client Secret. What does that mean? Am I not authenticating correctly?
 
In the CRM generator tool, under the "Parameter Values" seciton, there is only fields for Client ID and Client Secret. What does that mean? Am I not authenticating correctly?
Those are the parameters you added in your template.... You need to set a value for them, and then run the tests.
 
From a Contact Lookup

System.Exception: Server returned a non successful status code - HTTPStatusCode=InternalServerError - Reason=Internal Server Error - Content=
at CrmIntegration.ScenarioProcessorBase.ProcessRequest(ScenarioRequest request, IValueManager customManager, HttpClient client, CancellationToken token)
at CrmIntegration.ScenarioProcessorBase.ProcessScenario(ProtocolScenario scenario, IValueManager customManager, CancellationToken token)
at CrmIntegration.ScenarioProcessorBase.Execute(ProtocolScenario scenario, CancellationToken token)
at CrmIntegration.ScenarioAuthHttpClientProvider.PerformScenarioIfNeeded(CancellationToken token)
at CrmIntegration.ScenarioAuthHttpClientProvider.Create(CancellationToken token)
at CrmIntegration.ScenarioProcessorBase.ProcessScenario(ProtocolScenario scenario, IValueManager customManager, CancellationToken token)
at CrmIntegration.ScenarioProcessorBase.Execute(ProtocolScenario scenario, CancellationToken token)
at CrmIntegration.CrmProcessor.GetContactInfoFromCrm(String contactNumber, Boolean isInboundCall, String destinationEmail, Boolean createIfNotFound, CancellationToken token)
 
Internal Server Error is too generic. The server couldn't process the request you sent. This is probably a wrong request sent from you, which can't be properly processed by the server. More details should be available on the CRM server side.
 
As an update: I spun up a completely new VPS with a new SuiteCRM install.

Now, the 3CX template generator at least authenticates. I can see a token being made on the SuiteCRM side (and I can see that token in the Tempalte Generator) but it's still not "working".




Code:
System.Exception: Server returned a non successful status code - HTTPStatusCode=NotFound - Reason=Not Found - Content=<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL was not found on this server.</p>
</body></html>

   at CrmIntegration.ScenarioProcessorBase.ProcessRequest(ScenarioRequest request, IValueManager customManager, HttpClient client, CancellationToken token)
   at CrmIntegration.ScenarioProcessorBase.ProcessScenario(ProtocolScenario scenario, IValueManager customManager, CancellationToken token)
   at CrmIntegration.ScenarioProcessorBase.Execute(ProtocolScenario scenario, CancellationToken token)
   at CrmIntegration.CrmProcessor.GetContactInfoFromCrm(String contactNumber, Boolean isInboundCall, String destinationEmail, Boolean createIfNotFound, CancellationToken token)

The request response is
Code:
https://mycrm.com/API/V8/module/Contacts?filter[phone_mobile][eq]=4567890

And there is nothing in the response tree/variables.
 
As an update: I spun up a completely new VPS with a new SuiteCRM install.

Now, the 3CX template generator at least authenticates. I can see a token being made on the SuiteCRM side (and I can see that token in the Tempalte Generator) but it's still not "working".




Code:
System.Exception: Server returned a non successful status code - HTTPStatusCode=NotFound - Reason=Not Found - Content=<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL was not found on this server.</p>
</body></html>

   at CrmIntegration.ScenarioProcessorBase.ProcessRequest(ScenarioRequest request, IValueManager customManager, HttpClient client, CancellationToken token)
   at CrmIntegration.ScenarioProcessorBase.ProcessScenario(ProtocolScenario scenario, IValueManager customManager, CancellationToken token)
   at CrmIntegration.ScenarioProcessorBase.Execute(ProtocolScenario scenario, CancellationToken token)
   at CrmIntegration.CrmProcessor.GetContactInfoFromCrm(String contactNumber, Boolean isInboundCall, String destinationEmail, Boolean createIfNotFound, CancellationToken token)

The request response is
Code:
https://mycrm.com/API/V8/module/Contacts?filter[phone_mobile][eq]=4567890

And there is nothing in the response tree/variables.
You're getting a 404 Not Found error. That means that you're sending the HTTP request to a wrong URL. You need to check their API documentation to understand what you're doing wrong.
 
You're getting a 404 Not Found error. That means that you're sending the HTTP request to a wrong URL. You need to check their API documentation to understand what you're doing wrong.
Aha! I think I am close. When I change the URL to https://mycrm.com/Api/V8/module/Contacts?filter[phone_mobile][eq]=4567890

instead of API <-- Capital

I now get "
{
"meta": {
"message": "Request was successful, but there is no result"

},
"data": []
}

The problem is that I get this for Call Journal scenarios, too.
 
Last edited:
When you say "Wrong URL" I'm assuming you mean it's something to effect that it
From what you said, you're invoking:
https://mycrm.com/API/V8/module/Contacts?filter[phone_mobile][eq]=4567890

And you're getting back:
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL was not found on this server.</p>

So it looks like you're pointing to a wrong URL...
 
From what you said, you're invoking:
https://mycrm.com/API/V8/module/Contacts?filter[phone_mobile][eq]=4567890

And you're getting back:


So it looks like you're pointing to a wrong URL...

Yepp, looks like I had API instead of Api. Now I get the results below, even for call journaling scenarios.


{
"meta": {
"message": "Request was successful, but there is no result"

},
"data": []
}
 
If you need to send the full number instead of 7 digits as you're doing now, you can change the configuration from the 3CX Console > Advanced > Contacts > Options.
 
If you need to send the full number instead of 7 digits as you're doing now, you can change the configuration from the 3CX Console > Advanced > Contacts > Options.
I'm thinking there has to be something else going on, because even call journaling returns that same message.

Shouldn't a Call Journal call enter a Call into the CRM for a "New Contact," even if there no number matching?

At least that's how it worked when I used Zoho....
 
Call Journaling will not work if you don't have a matching contact. So you need to solve the issue with the contact lookup first.
 
  • Like
Reactions: Evolute IT
So, I have gotten the contact lookup solved. Now, with the Template Generator, the contact lookup returns the correct Contact in the CRM.

But, no contacts are being added to the CRM. And I get the same "3CX Management console is not responding. This may be be a browser issue - Clear your browser cache, refresh and try again." message when I try to test it in the PBX itself.
 
When you use the Test button, contacts are not added to 3CX. These are only added with real calls. Have you tried with real calls from external numbers?
 
Status
Not open for further replies.

Latest Posts

Forum statistics

Threads
111,990
Messages
590,161
Members
164,925
Latest member
batarong