Salesforce integration

vaizal

Premier Customer
Joined
Feb 8, 2021
Messages
13
Reaction score
0
We are trying to setup CRM (Salesforce) integration thru 3cx Integration Wizard (by creating a template) and seems we are stuck on authorization part. We are setting it up using Oauth 2.0. The error we are receiving mentions 'expires_in'. In other threads I found that with other CRMs it should be replaced by the actual variable that CRM responds with duration of token validity. But as far as I understand Salesforce in the response does not return such value. Tried to adjust the xml. code to add a static value (for example 15min), but it fails to upload saying that the template structure is wrong. Any advices on how to make this work?
 
The integration is straightforward there is no need to modify the template. Ensure that you follow all steps as per guideline here and more specific be aware of the below:

1747727561862.png
 
in our configuration Require Secret for Web Server Flow and Require Secret for Refresh Token Flow is selected. PKCE is no selected, as it was optional. Should it be also selected?
 
in our configuration Require Secret for Web Server Flow and Require Secret for Refresh Token Flow is selected. PKCE is no selected, as it was optional. Should it be also selected?
No, you don't need that, it's optional. Are you having any issue doing the authorization? Please note that Salesforce takes up to 10 minutes to apply configuration changes, so if you adjusted the settings, you will need to wait a bit before running the authorization flow. If you still have issues after 10 minutes, share the error details so we can try to give you some pointers.
 
We I press authorize, I see this screen and refresh token is renewed
1747808828505.png

but when I press TEST and search by a phone number, I get the following screen
1747808833247.png

and here are the logs from 3cx:

Started scenario with empty id
Started Auth
Request text:
https://girtekaservicecloud.my.salesforce.com
Request form value refresh_token set to someRefreshToken
Request form value grant_type set to refresh_token
Request form value client_id set to someClientId
Request form value client_secret set to someClientSecret
Response text: ********
Response finished
Variable AccessToken set to someAccessToken
Variable ExpiresIn set to
System.FormatException: The input string '' was not in a correct format.
at System.Number.ThrowFormatException[TChar](ReadOnlySpan`1 value)
at System.Int32.Parse(String s)
at Integration.Crm.Engine.AuthScenarioProcessor.ProcessFinalResult(ProtocolScenario scenario, IValueManager valueManager)
at Integration.Crm.Engine.ScenarioProcessorBase.ProcessMatching(ProtocolScenario scenario, MatchingPath matching, ResponseMatcher responseMatcher, IValueManager customManager, SqlQueryParameter[] sqlQueryParameter, HashSet`1 distinctMatchings, CancellationToken token)
at Integration.Crm.Engine.ScenarioProcessorBase.ProcessFoundMatchings(ProtocolScenario scenario, IValueManager customManager, SqlQueryParameter[] sqlQueryParameter, List`1 matchings, ResponseMatcher responseMatcher, CancellationToken token)
at Integration.Crm.Engine.ScenarioProcessorBase.ProcessScenario(ProtocolScenario scenario, IValueManager customManager, SqlQueryParameter[] sqlQueryParameter, CancellationToken token)
at Integration.Crm.Engine.ScenarioProcessorBase.Execute(ProtocolScenario scenario, SqlQueryParameter[] sqlQueryParameter, CancellationToken token)
at Integration.Crm.Engine.ScenarioAuthHttpClientProvider.PerformScenarioIfNeeded(CancellationToken token)
at Integration.Crm.Engine.ScenarioAuthHttpClientProvider.Create(CancellationToken token)
at Integration.Crm.Engine.ScenarioProcessorBase.ProcessScenario(ProtocolScenario scenario, IValueManager customManager, SqlQueryParameter[] sqlQueryParameter, CancellationToken token)
at Integration.Crm.Engine.ScenarioProcessorBase.Execute(ProtocolScenario scenario, SqlQueryParameter[] sqlQueryParameter, CancellationToken token)
at Integration.Crm.Engine.CrmProcessor.GetContactInfoFromCrm(List`1 result, IEnumerable`1 scenariosToProcess, IValueManager customManager, SqlQueryParameter[] sqlQueryParameters, Func`2 filterResultsFunctor, Boolean exactMatch, CancellationToken token)
at Integration.Crm.Engine.CrmProcessor.GetContactInfo(String contactNumber, InteractionTypes interactionType, CancellationToken token)


few additional things to note:
  1. In the error client secret, id, access token, etc... are removed
  2. We are using custom developed rest api as we have a custom logic execution requirement in salesforce
 
The standard template SalesforceV2 doesn't use the variable ExpiresIn, so it seems you're using something custom here. You need to check how you're assigning this variable, from where you're reading the value.
 
Yes, as in the first message mentioned, we are using 3cx Integration Wizard to create a custom template for integration. The Wizard generates an XML code snippet where ExpiresIn variable is assigned to 'expires_in', but this value is not sent from Salesforce oauth 2.0
 
Yes, as in the first message mentioned, we are using 3cx Integration Wizard to create a custom template for integration. The Wizard generates an XML code snippet where ExpiresIn variable is assigned to 'expires_in', but this value is not sent from Salesforce oauth 2.0
Why use a custom template? Salesforce is included? If you need, just copy the XML and customize it from the base template. Don't do it all over.
 
Then you need to remove that part from the template. The CRM Wizard will generate a template with the most common OAuth2 variant, however the actual implementation might be different, so you will need to make changes. The output of this wizard is just a skeleton, that you will need to adjust and test properly.

If you need to create a new integration with Salesforce because you use different API methods, I would recommend you to start from the standard template, and not using the wizard. The standard template will give you the authentication part ready, then you can edit the rest.
 
Hello, thanks for help, step by step we are moving forward. One more question.
We know that by default the 3CX Salesforce V2 integration logs calls and creates Salesforce tasks after the call has ended, not upon receiving the call. We need to create task in salesforce when receive a call, not after call is ended.
Maybe it is possible to modify 3cx Salesforce V2 template? Any ideas and best practices?
Thanks!
 
Hello, thanks for help, step by step we are moving forward. One more question.
We know that by default the 3CX Salesforce V2 integration logs calls and creates Salesforce tasks after the call has ended, not upon receiving the call. We need to create task in salesforce when receive a call, not after call is ended.
Maybe it is possible to modify 3cx Salesforce V2 template? Any ideas and best practices?
Thanks!
You can do this, but you will not have all the information. When the call starts you just have the caller's number, not the extension of the agent receiving the call, or the call duration... You would need to edit the lookup scenarios, to chain the call journaling scenario after them, and also adjust the call journaling scenarios to remove the variables that you don't have....
 

Members Online Now

No members online now.

Forum statistics

Threads
111,831
Messages
589,277
Members
164,660
Latest member
RJenkinsROCK