EsproCRM integration with 3cx

Status
Not open for further replies.

BigAndini

Customer
Joined
Aug 25, 2022
Messages
8
Reaction score
1
Hello,

I'm on the way to setup the CRM integration with the 3CX system for our EsproCRM. The EsproCRM system uses arrays within the url structure and it looks like the 3cx system uses these brackets to replace the variables. The URLs I would need are:

Code:
https://crm.example.com/api/v1/Contact/[ContactID]
https://crm.example.com/api/v1/Contact?maxSize=20&offset=0&orderBy=name&order=asc&where[0][type]=equals&where[0][attribute]=emailAddress&where[0][value][email protected]&select=id,firstName,phoneNumber,emailAddress
https://crm.example.com/api/v1/Contact?select=id,firstName,phoneNumber,emailAddress,Company&maxSize=20&offset=0&orderBy=name&order=asc&where[0][type]=equals&where[0][attribute]=phoneNumber&where[0][value]=0123456789

I've replaced the email address [email protected] with and the phone number with [Number]. Within my webserver log I see all values in brackets missing.

Is there a way to escape the brackets I really need for the request to not replace them by the variable mathing system or am I able to define the metacharacter to recognize variables on my own? I would rather go for these brackets: {Number}. Or even a more save way which is not used by systems in urls very often and mark variables by @@@Number@@@.

I'm happy to get some ideas on how to solve this.

Best Regards,
Andi
 
Simply use {{ }} in the URL instead of [ ], since those brackets are for variables.
 
I'm not sure if that's correct. I see the url like this in the url field after I've saved it: https://crm.sixhop.net/api/v1/Contact?select=id,firstName,phoneNumber,emailAddress,Company&maxSize=20&offset=0&orderBy=name&order=asc&where[0][type]=equals&where[0][attribute]=phoneNumber&where[0][value]={ {Number} }

I tried to remove the spaces, but that's not possible.

When doing the test request I see this in the Request/Response Tab of the 3CX CRM Integration tool: https://crm.sixhop.net/api/v1/Contact?select=id,firstName,phoneNumber,emailAddress,Company&maxSize=20&offset=0&orderBy=name&order=asc&where=equals&where=phoneNumber&where={ {Number} }

That's not the URL I've provided and that's not the URL my CRM can understand. So where do the brackets get lost?
 
  • Like
Reactions: N_G
So within the webservers log I see this in the request:

/api/v1/Contact?select=id,firstName,phoneNumber,emailAddress,Company&maxSize=20&offset=0&orderBy=name&order=asc&where%7B%20%7B0%7D%20%7D%7B%20%7Btype%7D%20%7D=equals&where%7B%20%7B0%7D%20%7D%7B%20%7Battribute%7D%20%7D=phoneNumber&where%7B%20%7B0%7D%20%7D%7B%20%7Bvalue%7D%20%7D=4567890

With an urldecode it's possible to see this:
/api/v1/Contact?select=id,firstName,phoneNumber,emailAddress,Company&maxSize=20&offset=0&orderBy=name&order=asc&where{ {0} }{ {type} }=equals&where{ {0} }{ {attribute} }=phoneNumber&where{ {0} }{ {value} }=4567890

So what I need is this:
/api/v1/Contact?select=id,firstName,phoneNumber,emailAddress,Company&maxSize=20&offset=0&orderBy=name&order=asc&where[0][type]=equals&where[0][attribute]=phoneNumber&where[0][value]=4567890

How is it possible to achieve that?

Kind Regards,
Andi
 
