Creating a client from Ebay notifications

Created: 2018-08-07
Last updated: 2018-08-07

Post view count: 63

Ebay is a well known global server for online auctions. Thanks to Ebay you can sell and buy everything.

If you're a seller and you have an Ebay account, you can easily transfer your Ebay notifications to Sugester and create clients based on them. It makes it easier to monitor your sales and keep in touch with a client, also when the selling process is finished.

Transfering Ebay notifications enable:
  • creating a client in Sugester before purchasing products (if he/she makes an inquery)
  • updating client's data in next steps of selling
  • keeping sensitive data about payment in the system

Thanks to integration you will receive information about 3 steps of Ebay shopping:
A) order, B) purchase and C) payment confirmation

A) order - Sugester recognises message with email address @members.ebay, saves a Nick from email content and adds new client to the system. Based on Nick we define ID, and with ID we're locating client's data in Sugester. You can see client's ID in his/her profile.

B) purchase - Sugester recognises a message with @ebay email address and saves an email address, in most cases also full user's name, which is usually a name and a last name 

C) payment confirmation - Sugester recognises such emails with @paypal address and saves: full user's name, email, and (in most cases) Nick. If Ebay's email address is different than Paypal's, system will save both addresses in client's profile.

Settings in Sugester

To enable this feature:

1. In Ebay account settings type the email address for notifications. Next, if it's not an email box with sugester.com domain, add this email box to Sugester and enable emails  forwarding, so you could see all your emails from this email box in your Sugester's account. 

2. Login to your Sugester's account, go to Settings > Automation > Filters and create following filters:

A) for non-selling message

Filter name - type the name, eg. Ebay add client - non-selling message

Action - select Action on change at tasks/emails

Conditions script - paste the script:

(/@members.ebay/).test(post.email)

Action script - paste the script:

var login = document <br/>
.querySelector('#PrimaryMessage > tr > td > h1 > a')
.innerText();
var matched = (/^(.*)\(.*\)$/).exec(login);
if(matched){
login = matched[1];
var external_id = "ebay-" + login;
var cc = Sugester.find_or_create_client_and_contact({external_id: external_id, now: true, skip_update: true});
client = cc[0];
if(!client) {
cc = Sugester.find_or_create_client_and_contact({external_id: external_id, name: login, now: true}); client = cc[0];
}
Sugester.update_post(post.id, {client_id: client.id});
}


B) for selling message

Filter name - write a name, eg. Ebay add client - selling message

Action - select Action on change at tasks/emails

Conditions script - paste the script:

(/@ebay/).test(post.email)

Action script - paste the script

      var $email = document
      .querySelector('tr > td > div > table > tr > td.noWrap > font > a[href^="mailto:"]');
    var login = $email
      .parent()
      .childNodes()[0]
      .innerText();
    login = login.substring(0, login.length-2);
    var external_id = "ebay-" + login;

    var name = $email
      .parent().parent().parent().parent().parent().parent().parent()
      .previousElementSibling().children()[1]
      .innerHTML()
      .replace(/\s+/g, ' ')
      .trim();
    var email = $email
      .innerHTML()
      .replace(/\s+/g, ' ')
      .trim();

    var cc = Sugester.find_or_create_client_and_contact({external_id: external_id, now: true, skip_update: true});
    var client = cc[0];
    if(client) {
      Sugester.add_contact(client.id, {name: name, email: email});
    } else {
      cc = Sugester.find_or_create_client_and_contact({external_id: external_id, name: name, email: email, now: true});
      client = cc[0];
    }
    Sugester.update_post(post.id, {client_id: client.id});



C) for payment confirmation message

Filter name - write a name, eg. Ebay add client - paypal message

Action - select Action on change at tasks/emails

Conditions script - paste the script:

(/@paypal/).test(post.email)

Action script - paste the script:

 var joined_content = console.join_lines(post.content);
    var regexp = /<!-- EmailContentSellerBuyerDetails : start -->(.*)<!-- EmailContentSellerBuyerDetails : end -->/;
    var buyer_details = regexp.exec(joined_content);
    if(buyer_details){
      var $buyer_details = document.parseFromString(buyer_details[1]);
      var cc, client;

      if($buyer_details.children().length == 4){ // no login
        var name = $buyer_details.children()[2].innerText();
        var email = $buyer_details.children()[3].innerText();
        cc = Sugester.find_or_create_client_and_contact({name: name, email: email, now: true});
        client = cc[0];
      } else {
        var name = $buyer_details.children()[2].innerText();
        var login = $buyer_details.children()[3].innerText();
        var email = $buyer_details.children()[4].innerText();
        var external_id = "ebay-" + login;

        cc = Sugester.find_or_create_client_and_contact({external_id: external_id, now: true, skip_update: true});
        client = cc[0];
        if(client) {
          Sugester.add_contact(client.id, {name: name, email: email});
        } else {
          cc = Sugester.find_or_create_client_and_contact({external_id: external_id, name: name, email: email, now: true});
          client = cc[0];
        }
      }

      Sugester.update_post(post.id, {client_id: client.id});
    }



 


Back


Add Comment