API Post missing custom variable since update to V18

Status
Not open for further replies.

Joshh

Free User
Joined
May 6, 2021
Messages
8
Reaction score
1
Hi All,

Prior to upgrading to V18 our CRM integration was working with no issues - After each call it hits our api and passes the below information, one key part being 'CustomerID'

Since V18, this is always blank/missing. The client is still hitting the api and doing a lookup, the response object is the same, template is the exact same but now the 'ContactID' object seems to not be being pulled through

Has something changed with this since V18 that would cause this to suddenly stop working? It went from 100% of all api hits including customerID, to 0% (Variable is there, but its just a blank string)

Variables being setup:
XML:
  <Variables>
        <Variable Name="ContactID" Path="customer.CustomerID">
          <Filter />
        </Variable>
        <Variable Name="FirstName" Path="customer.Details.Name">
          <Filter />
        </Variable>
        <Variable Name="LastName" Path="customer.Details.Surname">
          <Filter />
        </Variable>
        <Variable Name="Email" Path="customer.Details.Email">
          <Filter />
        </Variable>
        <Variable Name="PhoneMobile" Path="customer.Telephone">
          <Filter />
        </Variable>
      </Variables>

one of the Requests - Essentially the [Contact::ContactID] bit seems to be blank now, whereas before it would (Correctly) give the variable set. This template was not touched at all, only change was upgrading to V18


XML:
    <Scenario Id="ReportCall" Type="REST">
      <Request SkipIf="[ReportCallEnabled]!=True||[CallType]!=Inbound" Url="api url" MessagePasses="0" RequestContentType="application/json" RequestEncoding="Json" RequestType="Post" ResponseType="Json">
        <PostValues Key="">
          <Value Key="duration" Passes="1" Type="String">[Duration]</Value>
          <Value Key="phone" Passes="1" Type="String">[Number]</Value>
          <Value Key="agent" Passes="1" Type="String">[Agent]</Value>
          <Value Key="callType" Passes="1" Type="String">[CallType]</Value>
          <Value Key="DateTime" Passes="1" Type="String">[DateTime]</Value>
          <Value Key="CustomerID" Passes="1" Type="String">[Contact::ContactID]</Value>
          <Value Key="CallStart" Passes="1" Type="String">[CallStartTimeUTC]</Value>
          <Value Key="CallEnd" Passes="1" Type="String">[CallEndTimeUTC]</Value>
        </PostValues>
      </Request>
      <Variables />
      <Outputs Next="ReportCallMissed" AllowEmpty="true" />
    </Scenario>
 
In v18, there are no [Contact::XXXXXX] variables anymore. You need to return the outputs EntityId and EntityType during contact lookup / creation, and then you can access those values during Call Journaling with variables [EntityId] and [EntityType].

Please check the updated XML description here:
https://www.3cx.com/docs/server-side-crm-template-xml-description/
 
  • Like
Reactions: Evolute IT
Hey thanks for the speedy reply

Just to clarify, if i change the customerID line where it references [Contact::ContactID]

to [EntityId]


Ie if i edited my template to have the following would that do the trick? Or should i edit my JSON response from the API to have 'EntityID' and then not include it in Variables? and then just use the second XML section? ie just edit the Scenario(s)


XML:
 <Variables>
[B]        <Variable Name="EntityID" Path="customer.CustomerID">[/B]
          <Filter />
        </Variable>
        <Variable Name="FirstName" Path="customer.Details.Name">
          <Filter />
        </Variable>
        <Variable Name="LastName" Path="customer.Details.Surname">
          <Filter />
        </Variable>
        <Variable Name="Email" Path="customer.Details.Email">
          <Filter />
        </Variable>
        <Variable Name="PhoneMobile" Path="customer.Telephone">
          <Filter />
        </Variable>
      </Variables>


XML:
   <Scenario Id="ReportCall" Type="REST">
      <Request SkipIf="[ReportCallEnabled]!=True||[CallType]!=Inbound" Url="api url" MessagePasses="0" RequestContentType="application/json" RequestEncoding="Json" RequestType="Post" ResponseType="Json">
        <PostValues Key="">
          <Value Key="duration" Passes="1" Type="String">[Duration]</Value>
          <Value Key="phone" Passes="1" Type="String">[Number]</Value>
          <Value Key="agent" Passes="1" Type="String">[Agent]</Value>
          <Value Key="callType" Passes="1" Type="String">[CallType]</Value>
          <Value Key="DateTime" Passes="1" Type="String">[DateTime]</Value>
[B]          <Value Key="CustomerID" Passes="1" Type="String">[EntityID]</Value>[/B]
          <Value Key="CallStart" Passes="1" Type="String">[CallStartTimeUTC]</Value>
          <Value Key="CallEnd" Passes="1" Type="String">[CallEndTimeUTC]</Value>
        </PostValues>
      </Request>
      <Variables />
      <Outputs Next="ReportCallMissed" AllowEmpty="true" />
    </Scenario>
 
Hey thanks for the speedy reply

Just to clarify, if i change the customerID line where it references [Contact::ContactID]

to [EntityId]


Ie if i edited my template to have the following would that do the trick? Or should i edit my JSON response from the API to have 'EntityID' and then not include it in Variables? and then just use the second XML section? ie just edit the Scenario(s)


XML:
 <Variables>
[B]        <Variable Name="EntityID" Path="customer.CustomerID">[/B]
          <Filter />
        </Variable>
        <Variable Name="FirstName" Path="customer.Details.Name">
          <Filter />
        </Variable>
        <Variable Name="LastName" Path="customer.Details.Surname">
          <Filter />
        </Variable>
        <Variable Name="Email" Path="customer.Details.Email">
          <Filter />
        </Variable>
        <Variable Name="PhoneMobile" Path="customer.Telephone">
          <Filter />
        </Variable>
      </Variables>


XML:
   <Scenario Id="ReportCall" Type="REST">
      <Request SkipIf="[ReportCallEnabled]!=True||[CallType]!=Inbound" Url="api url" MessagePasses="0" RequestContentType="application/json" RequestEncoding="Json" RequestType="Post" ResponseType="Json">
        <PostValues Key="">
          <Value Key="duration" Passes="1" Type="String">[Duration]</Value>
          <Value Key="phone" Passes="1" Type="String">[Number]</Value>
          <Value Key="agent" Passes="1" Type="String">[Agent]</Value>
          <Value Key="callType" Passes="1" Type="String">[CallType]</Value>
          <Value Key="DateTime" Passes="1" Type="String">[DateTime]</Value>
[B]          <Value Key="CustomerID" Passes="1" Type="String">[EntityID]</Value>[/B]
          <Value Key="CallStart" Passes="1" Type="String">[CallStartTimeUTC]</Value>
          <Value Key="CallEnd" Passes="1" Type="String">[CallEndTimeUTC]</Value>
        </PostValues>
      </Request>
      <Variables />
      <Outputs Next="ReportCallMissed" AllowEmpty="true" />
    </Scenario>
Yes that should work. Remember to set the EntityId in the Output also.
 
  • Like
Reactions: edossantos
Status
Not open for further replies.

Latest Posts

Forum statistics

Threads
112,323
Messages
591,896
Members
165,473
Latest member
NathanMitchell