We have recently refreshed our branding across our offerings and changed the names of our pricing plans. If you have signed up before Aug 9, 2021, please click Previous plans to view your applicable plans.
We assure you that this change will not impact your product experience, and no action is required on your part.


When a conversation is selected in the Inbox page, the Smart Plugs enabled in the Settings page are executed in order, in the context of the selected conversation.



The Smart Plugs are loaded in a separate pane on the right side. This provides contextual information to the agent about the current conversation.



Placeholders:

The following values are available for use in your Smart Plug script.

  1. {{user.email}} - Email of the current user
  2. {{user.phone}} - Phone number of the current user
  3. {{user.id}} - User Identifier provided from your app
  4. {{user.tag.key_of_usermeta}} - User meta value for the key provided in small snake case from your app. For example, if you send journey_id from your app, you can get the value for the same as {{user.tag.journey_id}} in the smart plug.


These placeholders are populated at dynamically when the script runs. 


Note of Caution

If no appropriate value is found for the placeholders, it will be replaced with an empty string.

     

Ajax Requests

Ajax requests to third-party sites cannot be made directly from the extensions since browsers reject requests not originating from the same domains (CORS). In order to get around , we provide a proxy to send such request.


Here is a skeleton proxy request.


$.ajax({
        method: "POST",
        url: "/app/extension_proxy",
        processData: false,
        data: JSON.stringify({
           url: "THIRD_PARTY_URL_HERE",
           method : "PUT",
           headers : {
              Authorization : "Basic AUTH_KEY_HERE",
              "Content-Type": "application/json"
           },
           formParameters : {},
           rawBody : '{"requestName" : "Sample PUT rquest","email":"{{user.email}}","phone":"{{user.phone}}"}'
        })
      })

   

Sample Script


<script>
  var makeRequest = function() {
    jQuery.ajax({
      method: "POST",
      url: "/app/extension_proxy",
      processData: false,
      data: JSON.stringify({
        header: { "Authorization": "Basic " + btoa('API KEY' + ":" + 'X') },
        url: "https://domian.freshdesk.com/api/v2/tickets/2",
        method : "GET"
      }),
      success: function(data) {
        console.log(data);
      },
    });
  };
  makeRequest();
</script>   


The body should be a JSON string containing the following:


AttributesDescription
url
The URL of the API
method
HTTP method for the API Call
headers
Optional headers to be passed to the API
formParameters
Use this for submitting form data with a POST request
rawBody
Raw string data for use with POST request


Note: processData needs to be set to false to prevent data from being treated as form parameters.