Get Cisco Spark room messages and email them

  1. Add and configure Cisco Spark ‘Get room messages’ activity

    This flow fetches all the messages of a particular room in Cisco Spark, and sends them to the recipient’s email address.

    To set up this flow, you will need to use three activities: Cisco Spark ‘Get room messages’, JSON to HTML, and Send an Email.

    The first step is to add Cisco Spark ‘Get room messages’ activity to your canvas. This activity retrieves the list of all the messages of a particular room. To implement this, configure the activity by clicking the ‘settings’ icon that appear when you hover on the activity icon.

    On the configuration page, you will see a number of fields. Enter value in these fields as per the instructions given below:

    Field name Description (Input)
    Activity Label Specify a custom name, if required. Default is ‘Get Room Messages’.
    Authorize Cisco Spark Select the appropriate access token for Spark. If you haven’t created an authorization, select Add New to create one.
    Room ID Select the ID of the room (from the dropdown options) whose messages you wish to fetch. You can optionally enter the room iD manually.
    Before (Optional) Specify a date if you wish to get messages posted before that date.
    Before Message (Optional) Specify a message ID if you wish to get messages sent before that message.
    Max (Optional) Enter the maximum number of items you wish to get in the response


    Below is the image for configuring Get Room Messages of Cisco Spark activity:

    image-authorization

    Once you enter required values in the fields, click Done to return to flow canvas.

    Since the output of ‘Get room messages’ activity contain raw JSON data, it is recommended that you use ‘JSON to HTML’ activity to convert JSON into HTML before sending it via email. This will improve the readability of the output.

  2. Add and configure ‘JSON to HTML’ activity

    This activity converts any JSON data into HTML format. To implement this, add this activity to your canvas, and connect it with ‘Get room messages’ activity. Configure ‘JSON to HTML’ activity, and enter values in the fields as per the instructions given below:

    Activities Description (Input)
    Activity label Specify a custom name, if required. Default is ‘JSON to HTML’.
    JSON Data Use the output of Get Room Messages activity as the input value for this field (e.g. {{$a0}}).
    Jade template (Optional) Provide Jade template, if required.


    Below is the image for configuring JSON to HTML activity:

    image-json-to-html-activity

    Once you enter the required details, click Done.

  3. Add and configure ‘Send an Email’ activity

    The ‘Send an Email’ activity sends an email to the specified email address. Let’s add this to our canvas, connect it with ‘JSON to HTML’ activity, and configure it. Enter values in the available fields as per the instructions given below:

    Activities Description (Input)
    Activity label Specify a custom name, if required. Default is ‘Send an Email’.
    To Enter email address of the recipient.
    Cc (Optional) Enter email address of the recipients you wish to mark the copy to.
    Bcc (Optional) Enter email address of the recipients you wish to mark a blind copy to.
    Reply To (Optional) Again, this field is optional. If you want to use the reply to field then, you need to enter details in this field
    Subject Enter a suitable subject for the email
    Body Type (Optional) Select body type. Available options are Text or HTML.
    Body Use the output of the JSON to HTML activity as the input value for this field (e.g., {{$a1}}).


    Below is the image for configuring Send an Email activity:

    image-send-an-email-activity

    Once you enter the required details, click Done to return to your canvas.

  4. Save and test the flow

    Now that all the activities have been configured, ‘Save’ your flow. Click ‘Test’ to manually execute the flow.

    As soon as the flow starts its execution, you will see real-time indicators showing the progress of the flow. Once the execution is completed, you will receive an email that contains all the messages of the specified Cisco Spark room in HTML format.

    image-output