gray-napkin-43750
02/24/2024, 1:20 PMlimited-gpu-21450
02/24/2024, 7:22 PMdef retrieve_messages(bot_id, conversation_id):
    botpress_personal_access_token = <your personal access token. might be worth having it as an environment variable>
    botpress_bot_id = bot_id
    headers = {
        'Authorization': f'Bearer {botpress_personal_access_token}',
        'x-bot-id': botpress_bot_id,
    }
    all_messages = []
    api_url = f'https://api.botpress.cloud/v1/chat/messages?conversationId={conversation_id}'
    response = requests.get(api_url, headers=headers)
    if response.status_code == 200:
        all_messages.extend(response.json()['messages'])
        return all_messages
    else:
          print(f'Error: {response.status_code}')
        return None
The reason you're not getting the messages is because conversation objects don't include those (https://botpress.com/docs/api-documentation/#get-conversation), and you have to make a separate call at /v1/chat/messages to get the messages associated with a given conversation.