Skip to content

Send-TwitterMedia

SYNOPSIS

Upload media to Twitter to use in a Tweet or direct message.

SYNTAX

Send-TwitterMedia [-Path] <String> [-Category] <String> [-AltImageText <String>] [<CommonParameters>]

DESCRIPTION

Upload media to Twitter to use in a Tweet or direct message.

You can only upload an image, video, or gif.

NOTE: This command currently returns the raw API response.

EXAMPLES

Example 1

PS > Send-TwitterMedia -Path .\PSFollowFriday_20210514.png -Category TweetImage -AltImageText 'Creating a PSFollowFriday via PowerShell module BluebirdPS.' -Verbose
VERBOSE: Reading file D:\GitHub\PSFollowFriday_20210514.png
VERBOSE: Beginning INIT phase - media size 17004, category tweet_image, type image/png
VERBOSE: Upload for media id 1396858342329524224 successfully initiated
VERBOSE: Beginning APPEND phase
VERBOSE: Beginning FINALIZE phase
VERBOSE: Adding AltImageText to media 1396858342329524224
VERBOSE: Alt image text successfully added to media
VERBOSE: Media upload complete

media_id           : 1396858342329524224
media_id_string    : 1396858342329524224
media_key          : 3_1396858342329524224
size               : 16974
expires_after_secs : 86400
image              : @{image_type=image/png; w=873; h=185}

Upload the specified media file and set the ALT text for the media.

PARAMETERS

-Path

Specify the full path to the media file.

Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: 0
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False

-Category

Specifies the type and use for the uploaded media.

Type: String
Parameter Sets: (All)
Aliases:
Accepted values: TweetImage, TweetVideo, TweetGif, DMImage, DMVideo, DMGif

Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-AltImageText

Provide additional information about the images or GIFs.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

System.String

OUTPUTS

System.Management.Automation.PSCustomObject

NOTES

Online Version

Api Reference - POST media/upload (INIT)

Api Reference - POST media/upload (APPEND)

Api Reference - POST media/upload (FINALIZE)

Api Reference - Upload Media

Api Reference - Chunked Media Upload