�
�Udac @` s� d d l m Z m Z m Z e Z i d d 6d g d 6d d 6Z d Z d Z d
Z d d l
m Z d d l m
Z
d
� Z d � Z e d k r� e � n d S( i ( t absolute_importt divisiont print_functions 1.1t metadata_versiont stableinterfacet statust communityt supported_bys�
---
module: cisco_spark
short_description: Send a message to a Cisco Spark Room or Individual.
description:
- Send a message to a Cisco Spark Room or Individual with options to control the formatting.
version_added: "2.3"
author: Drew Rusell (@drew-russell)
notes:
- The C(recipient_id) type must be valid for the supplied C(recipient_id).
- Full API documentation can be found at U(https://developer.ciscospark.com/endpoint-messages-post.html).
options:
recipient_type:
description:
- The request parameter you would like to send the message to.
- Messages can be sent to either a room or individual (by ID or E-Mail).
required: True
choices: ['roomId', 'toPersonEmail', 'toPersonId']
recipient_id:
description:
- The unique identifier associated with the supplied C(recipient_type).
required: true
message_type:
description:
- Specifies how you would like the message formatted.
required: False
default: text
choices: ['text', 'markdown']
personal_token:
description:
- Your personal access token required to validate the Spark API.
required: true
aliases: ['token']
message:
description:
- The message you would like to send.
required: True
s�
# Note: The following examples assume a variable file has been imported
# that contains the appropriate information.
- name: Cisco Spark - Markdown Message to a Room
cisco_spark:
recipient_type: roomId
recipient_id: "{{ room_id }}"
message_type: markdown
personal_token: "{{ token }}"
message: "**Cisco Spark Ansible Module - Room Message in Markdown**"
- name: Cisco Spark - Text Message to a Room
cisco_spark:
recipient_type: roomId
recipient_id: "{{ room_id }}"
message_type: text
personal_token: "{{ token }}"
message: "Cisco Spark Ansible Module - Room Message in Text"
- name: Cisco Spark - Text Message by an Individuals ID
cisco_spark:
recipient_type: toPersonId
recipient_id: "{{ person_id}}"
message_type: text
personal_token: "{{ token }}"
message: "Cisco Spark Ansible Module - Text Message to Individual by ID"
- name: Cisco Spark - Text Message by an Individuals E-Mail Address
cisco_spark:
recipient_type: toPersonEmail
recipient_id: "{{ person_email }}"
message_type: text
personal_token: "{{ token }}"
message: "Cisco Spark Ansible Module - Text Message to Individual by E-Mail"
s�
status_code:
description:
- The Response Code returned by the Spark API.
- Full Response Code explanations can be found at U(https://developer.ciscospark.com/endpoint-messages-post.html).
returned: always
type: int
sample: 200
message:
description:
- The Response Message returned by the Spark API.
- Full Response Code explanations can be found at U(https://developer.ciscospark.com/endpoint-messages-post.html).
returned: always
type: str
sample: OK (585 bytes)
( t
AnsibleModule( t fetch_urlc
C` s i } | j } i d j | d � d 6d d 6} | j rH d } d } n9 d } i | d | d 6| d
| d 6} | j | � } t | | d | d
| �\ } } | d } | d } | d k r� t | d <| | d <| | d
<n4 t | d <| | d <| j r
d | d
<n
| | d
<| S( s� When check mode is specified, establish a read only connection, that does not return any user specific
data, to validate connectivity. In regular mode, send a message to a Cisco Spark Room or Individuals
Bearer {0}t personal_tokent
Authorizations application/jsons content-types'