• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

8. The eBay API > 121. Negative Feedback Notification

Negative Feedback Notification

Have a script notify you whenever you’ve received negative feedback.

Given the importance of feedback, especially to sellers, it’s a good idea to routinely check your feedback profile for complaints or comments that should be addressed [Hack #5] . But doing this every day, especially for sellers who receive dozens or even hundreds of feedback comments every week, can be a chore.

This script routinely scans your feedback profile and notifies you of any new negative or neutral feedback you’ve received:

	#!/usr/bin/perl
	require 'ebay.pl';

	$localfile = "feedbackalert.txt";
	%roles = ('S', 'seller', 'B', 'buyer');
	  my $rsp = call_api({ Verb => 'GetFeedback',
		DetailLevel => 1,
		UserId      => $user_id,
		SiteId      => $site_id,
 
		StartingPage=> $page_number,
		ItemsPerPage=> 1
	});
    $totalcomments = $rsp->{Feedback}{FeedbackDetailItemTotal};

	$oldtotal = 0; 
	if (-e "$localdir/$localfile") { 
		open (INFILE,"$localdir/$localfile"); 
	 $oldtotal = <INFILE>; 
		close (INFILE); 
	}

$newcomments = $totalcomments - $oldtotal;
	if ($newcomments == 0) { exit; }

	if ($newcomments > 200) {
		$num_pages = int($newcomments / 200) + 1;
		$page_size = 200;
		} else {
		$num_pages = 1;
		$page_size = $newcomments;
	}
	
	PAGE: 
for (my $page_number  = 1; $page_number <= $num_pages; $page_*number++) {
  my $rsp     = call_api({ Verb => 'GetFeedback',
         DetailLevel => 1, 
			  UserId => $user_id, SiteId => $site_id,
		StartingPage => $page_number,
		ItemsPerPage => $page_size
	});

	if ($rsp->{Errors}) {
		print_error($rsp);
		last PAGE;
	}
	FEEDBACK:
	foreach (@{$rsp->{Feedback}{FeedbackDetail}{FeedbackDetailItem}}) {
		my %i = %$_;
	($text, $type, $from, $item, $id, $role) = @i{qw/CommentText 
CommentType CommentingUser ItemNumber TransactionId FeedbackRole/};

 if (($type eq "Complaint") || ($type eq "Neutral")) { 
		open (INFILE,"$localdir/$localfile"); 
		 while ( $line = <INFILE> ) { 
		  if ($line eq "$id\n") { next FEEDBACK; }
	}
		close (INFILE);

		open(MAIL,"|/usr/sbin/sendmail -t");
		print MAIL "To: $selleremail\n";
		print MAIL "From: $selleremail\n";
		print MAIL "Subject: Negative Feedback Alert\n\n";
		print MAIL "A ".$roles{"$role"}.", $from, has left this feedback:\n";
		print MAIL "regarding this transaction:\n";	
		print MAIL "$itemurl$item\n";
close(MAIL); 
		} 
	 } 
	}
open (OUTFILE,">$localdir/$localfile"); 
	print OUTFILE $totalcomments;
	
	close (OUTFILE);

PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint