Skip to content

Publish-TwitterDM

SYNOPSIS

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

SYNTAX

DMUserId (Default)

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

DMUserIdWithMedia

Publish-TwitterDM -Id <string> -Path <string> -Category <string> [-Message <string>] [-AltImageText <string>] [<CommonParameters>]

DMUserObjectWithMedia

Publish-TwitterDM -User <User> -Path <string> -Category <string> [-Message <string>] [-AltImageText <string>] [<CommonParameters>]

DMUserObject

Publish-TwitterDM -User <User> [-Message <string>] [-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: System.String
Parameter Sets: (All)
Aliases:

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

-Id

Specifies the direct message recipient by Twitter user id.

Type: System.String
Parameter Sets: DMUserId, DMUserIdWithMedia
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: BluebirdPS.APIV2.UserInfo.User
Parameter Sets: DMUserObjectWithMedia, DMUserObject
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: System.String
Parameter Sets: DMUserId, 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: System.String
Parameter Sets: DMUserIdWithMedia, DMUserObjectWithMedia
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: System.String
Parameter Sets: DMUserIdWithMedia, DMUserObjectWithMedia
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: System.String
Parameter Sets: DMUserIdWithMedia, DMUserObjectWithMedia
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