HelpSpot Help Desk Software | HelpSpot Blog | HelpSpot Support

Batch operations and RequestPush


Howdy all-
We’re in the evaluation stage of the game and have come across a couple of issues with the RequestPush functionality that I’m hoping is just me.

First, I’ve written a requestpush that is called by a trigger whenever the category is updated. The categories match buckets we’ve setup in POPFile, so the requestpush calls first the HS private API to get the category name of the message (unless I missed something the API only returns the category ID as xCategory, but does not offer the full name of the category…) then using the POPFile API, pushes the message back into POPFile to be reclassified in the new bucket.

So far in my limited testing, this works rather swimmingly, and lets us have the categories in HS be prepopulated on incoming mail by HS mail filters using POPFiles X-Header. And obviously, when a CSR corrects the category that change is pushed to POPFile by the RequestPush feature.

Okay, so the problem: No batch processes now work. I cannot recategorize/assign messages in bulk if the trigger and RequestPush is in place. If I remove it, it works fine. The documentation is bit vague about the Request Push API, and I’m not a PHP programmer by any stretch so it’s entirely possible I’ve fubared it myself, but it does work fine for single messages… Any pointer from anyone else using RPs?

The second problem… and perhaps not a problem at all, but is there a way to reject the action if the RP is not successful? In our case, I don’t want the workflow action (say, save and update) to complete if the RP call fails. I assume this isn’t possible since the trigger fires after the workflow action complete, but I thought I’d ask.



I think the issue is that the trigger has to run in real time and with you doing several api calls to different systems it is relatively slow. So on every request in the batch HelpSpot makes an HTTP call to the script, the script is then making HTTP calls to the API’s.

I suspect a few actually do work, but that your PHP setup is timing out before it completes. You can extend your php’s max execution time to try and fix it, but they’ll always be a pretty low limit on how many you can handle at any one time with that kind of setup.

You might want to consider writing an external script that queries HelpSpot via a cron on a regular basis and updates POPFile rather than trying to do it in real time with the trigger.


Thanks for the reply. I had originally considered the method you propose, but I couldn’t find any way, via the API, to return only requests that have had their category changed. If comments were added or anything other than a category change, I don’t really care, and I wouldn’t want to reprocess those messages. Is there something I’ve missed in the API documentation that would allow that type of filtering?



No, there’s not a way to get that exactly right now. However, there’s other ways around it. For example, you could use a database trigger (in the DB itself) that looks for changes to HS_Request.xCategory and logs the xrequest of any changes in a new table you’d have.

Then you just query that table, get info for those requests from HelpSpot and update popfile. That’s probably the simplest and most efficient way.