def extract_text_from_blocks(message):
    """Extract all text content from Slack message blocks and attachments"""
    text_parts = []
    
    # Extract text from main blocks
    if 'blocks' in message:
        for block in message['blocks']:
            if block.get('type') == 'section' and 'text' in block:
                text_parts.append(block['text'].get('text', ''))
    
    # Extract text from attachments
    if 'attachments' in message:
        for attachment in message['attachments']:
            if 'blocks' in attachment:
                for block in attachment['blocks']:
                    if block.get('type') == 'section' and 'text' in block:
                        text_parts.append(block['text'].get('text', ''))
    
    return ' '.join(text_parts)
Extract all text content from Slack message blocks and attachments
tests/test_slack_preview.py