Polling or callback – which to use

When Integrating InterFAX into your app, you will need to collect all kinds of information from InterFAX – status of a fax that you sent earlier, a list of faxes sent recently, the new faxes that were received, the fax image of a received fax, etc.

InterFAX offers both an API (see documentation here) for polling data and a callback (also known as a webhook) for pushing data to you (see documentation for outbound fax callbackand inbound fax callback).

  • The outbound (sending) fax callback will be sent to you once processing of the fax is completed (regardless of whether it was sent successfully or not). This will include all of the information pertaining to the fax and the delivery status.
  • The inbound (receiving) fax callback will be sent to you once a new fax is received in InterFAX for you. This will include all of the information pertaining to the fax – however, it will not include the received fax image.

The question is – which one should you use? Polling the web service or setting up the callback? There are many advantages to using either one but it could get confusing. In this document, we will discuss and compare the two to help you identify which of the two systems should you use.

Important note – both systems are always available to you and you may use both to achieve the goals of the app.

Here is a little chart to compare the two systems:

Polling the web service Callback

Now let’s compare the two systems:

Item Polling Callback
Number of requests? Higher. For each piece of information, the app will need to send a request and receive a response from InterFAX. This will increase the processing requirements of the app and the network usage due to the higher number of requests and responses handled. Lower. For each piece of information, InterFAX will “push” the data to the app. This will decrease the processing requirements of the app and the network usage due to the lower number of requests and responses handled.
Near-realtime information? Yes. With polling, you can get immediate, up-to-date information when your app needs it.|No. The callback will be sent from InterFAX to your app once the process within InterFAX is completed.
Loop cycles? Required. With polling, as you do not know when the process in InterFAX is completed, the app will need to continuously submit polling requests to check if the status has changed. Not required. With callback, InterFAX will push the new status to the app once the process is completed and the status has changed.
Requires additional resources? No. All of the code required is stored together in the code of the app. Yes. You will need to create two systems – the app code and separate callback acceptance code and synchronize between the two systems by using the unique InterFAX tranaction ID.

So, which is the better method to use? Both have their advantages and disadvantages and you will need to choose the method that is right for your app.

If you you are integrating InterFAX into a on-demand system which requires getting the update as soon as it becomes available, we would recommend combining both methods. Setting up the callback system to be pushed information with InterFAX. However, have a timer alongside of it that when it expires, the app will poll for new data. Otherwise, we would recommend setting up the callback system only.