Zammad 3CX XML test works but contact number does not exist

Status
Not open for further replies.

THordijk

Forum User
Joined
Aug 5, 2019
Messages
27
Reaction score
6
Hello,

I am working on intergrating Zammad and 3CX. I used the template generator and am able to upload it to our 3CX envirnoment.
When testing the XML with a phone number only the last 6 digits entered are used in the search query.
Entering a propper phone number results in an empty response. For testing I added an account with a phone number consisting of only 6 digits.
The contact is returned, including the following statement: "CRM Integration is working OK but contact number does not exist. Check log for more info or try a different number."

The field below shows the following:

Started scenario with empty id

Request text: http://tickets.riwo.eu/api/v1/users/search?query=123457

Response text: [{"id":311,"organization_id":null,"login":"[email protected]","firstname":"test","lastname":"gebruiker","email":"[email protected]","image":null,"image_source":null,"web":"","phone":"123457","fax":"","mobile":"123458","department":"","street":"","zip":"","city":"","country":"","address":"","vip":false,"verified":false,"active":true,"note":"","last_login":null,"source":null,"login_failed":0,"out_of_office":false,"out_of_office_start_at":null,"out_of_office_end_at":null,"out_of_office_replacement_id":null,"preferences":{"locale":"nl-nl"},"updated_by_id":110,"created_by_id":110,"created_at":"2019-10-04T14:08:52.220Z","updated_at":"2019-10-04T14:08:52.220Z","role_ids":[3],"organization_ids":[],"authorization_ids":[],"group_ids":{}}]

Response finished

Finished scenario with empty id


It is unclear to me why only the last 6 digits of the phone number are passed in the request. It is also unclear to me how this will function when a customer calls, could this be explained?
Also how can the intergration be working propperly but the number does not exist, however it is able to return the proper information?
 
Hello @THordijk,

When testing the XML with a phone number only the last 6 digits entered are used in the search query.
You can configure this from the 3CX Console > Advanced > Contacts > Options. If you choose "Match Exactly" the full number will be sent.

Entering a propper phone number results in an empty response. For testing I added an account with a phone number consisting of only 6 digits.
The contact is returned, including the following statement: "CRM Integration is working OK but contact number does not exist. Check log for more info or try a different number."

The field below shows the following:

Started scenario with empty id

Request text: http://tickets.riwo.eu/api/v1/users/search?query=123457

Response text: [{"id":311,"organization_id":null,"login":"[email protected]","firstname":"test","lastname":"gebruiker","email":"[email protected]","image":null,"image_source":null,"web":"","phone":"123457","fax":"","mobile":"123458","department":"","street":"","zip":"","city":"","country":"","address":"","vip":false,"verified":false,"active":true,"note":"","last_login":null,"source":null,"login_failed":0,"out_of_office":false,"out_of_office_start_at":null,"out_of_office_end_at":null,"out_of_office_replacement_id":null,"preferences":{"locale":"nl-nl"},"updated_by_id":110,"created_by_id":110,"created_at":"2019-10-04T14:08:52.220Z","updated_at":"2019-10-04T14:08:52.220Z","role_ids":[3],"organization_ids":[],"authorization_ids":[],"group_ids":{}}]

Response finished

Finished scenario with empty id


It is unclear to me why only the last 6 digits of the phone number are passed in the request. It is also unclear to me how this will function when a customer calls, could this be explained?
Also how can the intergration be working propperly but the number does not exist, however it is able to return the proper information?
The template is probably not generating the outputs needed to consider the response valid. I would need to see the template to spot what's missing. Can you share it here?

Thanks.
 
Hello @edossantos,

Thank you for the quick reply.

You can configure this from the 3CX Console > Advanced > Contacts > Options. If you choose "Match Exactly" the full number will be sent.

Aah okay thank you for the information.

I'll attach the template, thank you for taking the energy to look in to this.
 

Attachments

The lookup scenario has the following rule to identify records:
XML:
<Rules>
    <Rule Type="Any">ContactId</Rule>
</Rules>

However, the response doens't have the item ContactId. Instead, it has the "id" at the beginning of the JSON response, so probably you will want to change that.

The same happens with the Contact ID variable, which is taken from the same value, and it doesn't exist:
XML:
<Variable Name="ContactID" Path="ContactId">
  <Filter />
</Variable>

Please try adjusting that.
 
The lookup scenario has the following rule to identify records:
XML:
<Rules>
    <Rule Type="Any">ContactId</Rule>
</Rules>

However, the response doens't have the item ContactId. Instead, it has the "id" at the beginning of the JSON response, so probably you will want to change that.

The same happens with the Contact ID variable, which is taken from the same value, and it doesn't exist:
XML:
<Variable Name="ContactID" Path="ContactId">
  <Filter />
</Variable>

Please try adjusting that.


