title: How to handle threads in Python functions in Google Cloud Functions?
body: <p>I am using Google Cloud Functions to run a Python function which is being hit by my Facebook Messenger bot. Facebook Messenger has a weird requirement:</p>
  
  <blockquote>
    <p>When you receive a webhook event, you must always return a 200 OK HTTP response. The Messenger Platform will resend the webhook event every 20 seconds, until a 200 OK response is received. Failing to return a 200 OK may cause your webhook to be unsubscribed by the Messenger Platform.</p>
  </blockquote>
  
  <p>In other words, I have 20 seconds to return a 200 OK response from my cloud function. The issue is I need to actually send the data I receive from the message to another API using a <code>requests.post</code>, and there is basically no guarantees that it will take less than 20 seconds. So ideally, I would want to use threads and multi-processing. I realize that Google does not allow for threading. What can be a way to handle this situation? Thanks.</p>