class_docstr: A class for handling connections and interactions with Twilio WhatsApp API.
  Args:
      account_sid(str): Accound ID of the twilio account.
      auth_token(str): Authentication Token obtained from the twilio account.
class_docstr_tok: ["A","class","for","handling","connections","and","interactions","with","Twilio","WhatsApp","API",".","Args",":","account_sid","(","str",")",":","Accound","ID","of","the","twilio","account",".","auth_token","(","str",")",":","Authentication","Token","obtained","from","the","twilio","account","."]
docstr: Gets conversation history
  
  Returns:
      Response: conversation history
docstr_tok: ["Gets","conversation","history","Returns",":","Response",":","conversation","history"]
code: def fetch_messages(self, params, df=False):
      """
      Gets conversation history
  
      Returns:
          Response: conversation history
      """
      limit = int(params.get("limit", 1000))
      sid = params.get("sid", None)
      # Convert date strings to datetime objects if provided
      date_sent_after = params.get("date_sent_after", None)
      date_sent_before = params.get("date_sent_before", None)
      # Extract 'from_' and 'body' search criteria from params
      from_number = params.get("from_number", None)
      to_number = params.get("to_number", None)
      args = {
          "limit": limit,
          "date_sent_after": date_sent_after,
          "date_sent_before": date_sent_before,
          "from_": from_number,
          "to": to_number,
      }
  
      args = {arg: val for arg, val in args.items() if val is not None}
      if sid:
          messages = [self.client.messages(sid).fetch()]
      else:
          messages = self.client.messages.list(**args)
  
      # Extract all possible properties for each message
      data = []
      for msg in messages:
          msg_data = {
              "sid": msg.sid,
              "to_number": msg.to,
              "from_number": msg.from_,
              "body": msg.body,
              "direction": msg.direction,
              "msg_status": msg.status,
              "sent_at": msg.date_created.replace(tzinfo=None),
              "account_sid": msg.account_sid,
              "price": msg.price,
              "price_unit": msg.price_unit,
              "api_version": msg.api_version,
              "uri": msg.uri,
              # 'media_url': [media.uri for media in msg.media.list()]
              # ... Add other properties as needed
          }
          data.append(msg_data)
  
          # Create a DataFrame
          result_df = pd.DataFrame(data)
  
          # Filter rows where 'from_number' or 'to_number' begins with 'whatsapp:'
          result_df = result_df[
              result_df["from_number"].str.startswith("whatsapp:")
              | result_df["to_number"].str.startswith("whatsapp:")
          ]
  
      if df is True:
          return pd.DataFrame(result_df)
      return Response(
          RESPONSE_TYPE.TABLE, data_frame=pd.DataFrame(result_df)
      )
  
imports: import os
  from twilio.rest import Client
  import re
  from datetime import datetime
  from typing import List
  import pandas
  from mindsdb.utilities import log
  from mindsdb.utilities.config import Config
  from mindsdb_sql.parser import ast
  from mindsdb.integrations.utilities.date_utils import parse_local_date
  from mindsdb.integrations.libs.api_handler import APIHandler, APITable
  from mindsdb.integrations.utilities.sql_utils import extract_comparison_conditions, project_dataframe, filter_dataframe
  from mindsdb.integrations.libs.response import HandlerStatusResponse, HandlerResponse, RESPONSE_TYPE
label_desc: Use image node_id 6 for calling the WhatsAppHandler obj's underlying member method code with example usage: obj.fetch_messages(params, df) and returns: Response, pd