Send Message
LAST UPDATED: FEB 27, 2024
Use in a playbook to send messages within an incident and in global chat. Replies from third-party integrations can be found within the context data.
Implementation | System |
Command Category | System Utility |
Tags | COMMUNICATION MESSAGING |
Inputs
Parameter Name | Required/Optional | Description | Sample Data |
---|---|---|---|
Recipient | Optional | Select the recipient(s) of this message. It can be a group, a single user, or the messaging integrations with the option 'Allow messages to also be sent through this connection' enabled. |
|
Content | Required | Message content. |
CODE
|
Reply Mode | Required | The mode to determine if this message requires a response or approval. When it is specified as No Action, any external user actions will not be reponded. |
|
Reply Due Time | Optional | The duration of time (in minutes) to wait for a reply. |
|
Output
Remote Command API
The D3 command API allows you to send requests to D3 SOAR to execute this utility command via REST API.
Request
POST
https:/{base_url}/{api_namespace}/api/Command/SendMessage
Headers
Please refer to the page Webhook Configuration Guide - Authentication Method: API Keys for more details.
Request Body
{
"Username": "<Username here>",
"Site": "<Site here>",
"CommandParams": {
"Recipient": "<Recipient here>",
"Content": "<Content here>
"Reply Mode": "<Reply Mode here>",
"Reply Due Time": "<Reply Due Time here>"
}
}
Body Parameters
Parameter Name | Type | Required/Optional | Description |
---|---|---|---|
Username |
| Required | The username of your D3 SOAR account. |
Site |
| Required | The D3 SOAR site to run the remote command. |
Recipient |
| Optional | Select the recipient(s) of this message. It can be a group, a single user, or the messaging integrations with the option 'Allow messages to also be sent through this connection' enabled. |
Content |
| Required | Message content. |
Reply Mode |
| Required | The mode to determine if this message requires a response or approval. When it is specified as No Action, any external user actions will not be reponded. |
Reply Due Time |
| Optional | The duration of time (in minutes) to wait for a reply. |
Sample Request
SAMPLE DATA
{
"Username": "Admin",
"Site": "Security Operations",
"CommandParams": {
"Recipient": "Administrators",
"Content": "\r\nSample for plain text message: I am seeking approval.\r\n\r\nSample for Sending Teams message with custom HTML content:\r\n {\r\n \"type\": \"message\",\r\n \"text\": \"Hi
this is mention message to notify the target users or groups
this is a custom html passage
this is a division
, target_user target_group(tag), please respond this message.\",\r\n\t \"textFormat\": \"xml\",\r\n \"entities\": [\r\n {\r\n \"type\": \"mention\",\r\n \"text\": \"target_user\",\r\n \"mentioned\": {\r\n \"id\": \"84d5cca5-7cdf-4f35-b668-a875799d1fad\",\r\n \"name\": \"the user display name in message\"\r\n }\r\n },\r\n {\r\n \"type\": \"mention\",\r\n \"text\": \"target_group\",\r\n \"mentioned\": {\r\n \"id\": \"84d5cca5-7cdf-4f35-b668-a875799d1fad\",\r\n \"name\": \"the group display name in message\"\r\n }\r\n }\r\n ]\r\n }\r\n\r\nSample for Sending Teams message with mention support and Adaptive Card with buttons:\r\n\t{\r\n \"type\": \"message\",\r\n \"text\": \"
Foo Hi, target_user, please respond this message. Foo2
Bar1 Bar2, target_group Bar3
\",\r\n\t \"textFormat\": \"xml\",\r\n \"entities\": [\r\n {\r\n \"type\": \"mention\",\r\n \"text\": \"target_user\",\r\n \"mentioned\": {\r\n \"id\": \"84d5cca5-7cdf-4f35-b668-a875799d1fad\",\r\n \"name\": \"the user display name in message\"\r\n }\r\n },\r\n {\r\n \"type\": \"mention\",\r\n \"text\": \"target_group\",\r\n \"mentioned\": {\r\n \"id\": \"ZjYyMWFkYmEtYTA5NS00NTVmLThlZTktNjNlNzYxNDlmZWVkIyMzMWIxNTdlMi01YTVkLTRiOGUtOWMxYS02Y2JmNGRlZTQ3NmQjI3RRSEpxb1h4MQ==\",\r\n \"name\": \"the group display name in message\",\r\n \"type\": \"tag\"\r\n }\r\n }\r\n ],\r\n \"attachments\": [\r\n {\r\n \"contentType\": \"application/vnd.microsoft.card.adaptive\",\r\n \"content\": {\r\n \"type\": \"AdaptiveCard\",\r\n \"version\": \"1.3\",\r\n \"body\": [\r\n {\r\n \"type\": \"TextBlock\",\r\n \"text\": \"**And this mentions tag** d3support!\",\r\n \"size\": \"Medium\",\r\n \"wrap\": true\r\n },\r\n {\r\n \"type\": \"TextBlock\",\r\n \"text\": \"**Connection ID:** 2364\",\r\n \"separation\": \"none\"\r\n },\r\n {\r\n \"type\": \"TextBlock\",\r\n \"text\": \"Comments\",\r\n \"wrap\": true\r\n },\r\n {\r\n \"type\": \"Input.Text\",\r\n \"style\": \"text\",\r\n \"isMultiline\": true,\r\n \"id\": \"responseComment\"\r\n }\r\n ],\r\n \"msteams\": {\r\n \"entities\": [\r\n {\r\n \"type\": \"mention\",\r\n \"text\": \"d3support\",\r\n \"mentioned\": {\r\n \"id\": \"ZjYyMWFkYmEtYTA5NS00NTVmLThlZTktNjNlNzYxNDlmZWVkIyMzMWIxNTdlMi01YTVkLTRiOGUtOWMxYS02Y2JmNGRlZTQ3NmQjI3RRSEpxb1h4MQ==\",\r\n \"name\": \"d3support\",\r\n \"type\": \"tag\"\r\n }\r\n }\r\n ]\r\n },\r\n \"actions\": [\r\n {\r\n \"type\": \"Action.Submit\",\r\n \"title\": \"Approve\",\r\n \"data\": {\r\n \"msteams\": {\r\n \"type\": \"invoke\",\r\n \"displayText\": \"Approve\",\r\n \"text\": \"text to bots approve\",\r\n \"value\": {\r\n \"respUrl\": \"<>\",\r\n \"action\": 1\r\n }\r\n }\r\n }\r\n },\r\n {\r\n \"type\": \"Action.Submit\",\r\n \"title\": \"Reject\",\r\n \"data\": {\r\n \"msteams\": {\r\n \"type\": \"invoke\",\r\n \"displayText\": \"Reject\",\r\n \"text\": \"text to bots decline \",\r\n \"value\": {\r\n \"respUrl\": \"<>\",\r\n \"action\": 2\r\n }\r\n }\r\n }\r\n },\r\n {\r\n \"type\": \"Action.Submit\",\r\n \"title\": \"Custom Action Button\",\r\n \"data\": {\r\n \"msteams\": {\r\n \"type\": \"invoke\",\r\n \"value\": {\r\n \"respUrl\": \"<>\",\r\n\t\t\t\t\t\t\t\t\t\t\"customizedAction\": \"2000\",\r\n \"action\": 3\r\n }\r\n }\r\n }\r\n }\r\n ]\r\n }\r\n }\r\n ]\r\n }\r\n",
"Reply Mode": "Require Approval",
"Reply Due Time": 100
}
}
Response
Response Fields
Field Name | Type | Description |
---|---|---|
error |
| The error message if the API request has failed. |
returnData |
| The return data from the API request. |
contextData |
| The context data from the API request. |
Sample Response
{
"error": "",
"returnData": "Successful",
"contextData": {
"action": "1",
"comment": "",
"actionName": "Approved",
"Approved by": "User01"
}
}