MicrosoftTeamsAsk

Send a team member or channel a question with predefined response options on Microsoft Teams. The response can be used to close a task (might be conditional) in a playbook.

python · Microsoft Teams

Details

IDMicrosoftTeamsAsk
Languagepython
From Version5.0.0
Docker Imagedemisto/python3:3.12.13.10116658
Tagsmicrosoftteams

README

Send a team member or channel a question with predefined response options on Microsoft Teams. The response can be used to close a task (might be conditional) in a playbook.

Script Data


Name Description
Script Type python3
Tags microsoftteams
Cortex XSOAR Version 5.0.0

Dependencies


This script uses the following commands and scripts.

  • send-notification

Inputs


Argument Name Description
message Question (message) to send to the specified team member or channel.
persistent Indicates whether to use one-time entitlement or persistent entitlement.
option1 First reply option. Options cannot contain whitespaces.
option2 Second reply option. Options cannot contain whitespaces.
additional_options A CSV list of additional options (in case more than 2 options are required). Options cannot contain whitespaces.
team_member The question recipient. Accepts the team member’s email address or username.
task_id Task ID of the playbook task to close with the reply. If not provided, no playbook task will be closed.
channel Channel to which to send the question.
team The team in which to mirror the Cortex XSOAR investigation. If not specified, the default team configured in the integration parameters will be used.

Outputs


There are no outputs for this script.

Usage


The MicrosoftTeamsAsk script sends a message, such as operation approval or information retrieval, in a question format from Cortex XSOAR to Microsoft Teams. The message must have at least two options. For example, “yes” and “no”.

After the question is answered in Microsoft Teams, the response is sent to the Cortex XSOAR server, which appears as a conditional task in a playbook with response options as conditions. Depending on the response, the workflow may continue. For example, you define the following arguments:

  • option1: yes
  • option2: no

If a team member responds “yes” the playbook continues running the “yes” branch.

If a task ID is included in the script, and the task condition is met, the playbook closes as soon as a response is received.

MicrosoftTeamsAsk

To use MicrosoftTeamsAsk via playbook:

  1. Add the MicrosoftTeamsAsk script to a playbook as a task.
  2. In the message argument, specify the message to be sent.
  3. Configure the response options by filling out the option1 and option2 arguments (default values are ‘Yes’ and ‘No’).
  4. Either a team_member or a channel must be specified.
  5. In the MicrosoftTeamsAsk task, pass a tag value to the task_id argument.

All other inputs are optional.
At some point at the playbook, after running MicrosoftTeamsAsk, add a manual conditional task, which holds up the playbook execution until the response is received from Teams.
The condition names must match the response options you passed in to MicrosoftTeamsAsk.
In order to tie the conditional task back to MicrosoftTeamsAsk, add the same tag from the fifth step to the conditional task (under the “Details” tab of the task). The conditional task will be marked as completed when a user responds to the MicrosoftTeamsAsk form.

Notes


  • MicrosoftTeamsAsk will not work when run in the playbook debugger. This is because the debugger does not generate entitlements, since they must be tied to an investigation. Entitlements are needed to track the response.
  • Whitespaces are not supported in custom options and will not work. (i.e. setting a button to I Agree)
args:
- description: The mirroring type. Can be "all", which mirrors everything, "chat", which mirrors only chats (not commands), or "none", which stops all mirroring.
  name: form_type
  auto: PREDEFINED
  default: true
  defaultValue: predefined-options
  predefined:
  - predefined-options
  - open-answer
- description: Question (message) to send to the specified team member or channel.
  name: message
- auto: PREDEFINED
  description: Indicates whether to use one-time entitlement or persistent entitlement.
  name: persistent
  predefined:
  - 'true'
  - 'false'
- defaultValue: 'yes'
  description: First reply option (used only for if the form type is "predefined-options"). Options cannot contain whitespaces.
  name: option1
- defaultValue: 'no'
  description: Second reply option  (used only for if the form type is "predefined-options"). Options cannot contain whitespaces.
  name: option2
- description: A CSV list of additional options (in case more than 2 options are required. Used only for if the form type is "predefined-options"). Options cannot contain whitespaces.
  name: additional_options
- default: true
  description: The question recipient. Accepts the team member's email address or username.
  name: team_member
- description: The question recipient. Accepts the user's email address or username.
  name: user_id
- description: Task ID of the playbook task to close with the reply. If not provided, no playbook task will be closed.
  name: task_id
- description: Channel to which to send the question.
  name: channel
- description: The team in which to mirror the Cortex XSOAR investigation. If not specified, the default team configured in the integration parameters will be used.
  name: team
- description: Adaptive card to send to the specified team member or channel.
  name: adaptive_card
comment: Send a team member or channel a question with predefined response options on Microsoft Teams. The response can be used to close a task (might be conditional) in a playbook.
commonfields:
  id: MicrosoftTeamsAsk
  version: -1
name: MicrosoftTeamsAsk
script: '-'
tags:
- microsoftteams
timeout: '0'
type: python
dockerimage: demisto/python3:3.12.13.10116658
tests:
- No test
dependson:
  must:
  - Microsoft Teams|||send-notification
subtype: python3
fromversion: 5.0.0