I want to add some code that allows me to use an image moderation service called Webpurify http://www.webpurify.com/image-moderation/documentation/callback/. I can send the url request using a rule (or using a hook via a custom module) and they send a callback GET request to a URL I specify, with the imageid and the moderation status directly in the url like this - http://www.yoururl.com/imgcallback.php?imgid=43534dfdfg3453sffsd&status=1. What's the best way to setup a call back page or url in Drupal? It's very simple it just publishes the node if accepted and deletes it if not.


In a custom module, you would create a menu item and callback:

function YOURMODULE_menu() {


   $items['imgcallback'] = array(
     'title' => 'Webpurify Response',
     'page callback' => 'YOURMODULE_imgcallback',
     'access callback' => TRUE,
     'type' => MENU_CALLBACK,

   // create any other custom menu items here

   return $items;


function YOURMODULE_imgcallback() {

   $imgid=$_GET['imgid'];    // this is the ?imgid=....
   $status=$_GET['status'];  // this is the &status=...

   if ($status) {
     // this is where you would publish the node, but for now...
     return 'Webpurify liked image ' . $imgid;
   else {
     // this is where you would delete the node, but for now...
     return 'Webpurify didn\'t like image ' . $imgid;


Clear your caches and now you will have a url on your host:


that will return Webpurify liked image foobarbaz and


that will return Webpurify didn't like your image baddabing

It's up to you to change all of that to the publish/delete logic/functionality as I don't know how you are mapping imgid to node, etc. Just realize if your users can somehow figure that out, they can/could/would/might call this url directly with whatever status they desired.


You can specify a path with hook_menu and let the call back point to this path. The call back method of the menu entry handles the call from the service, does any processing needed and finaly does a drupal_goto to your node.

Have a look at the commerce adyen module. It provides two entries in hook_menu which handle call backs from the adyen payment gateway.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.