This is reference content about building functions and workflows. Learn more if you're not yet familiar with this new Slack platform paradigm.

send_dm

Send a direct message

Facts

Schema ID

Schema.slack.functions.SendDm

Schema reference

slack#/functions/send_dm

Required scopes

Input parameters

Required parameters
The ID of the user to send a message to
  • U111AAA111
The textual message to send as a direct message
  • You've been swallowed by a grue.
Optional parameters
The ts identifier of an existing message to send this message to as a reply.
  • 1355517523.000005
Additional metadata about the message, which can then be used an workflow event trigger.
Buttons to send with the message. Must be wrapped in a block.

Output parameters

Required parameters
The channel-specific unique identifier for this message, also serves as a confirmation that the message was sent.
An individual instance of the message you sent
Permalink URL of the message that was sent
Optional parameters
If interactive_blocks was provided, the action object contains the button properties (see action payload below)
If interactive_blocks is provided as an input parameter, the interactivity context becomes available

Usage guide

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: "U0J46F228L0",
    message: "Don't give up. Never surrender. Except the cookies. Surrender the cookies.",
  },
);

Action payload

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"
}