Why are there space between the two {{ ?
 
I don't know. I copy them in there without spaces and once it's running the spaces are in there.
 
You're right, yeah! So within the wizard the URLs get those spaces which are not really helpful. When I change the urls within the crm integration tool for the scenarios search by phone number and search by email, then I'm successfully able to get the results I expect.

For EsproCRM that is right now:
https://crm.example.com/api/v1/Contact?select=salutationName,firstName,lastName,middleName,name,emailAddressIsOptedOut,emailAddress,emailAddressData,uRL,phoneNumberIsOptedOut,phoneNumber,phoneNumberData,description,doNotCall,createdById,createdByName,modifiedAt,modifiedById,modifiedByName,salutationName,firstName,lastName,middleName,name,emailAddressIsOptedOut,emailAddress,emailAddressData,uRL,phoneNumberIsOptedOut,phoneNumber,phoneNumberData,description,doNotCall,createdById,createdByName,modifiedAt,modifiedById,modifiedByName&maxSize=20&offset=0&orderBy=createdAt&order=desc&where{{0}}{{type}}=contains&where{{0}}{{attribute}}=emailAddress&where{{0}}{{value}}=

https://crm.example.com/api/v1/Contact?select=salutationName,firstName,lastName,middleName,name,emailAddressIsOptedOut,emailAddress,emailAddressData,uRL,phoneNumberIsOptedOut,phoneNumber,phoneNumberData,description,doNotCall,createdById,createdByName,modifiedAt,modifiedById,modifiedByName,salutationName,firstName,lastName,middleName,name,emailAddressIsOptedOut,emailAddress,emailAddressData,uRL,phoneNumberIsOptedOut,phoneNumber,phoneNumberData,description,doNotCall,createdById,createdByName,modifiedAt,modifiedById,modifiedByName&maxSize=20&offset=0&orderBy=createdAt&order=desc&where{{0}}{{type}}=contains&where{{0}}{{attribute}}=phoneNumber&where{{0}}{{value}}=[Number]

For the variable assignment it's needed to get the fields out of there like this:
id: list.id
FirstName: list.firstName
LastName: list.lastName
Number: list.phoneNumber
Email: list.emailAddress

Thank you, that brings me a step forward and maybe the next one who searches to integrate EsproCRM with 3CX as well. :)

Regards,
Andi
 
  • Like
Reactions: Evolute IT
It seems there is a bug in the Wizard, which is adding those spaces. We will have to check it. But if you edit the template after the wizard completes, looks like you're getting the required changes....
 
  • Like
Reactions: Evolute IT
I'm a step further in the integration of 3CX with EsproCRM. Now it's possible to call 3CX and the request to the CRM can be seen in the access_log of the CRM. A test request to the CRM is also working and gives according vaiables like these:

Variable ContactID set to 62750ce50fda547e8
Variable FirstName set to Andi
Variable LastName set to Nitsche

However in the 3CX client on my Desktop I don't get the FirstName and LastName displayed when I call. However only my number is getting displayed in the client.

What I see is that as variable PhoneBusiness in the CRM test request I see the land line number while I'm calling from my mobile, is this a problem and 3CX double checks which number is registered to the PhoneBusiness variable?

Is there maybe even some possibility to configure which fields of the CRM call should be displayed in which way? It would be really awesome to not only get the name of the person, but also include the company name from EsproCRM into the caller id to display in the client.

Thank you for any ideas on that. :)

Kind Regards,
Andi
 
You could concatenate the first and last name and set firstname as that then use lastname for company name
 
In the first place I need to manage it somehow that the 3CX clients will display the CRM contacts in any way. Once that is done I can think of how to concatenate the information to push them into the fields that are displayed.

If somebody has an idea why the requested CRM information is not displayed within the client, that would be awesome. I do have absolutely no clue where to start debugging. :)

Kind Regards,
Andi
 
In the first place I need to manage it somehow that the 3CX clients will display the CRM contacts in any way. Once that is done I can think of how to concatenate the information to push them into the fields that are displayed.

If somebody has an idea why the requested CRM information is not displayed within the client, that would be awesome. I do have absolutely no clue where to start debugging. :)

Kind Regards,
Andi
DM me and we'll see if we can help you with this one.
 
We would need to see the template and the 3cxSystemService.log file in verbose mode to understand what's going on. In order to consider the CRM response a valid match, it needs to provide at least:
- The First Name, Last Name or Company Name.
- A phone field matching the caller's number.
- The Contact URL.

If any of this is not present, then the record returned by the CRM is discarded, and you will not see anything on the 3CX client display.
 
It's been quite a time this project stuck on our side.

It is a bit strange. When I build up the url to search for the right contact in Espro CRM, I can provide my mobile number, however my mobile number is not the main number in this contact and therefore is not responded by the CRM system.

The right contact id is responded by the system.

So when I request the the whole contact there is not just one field with the phone number but a phoneNumberData array which is structured like this:

"phoneNumberData": [
{
"phoneNumber": "089123456789",
"type": "Office",
"primary": true,
"optOut": false,
"invalid": false
},
{
"phoneNumber": "0176123456789",
"type": "Mobile",
"primary": false,
"optOut": false,
"invalid": false
}
],

How is it possible to let the 3CX system request the whole contact and let it check all numbers within this array to match it to the contact again to display the right name?

Regards,
Andi
 
It's been quite a time this project stuck on our side.

It is a bit strange. When I build up the url to search for the right contact in Espro CRM, I can provide my mobile number, however my mobile number is not the main number in this contact and therefore is not responded by the CRM system.

The right contact id is responded by the system.

So when I request the the whole contact there is not just one field with the phone number but a phoneNumberData array which is structured like this:

"phoneNumberData": [
{
"phoneNumber": "089123456789",
"type": "Office",
"primary": true,
"optOut": false,
"invalid": false
},
{
"phoneNumber": "0176123456789",
"type": "Mobile",
"primary": false,
"optOut": false,
"invalid": false
}
],

How is it possible to let the 3CX system request the whole contact and let it check all numbers within this array to match it to the contact again to display the right name?

Regards,
Andi
Yes, check the ethalon matching rules in the XML docs. Also, you can look at ConnectWise template to see how it's implemented.
 
  • Like
Reactions: edossantos
Status
Not open for further replies.

Latest Posts

Forum statistics

Threads
111,973
Messages
590,075
Members
164,895
Latest member
jasonkkrause