Thank you, I had been looking into this but it did not fully click with me. I now get the proper repsonses no errors and all correct information. Thanks again!
 
Last edited:
  • Like
Reactions: edossantos
Hello,

Maybe a bit dumb of a "follow up" question.

In a video from 2016,
, an example is shown of integrating a crm with 3CX. He makes use of integration defined per person. This is now a legacy option.

The part that I am curious about is when he speaks about restarting their 3CX clients or even rebooting the entire computer.

Does the implementation of the CRM intergation require a restart of our 3CX phone server?
The reason why I am asking is because i have not been able to notice any change since uploading the XML template.
 
Does the implementation of the CRM intergation require a restart of our 3CX phone server?
No, that video is for the old client side integrations. Now that has been deprecated for most CRMs, and moved to server side. There is no need to restart anything now.

The reason why I am asking is because i have not been able to notice any change since uploading the XML template.
Please, enable verbose logs from the 3CX Console > Dashboard > Activity Log > Settings. Then make a test call and check the 3cxSystemService.log file, so you can see if the integration is working or any error is being logged.

Also, please note that you need to be using the 3CX Web Client in order to get contact popups.
 
Hi thanks for the reply.

Also, please note that you need to be using the 3CX Web Client in order to get contact popups.
So the integration as shown in the video using the application is no longer possible?

Please, enable verbose logs from the 3CX Console > Dashboard > Activity Log > Settings. Then make a test call and check the 3cxSystemService.log file, so you can see if the integration is working or any error is being logged.

I will test this after the weekend
 
So the integration as shown in the video using the application is no longer possible?
No, the client side approach has been deprecated. We use it only to integrate systems that are not web based, like Outlook or DATEV. However, new integrations should use the server side approach via templates.
 
Okay thanks for the quick reply!
 
Hello,
Please, enable verbose logs from the 3CX Console > Dashboard > Activity Log > Settings. Then make a test call and check the 3cxSystemService.log file, so you can see if the integration is working or any error is being logged.

I preformed the verbose logging however the file is not as clear to me. From what I understand the integration is not working when logging is set to low. If i understand it correctly, it states that the xml template can not be found.

Code:
019/10/14 08:20:57.283|1028|0008|Erro|Unable to load CRM template C:\ProgramData\3CX\Instance1\Data\Http\Templates\crm\ZammadRiwo.xml. Error: System.InvalidOperationException: There is an error in XML document (115, 7). ---> System.Xml.XmlException: Data at the root level is invalid. Line 115, position 7.
   at System.Xml.XmlTextReaderImpl.Throw(Exception e)
   at System.Xml.XmlTextReaderImpl.Throw(String res, String arg)
   at System.Xml.XmlTextReaderImpl.ParseRootLevelWhitespace()
   at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
   at System.Xml.XmlTextReaderImpl.Read()
   at System.Xml.XmlTextReader.Read()
   at System.Xml.XmlReader.ReadEndElement()
   at System.Xml.Serialization.XmlSerializationReader.ReadEndElement()
   at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderCrmIntegrationTemplate.Read32_CrmIntegrationTemplate(Boolean isNullable, Boolean checkType)
   at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderCrmIntegrationTemplate.Read33_Crm()
   --- End of inner exception stack trace ---
   at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
   at System.Xml.Serialization.XmlSerializer.Deserialize(Stream stream)
   at CrmIntegration.CrmTemplateFuncs.Read(Stream stream)
   at CrmIntegration.CrmTemplateProvider.GetAll().



The integration does seem to work when verbose logging is enabled however it is unable to find the phone number. I included a redacted version of the log file, would it be possible for you to confirm this?
the number as received by 3CX starts with 316 however zammad has the number saved as a 06 number.
Code:
2019/10/14 08:22:23.164|1028|0028|Info|CRM: making request to CRM. Number=Phone number
2019/10/14 08:22:23.165|1028|0028|Verb|Removed from processing. Number=Phone number
2019/10/14 08:22:23.165|1028|0028|Info|CRM: processing of Phone number has been finished
 

Attachments

Hello,


I preformed the verbose logging however the file is not as clear to me. From what I understand the integration is not working when logging is set to low. If i understand it correctly, it states that the xml template can not be found.

Code:
019/10/14 08:20:57.283|1028|0008|Erro|Unable to load CRM template C:\ProgramData\3CX\Instance1\Data\Http\Templates\crm\ZammadRiwo.xml. Error: System.InvalidOperationException: There is an error in XML document (115, 7). ---> System.Xml.XmlException: Data at the root level is invalid. Line 115, position 7.
   at System.Xml.XmlTextReaderImpl.Throw(Exception e)
   at System.Xml.XmlTextReaderImpl.Throw(String res, String arg)
   at System.Xml.XmlTextReaderImpl.ParseRootLevelWhitespace()
   at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
   at System.Xml.XmlTextReaderImpl.Read()
   at System.Xml.XmlTextReader.Read()
   at System.Xml.XmlReader.ReadEndElement()
   at System.Xml.Serialization.XmlSerializationReader.ReadEndElement()
   at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderCrmIntegrationTemplate.Read32_CrmIntegrationTemplate(Boolean isNullable, Boolean checkType)
   at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderCrmIntegrationTemplate.Read33_Crm()
   --- End of inner exception stack trace ---
   at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
   at System.Xml.Serialization.XmlSerializer.Deserialize(Stream stream)
   at CrmIntegration.CrmTemplateFuncs.Read(Stream stream)
   at CrmIntegration.CrmTemplateProvider.GetAll().



