Skip to content

Cannot Send Message With Media But No Text #1129

Description

@khabubu

I am calling the PublishMethodAsync with media but no text but getting an exception that text can not be null.
E,g:

twitterMessage = await twitterUserClient.Messages.PublishMessageAsync(new PublishMessageParameters("", long.Parse(recipientProvider.RemoteId))
                                                {
                                                    MediaId = twitterMessageMedia.Id
                                                });

When testing this out with postman using this payload

{
  "event": {
    "type": "message_create",
    "message_create": {
      "target": {
        "recipient_id": 1330877955057344513
      },
      "message_data": {
        "text": "",
        "attachment": {
          "type": "media",
          "media": {
            "id": 1406671758313283590
          }
        }
      }
    }
  }
}

The API responded with

{
  "event": {
    "type": "message_create",
    "id": "1406671761819717641",
    "created_timestamp": "1624211657372",
    "message_create": {
      "target": {
        "recipient_id": "1330877955057344513"
      },
      "sender_id": "292670084",
      "message_data": {
        "text": " https://t.co/edZfFCUmYE",
        "entities": [...],
        "attachment": [...]
      }
    }
  }
}

Metadata

Metadata

Assignees

Labels

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions