Skip to content

Publish-TwitterDM

SYNOPSIS

Publishes a new direct message to a specified user from the authenticating user.

SYNTAX

DM (Default)

Publish-TwitterDM [-Message] <String> -Id <String> [[-MediaId] <String>] [<CommonParameters>]

DMWithMedia

Publish-TwitterDM [-Message] <String> -Id <String> -TwitterUser <User> -Path <String> -Category <String> [-AltImageText <String>] [<CommonParameters>]

DMUserObject

Publish-TwitterDM [-Message] <String> -User <User> [[-MediaId] <String>] [<CommonParameters>]

DESCRIPTION

Publishes a new direct message to a specified user from the authenticating user.

EXAMPLES

Example 1

PS > Publish-TwitterDM -UserId 123456789 -Message "Did you hear about the release of #PowerShell 7.1?"

Send the string message to the specified user as a direct message.

Example 2

PS > Get-TwitterUser -User BluebirdPS | Publish-TwitterDM -Message 'Are you excited about the upcoming release of BluebirdPS?' -Path $PathToFile -Category DMImage -AltImageText 'Good to have alt-img-text for screen readers'
Id          : 1396582297319747588
SenderId    : 292670084
RecipientId : 1330877955057344513
CreatedAt   : 5/23/2021 4:42:21 PM
Message     : Are you excited about the upcoming release of BluebirdPS? https://t.co/zA8bPmHskI
Media       : Id: 1396582290713686016, Type: Photo, DisplayUrl: pic.twitter.com/zA8bPmHskI
SourceAppId :

Send the string message to the specified user as a direct message.

PARAMETERS

-Message

The text of your Direct Message.

Type: String
Parameter Sets: (All)
Aliases:

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

-Id

Specifies the direct message recipient by Twitter user id.

Type: String
Parameter Sets: DM, DMWithMedia
Aliases:

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

-User

Specifies the direct message recipient by Twitter user object, returned by Get-TwitterUser.

Type: User
Parameter Sets: DMWithMedia
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
Type: User
Parameter Sets: DMUserObject
Aliases:

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

-MediaId

The MediaId returned from the Send-TwitterMedia command.

Type: String
Parameter Sets: DM, DMUserObject
Aliases:

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

-Path

Specify the full path to the media file.

Type: String
Parameter Sets: DMWithMedia
Aliases:

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

-Category

Specifies the type and use for the uploaded media.

Type: String
Parameter Sets: DMWithMedia
Aliases:
Accepted values: DMImage, DMVideo, DMGif

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

-AltImageText

Provide additional information about the images or GIFs.

Type: String
Parameter Sets: DMWithMedia
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

BluebirdPS.APIV1.DirectMessage

NOTES

Online Version

Get-TwitterDM

Unpublish-TwitterDM

Api Reference - GET direct_messages/events/list