Skip to content

Bug Report: MSTeams message tool - DM image delivery fails + user target routing broken #18693

@xjodoin

Description

@xjodoin

Summary

Two related issues with the MSTeams message tool for DM (personal) conversations:

  • target=user:<aadObjectId> always returns 403 BotNotInConversationRoster even when the bot has an active, stored conversation reference for that user.
  • target=conversation:<convId> delivers text but silently drops image attachments (buffer / media params) - the API returns success but no image arrives.

Both work correctly when calling the Bot Framework API directly (bypassing the message tool).

Environment

  • OpenClaw version: 2026.2.9
  • Channel: MSTeams (single-tenant Azure Bot)
  • OS: Linux 6.8.0-90-generic (x64)
  • Node: v22.22.0

Steps to Reproduce

Issue 1: user: target 403

message(action="send", channel="msteams", target="user:61aaa5bd-...", message="test")

Expected: Message delivered to user's DM using stored conversation reference.
Actual: 403 BotNotInConversationRoster - the tool appears to try creating a new conversation instead of reusing the stored reference from msteams-conversations.json.

Issue 2: conversation: target - images silently dropped

message(action="send", channel="msteams", 
        target="conversation:a:1oXO...",
        message="test image", 
        buffer="data:image/png;base64,iVBOR...")

Expected: Message with inline image delivered.
Actual: Tool returns success (messageId present in response), but only text arrives - image is silently dropped. No error in gateway logs.

Working Workaround (Direct Bot Framework API)

Sending directly via Bot Framework REST API works for both text and images:

# Text - works
payload = {"type": "message", "text": "Hello"}

# Image as attachment - works
payload = {
    "type": "message",
    "text": "Image test",
    "attachments": [{
        "contentType": "image/png",
        "contentUrl": "data:image/png;base64,...",
        "name": "image.png"
    }]
}

# Adaptive Card with image - works
payload = {
    "type": "message",
    "attachments": [{
        "contentType": "application/vnd.microsoft.card.adaptive",
        "content": {
            "type": "AdaptiveCard",
            "version": "1.4",
            "body": [
                {"type": "Image", "url": "data:image/png;base64,..."}
            ]
        }
    }]
}

# POST to: {serviceUrl}/v3/conversations/{convId}/activities

Investigation Details

  • msteams-conversations.json contains valid conversation references with conversationType: "personal", correct serviceUrl, tenantId, and recent lastSeenAt.
  • The user actively messages the bot (conversation is alive).
  • The stored conversation ID (a:1oXO...) works perfectly with direct API calls.
  • A second, older conversation reference (19:[email protected]) for the same user returns 403 - possibly stale.

Expected Fix

  • Issue 1: When target=user:<id> is used, the tool should look up existing conversation references in msteams-conversations.json by aadObjectId and reuse them, rather than attempting to create a new conversation (which requires the bot to be pre-installed in the user's scope).
  • Issue 2: When buffer or media is provided, the tool should include the image as a Bot Framework attachment (contentType: "image/png", contentUrl: "data:image/png;base64,...") in the activity payload, not attempt a separate file upload flow that triggers 403.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions