Skip to main content

send_dm

Facts​

DescriptionSend a direct message
SchemaSchema.slack.functions.SendDm
Schema referenceslack#/functions/send_dm
Required scopes

Input Parameters​

Required Input Parameters

messageSchema.slack.types.rich_textRequired

The textual message to send as a direct message

Examples
You've been swallowed by a grue.
user_idSchema.slack.types.usergroup_idRequired

The ID of the user to send a message to

Examples
U111AAA111

Optional Input Parameters

interactive_blocksSchema.slack.types.blocksOptional

Buttons to send with the message. Must be wrapped in a block.

metadataSchema.slack.types.objectOptional

Additional metadata about the message, which can then be used an workflow event trigger.

thread_tsSchema.types.stringOptional

The ts identifier of an existing message to send this message to as a reply.

Examples
1355517523.000005

Output Parameters​

Required Output Parameters

message_contextSchema.slack.types.message_contextRequired

An individual instance of the message you sent

message_linkSchema.types.stringRequired

Permalink URL of the message that was sent

message_tsSchema.types.stringRequired

The channel-specific unique identifier for this message, also serves as a confirmation that the message was sent.

Optional Output Parameters

actionSchema.types.objectOptional

If interactive_blocks was provided, the action object contains the button properties (see action payload below)

interactivitySchema.slack.types.interactivityOptional

If interactive_blocks is provided as an input parameter, the interactivity context becomes available

Usage info​

Sends a message directly to a user, from your workflow.

If you include a button in the direct message, the function execution will not continue until an end user clicks on that button.

Example workflow step​

const sendDmStep = ExampleWorkflow.addStep(
Schema.slack.functions.SendDm,
{
user_id: "U123ABC456",
message: "Don't give up. Never surrender.",
},
);

Example action payload​

{
"action_id": "WaXA",
"block_id": "=qXel",
"text": {
"type": "plain_text",
"text": "View",
"emoji": true
},
"value": "click_me_123",
"type": "button",
"action_ts": "1548426417.840180"
}