def batch_notify_users(mxit_ids, message, contains_markup, options={ spool: true,
      spool_timeout: 60*60*24*7 })

      Rails.logger.info('Requesting MXit API auth...')
      request_app_auth(["message/send"])
      Rails.logger.info('Finished MXit API auth.')

      batch_size = 50
      Rails.logger.info('Starting to notify users in batches of ' + batch_size.to_s + '...')
      i = 0
      while i < mxit_ids.count
        current_batch = mxit_ids[i, batch_size]
        i += current_batch.count 

        to = current_batch.join(',')
        begin
          send_message(@app_name, to, message, contains_markup, options)
        rescue Exception => exception
          Rails.logger.error("The following batch caused an exception during send message:" +
            "\n\t#{to}")
          Rails.logger.error(exception.message)
        end

        Rails.logger.info("Total users notified: " + i.to_s)
      end
      Rails.logger.info('Finished notifying!')
    end
def batch_notify_users(mxit_ids, message, contains_markup, options={ spool: true,
      spool_timeout: 60*60*24*7 })

      Rails.logger.info('Requesting MXit API auth...')
      request_app_auth(["message/send"])
      Rails.logger.info('Finished MXit API auth.')

      batch_size = 50
      Rails.logger.info('Starting to notify users in batches of ' + batch_size.to_s + '...')
      i = 0
      while i < mxit_ids.count
        current_batch = mxit_ids[i, batch_size]
        i += current_batch.count 

        to = current_batch.join(',')
        begin
          send_message(@app_name, to, message, contains_markup, options)
        rescue Exception => exception
          Rails.logger.error("The following batch caused an exception during send message:" +
            "\n\t#{to}")
          Rails.logger.error(exception.message)
        end

        Rails.logger.info("Total users notified: " + i.to_s)
      end
      Rails.logger.info('Finished notifying!')
    end
When the Mxit API returns 400::Bad Request due to a non-existent Mxit ID in the batch the rest
 of the IDs still receive the message.