The integration does seem to work when verbose logging is enabled however it is unable to find the phone number. I included a redacted version of the log file, would it be possible for you to confirm this?
the number as received by 3CX starts with 316 however zammad has the number saved as a 06 number.
Code:
2019/10/14 08:22:23.164|1028|0028|Info|CRM: making request to CRM. Number=Phone number
2019/10/14 08:22:23.165|1028|0028|Verb|Removed from processing. Number=Phone number
2019/10/14 08:22:23.165|1028|0028|Info|CRM: processing of Phone number has been finished


so this is no longer relevant. I have been able to confirm the connection from 3cx to zammad.

What happens now is that the Zammad database is opened en it shows the proper contact info. However as I understood it, it should provide options such as create a ticket and such. Contact info is not shown in 3CX.

Or did i misunderstand the possibilities provided by the integration?

I understand that there are two sides to the integration and will also look into this at the zammad side.
 
Last edited:
so this is no longer relevant. I have been able to confirm the connection from 3cx to zammad.

What happens now is that the Zammad database is opened en it shows the proper contact info. However as I understood it, it should provide options such as create a ticket and such. Contact info is not shown in 3CX.

Or did i misunderstand the possibilities provided by the integration?

I understand that there are two sides to the integration and will also look into this at the zammad side.

Integration is working just fine,. have found my issue. Thanks for all the help!
 
What was your solution? Can you post your project?
 
Full disclosure, I have not tested this yet but following simple logic this should be the solution to my problem. In the XML template i had a query to the database specified. I changed this to the actual page of the contact so that this would be opened. I will upload a faulty and a correct xml template so the difference will be clear, see line 55.

If you intend on using the template you should replace [Your Zammad Url] with your zammad url. Also, I placed an asterisk at the number search querry. For zammad this translates as "anything", https://user-docs.zammad.org/en/latest/advanced/search.html.

I set the numbers used by 3cx to 9. Setting this allows 3cx to querry the last 9 digits including anything that came before that.

Hope it helps!
 

Attachments

  • Like
Reactions: Nico! and autohaus
Update:

The change to no longer refer to the database did not resolve the issue. 3CX is still opening the database and showing sql statements. I am uncertain how to procede. The integration is working wel when testing it. The returned contact url provides the proper page when copied and pasted in the url bar. Does 3CX not use the contacturl, line 55 in the template, when opening a new tab?

No, that video is for the old client side integrations. Now that has been deprecated for most CRMs, and moved to server side. There is no need to restart anything now.
Also I would like to reissue the restarting question. We do not see any changes when selecting a different template, or even disabling any integration. After the first restart the integration started working in the manner it does now. So that seems like strange behaviour if it should not be necessary.
 
In order to get the contact popup, you need to be using the 3CX Web Client. When you have the 3CX Web Client and receive a call from a matched contact, the Web Client will open the Contact URL in a new browser tab. You can control this from the 3CX Web Client > Settings > Integration.

Regarding services restart, it is not necessary, changes to the template are applied immediately. However, if you have contacts that were synchronized with a previous version of the template, and there are old links in 3CX Contacts, these will not be removed. You might need to Delete CRM Contacts when you want to start from scratch with a new version of the template.
 
In order to get the contact popup, you need to be using the 3CX Web Client. When you have the 3CX Web Client and receive a call from a matched contact, the Web Client will open the Contact URL in a new browser tab. You can control this from the 3CX Web Client > Settings > Integration.
So as i said, i do get a form of pop-up but not the contact url, the database page of the respective contact is opened immediately. the template as i am using it is uploaded in one of my earlier posts, the contact url is configured properly in the template but it does not work.

Regarding services restart, it is not necessary, changes to the template are applied immediately. However, if you have contacts that were synchronized with a previous version of the template, and there are old links in 3CX Contacts, these will not be removed. You might need to Delete CRM Contacts when you want to start from scratch with a new version of the template.
Would this mean deleting at CRM side or ate 3CX side?
 
Delete the contacts from the 3CX side, because you might have old contacts from a previous run, that might be causing this. Go to the 3CX Console > Advanced > Contacts > Delete CRM Contacts. Then test again and check if you experience the same behaviour.
 
Status
Not open for further replies.

Latest Posts

Forum statistics

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