Giter Site home page Giter Site logo

freescout-sidebar-webhook's Introduction

FreeScout Sidebar Webhook

Sidebar Webhook asynchronously injects HTML from your server into conversation sidebars.

This screenshot shows what it does: you can load any content on a per-customer, per-message basis from your own web server, asynchronously, every time a conversation is loaded on the screen.

In this picture, the kittens and text were loaded from an external server based on the customer's email address.

with title without title

Use cases

  • Directly link to your customer management system
  • Show details about order status live from your fulfillment system
  • Quickly ship changes to your FreeScout system UI without updating modules
  • Connect to backends using PHP/Node.js/Ruby/Perl/Rust/Go/Bash/Haskell and even Java

Installation

These instructions assume you installed FreeScout using the recommended process, the "one-click install" or the "interactive installation bash-script", and you are viewing this page using a macOS or Ubuntu system.

Other installations are possible, but not supported here.

  1. Download the latest release of FreeScout Sidebar Webhook.
  2. Unzip the file locally.
  3. Copy the folder into your server using SFTP. (ℹī¸ Folder is renamed in this process.)
    scp -r ~/Downloads/freescout-sidebar-webhook [email protected]:/var/www/html/Modules/SidebarWebhook/
  4. SSH into the server and update permissions on that folder.
    chown -r www-data:www-data /var/www/html/Modules/SidebarWebhook/
  5. Access your admin modules page like https://freescout.example.com/modules/list.
  6. Find Sidebar Webhook and click ACTIVATE.
  7. Configure the webhook URL in the mailbox settings. The webhook secret is optional and will be sent as part of the payload if set.
  8. After everything works, purchase a license code by sending USD 10 at https://www.paypal.com/paypalme/fulldecent/10usd

Your webhook server

Your webhook server will receive a POST request with this kind of JSON body:

{
    "conversationSubject": "Testing this sidebar",
    "conversationType": "Phone",
    "customerEmail": "[email protected]",
    "customerPhones": [{
	    "n": "",
      "type": 1,
      "value": ""
    }],
    "mailboxId": 1,
    "secret": "0C7DA918-E72C-47B2-923B-0C5BB6A6104E"
}

Your webhook server shall respond with content to be injected into the sidebar. The document should be a complete, well-formed HTML document like so:

<html>
    <body>
        <h1>Hello world</h1>
    </body>
</html>

You can optionally set a title in the document and it will be used as the panel title in the sidebar:

<html>
    <head>
        <title>My panel title</title>
    </head>
    <body>
        <h1>Hello world</h1>
    </body>
</html>

Setting CORS headers is not required, as the document is requested by the FreeScout server (not by the user's browser).

Project scope

Our goal is to have a very simple module to allow vast extensibility in the conversation sidebar.

Anything that makes it simpler (removes unneded code) or more extensible for most people (adding a couple post parameters in boot()) will be a welcome improvement.

Troubleshooting

Hints

  • Class "Modules\SidebarWebhook\Providers\SidebarWebhookServiceProvider" not found

    Did you rename the folder as per step 3?

If something is not working, please try these steps so we can see what's wrong.

  1. Update FreeScout to the latest version (even if the new version doesn't have any relevant changes, the process of updating can sometimes fix problems that would prevent freescout-sidebar-webhook from running).
  2. Use chown -r to ensure the module has the same owner/permissions as other files in your FreeScout installation.
  3. Try to disable and reenable freescout-sidebare-webhook from your system/modules page.
  4. To confirm the module file is actually activated and readable you might add a line like this above the private const MODULE_NAME line. The code to add is: file_put_contents("/tmp/sidebartmp", "is running"); And then you can confirm it is running by seeing if that file is created when you load the page.
  5. Next check for system logs. It will be helpful to note any warnings, errors or notices as they may instruct where the problem is coming from.
  6. Check your PHP version, is it a version supported by FreeScout?

After you have checked all these things, please create an issue and detail how you tried each of these steps.

Inspiration

freescout-sidebar-webhook's People

Contributors

cweagans avatar fulldecent avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

freescout-sidebar-webhook's Issues

Spinner keeps spinning when request fails

Hi,

Can you add

.fail(function() { $("#swh-content").html(""); });;

To Resources/views/partials/sidebar.blade.php

This prevents the spinner to keep spinning when the result fails (server not responding, authentication fails or cross side include is not set properly)

Error when activating Module

Hi. I get an error message when I want to run the module. The error message is as follows:

Cache cleared successfully.
Nothing to migrate.
Error occurred creating [/usr/home/xzihen/domains/DOMAIN.pl/public_html/public/modules/sidebarwebhook] symlink: symlink(): No such file or directory
The [/usr/home/xzihen/domains/DOMAIN.pl/public_html/public/modules/sidebarwebhook] symlink has been created
Clearing cache...
The compiled services & packages files have been removed.
Cache cleared successfully.
Compiled views cleared!
Configuration cache cleared!
Configuration cached successfully!
Created: storage/app/public/js/vars.js

I installed the module according to your instructions. Please help me to run the plugin ;)

Email wrong when first sent from FS

When a new ticket is created, customerEmail in the payload becomes the SENDING email address instead of the receiving.

I added
'fromEmail' => $conversation->cc,
to SidebarWebhookServiceProvider.php (line 22), to allow checking of which email to use on the page being loaded.

Or should a more "proper" fix be implemented?

symlink(): No such file or directory

When trying to install on a fresh FreeScout installation on Ubuntu 20 I get:

Error occured creating [/home/xx/freescout/public/modules/sidebarwebhook] symlink: symlink(): No such file or directory The [/home/xx/freescout/public/modules/sidebarwebhook] symlink has been created

At the top it says ""Sidebar Webhook" module successfully activated!" but when I reload the modules page, I can still activate it (and when viewing tickets, nothing is shown).

Sidebar not showing response

Hi. I've got a webhook server that responds like below, but the Sidebar just shows the spinning wheel. I can see that the webhook is being called correctly by the module when the page is refreshed. Is there something wrong with the response?

HTTP/1.1 200 OK
Date: Fri, 16 Dec 2022 03:08:27 GMT
Content-Type: text/html; charset=utf-8
Content-Length: 61
Connection: close
ETag: W/"3d-EK/W/9EWAW443F9YV+Et31YXkjQ"
Vary: Accept-Encoding
Strict-Transport-Security: max-age=31536000; includeSubDomains

<h4>Items:</h4><li>[49] cmp-11</li><li>[270] cmp-13</li><br>

Get rid of CSFR-Warnings

I wan't to include content from a different subdomain as the freescout installation but I only get the spinner and the error, that the content was blocked:

Access to XMLHttpRequest at 'https://abc.xyz.com/index.php' from origin 'https://helpdesk.xyz.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

I tried to find a workaround but wasn't successful. Is there any documentation on how to get rid of this issue?

Thanks!

Module activated but no sign of sidebar running.

  • Creating this issue as per our email convos*

We have installed and activated the module using the installation guide, however we are not seeing the loading graphic on the page.

Also,the file /tmp/sidebartmp is not getting created.

Caching?

Hi,
This looks very interesting. Have you considered adding caching so that the same info isn't fetched repeatedly in a short time interval? (e.g. Cache for 30 minutes).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤ī¸ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.