Skip to content

Example Formatting-Templates

RDA uses Jinja2 Templating Engine to format data to make it suitable for REST Endpoints, HTML Reports sent via email, and many other formats as needed by various integration endpoints.

This page contains formatting templates that are used by some of the example pipelines.

Formatting templates are consumed by Bots @dm:apply-template-by-row and @dm:apply-template-all-rows


Formatting-Template: Email HTML Template

<html>
<body>

<table cellspacing="2" width='90%'>
<tr bgcolor='#00CCFF'>
    <td>Incident</td><td><b>{{ number }}</b></td>
</tr>
<tr>
     <td>Priority</td><td><b>{{ priority }}</b></td>
</tr>
<tr>
     <td>State</td><td><b>{{ state }}</b></td>
</tr>
<tr>
     <td>Title</td><td><b>{{ short_description }}</b></td>
</tr>
<tr>
     <td>Description</td><td><pre>{{ description }}</td>
</tr>
</table>

</body>
</html>

You may run following pipeline snippet to load the formatting template into your environment:

1
2
3
4
@dm:add-template
    url = 'https://bot-docs.cloudfabrix.io/data/ft/ft-f9f-Email-HTML-Template' &
    name = 'Email HTML Template' &
    description = ''

Pipelines using this Formatting-Template




Formatting-Template: Incident Slack Template

1
2
3
4
5
6
7
8
9
Incident: *{{number}}*
Title: *{{short_description}}*
Priority: *{{priority}}*
State: *{{state}}*
Create: *{{sys_created_on}}*
Description:
====================================================
{{description}}
====================================================

You may run following pipeline snippet to load the formatting template into your environment:

1
2
3
4
@dm:add-template
    url = 'https://bot-docs.cloudfabrix.io/data/ft/ft-360-Incident-Slack-Template' &
    name = 'Incident Slack Template' &
    description = ''

Pipelines using this Formatting-Template




Formatting-Template: News Template HTML

<p><h3>News that doesn't make you Snooze. <i>Generated by CloudFabrix RDA Bots</i></h3><ul>{%for row in rows%}<li><a href='{{ row.link }}'>{{ row.title }}</a></li>{% endfor %}</li></ul></p>

You may run following pipeline snippet to load the formatting template into your environment:

1
2
3
4
@dm:add-template
    url = 'https://bot-docs.cloudfabrix.io/data/ft/ft-a04-News-Template-HTML' &
    name = 'News Template HTML' &
    description = ''




Formatting-Template: PagerDuty Create Incident Template

{
    "incident": {
        "type": "incident",
        "title": "{{ incident_key }}: {{ incident_title }}",
                "service": {
                   "id": "{{service_id}}",
                   "type": "service_reference"
                },
            "priority": {
            "id": "{{priority_id}}",
            "type": "priority_reference"
        },
        "urgency": "{{ urgency_id }}",
        "body": {
            "type": "incident_body",
            "details": "{{ body_details }}"
        }
    }
}

You may run following pipeline snippet to load the formatting template into your environment:

1
2
3
4
5
@dm:add-template
    url = 'https://bot-docs.cloudfabrix.io/data/ft/ft-35a-PagerDuty-Create-Incident-Template' &
    name = 'PagerDuty Create Incident Template' &
    description = '## This is a template to capture Payload for PagerDuty Incident Creation.
'

Pipelines using this Formatting-Template




Formatting-Template: Sendgrid Email Payload

{
  "personalizations": [
    {
      "to": [
        {
          "email": "{{recipient}}"
        }
      ]
    }
  ],
  "from": {
    "email": "tejo.prayaga@roboticdata.ai",
    "name": "{{bot_name}}"
  },
  "reply_to": {
    "email": "no-reply@roboticdata.ai",
    "name": "{{bot_name}}"
  },
  "subject": "{{subject}}",
  "content": [
    {
      "type": "text/html",
      "value": "{{message}}"
    }
  ]
}

You may run following pipeline snippet to load the formatting template into your environment:

1
2
3
4
@dm:add-template
    url = 'https://bot-docs.cloudfabrix.io/data/ft/ft-bc9-Sendgrid-Email-Payload' &
    name = 'Sendgrid Email Payload' &
    description = ''




Formatting-Template: Splunk-Template

{
    "index": "{{index}}",
    "source" : "{{source}}",
    "sourcetype" : "{{sourcetype}}",
    "server" : "{{splunk_server}}",
    "host" : "{{host}}",
    "cfx_received_time": "{{cfx_received_time}}",
    "_bkt":"{{_bkt}}",
    "_raw":"{{_raw}}",
    "_time":"{{_time}}",
    "splunk_server":"{{splunk_server}}",
    "message":"{{message}}",
    "enrich_cols": "{{enrich_cols}}"
}

You may run following pipeline snippet to load the formatting template into your environment:

1
2
3
4
@dm:add-template
    url = 'https://bot-docs.cloudfabrix.io/data/ft/ft-048-Splunk-Template' &
    name = 'Splunk-Template' &
    description = 'Splunk to Webhook'




Formatting-Template: appd-event-notification-to-webex-template

{
    "roomId": "{{roomId}}",
    "markdown": "AppDynamics Event Notification",
    "attachments": [{
        "contentType": "application/vnd.microsoft.card.adaptive",
        "content": {
            "type": "AdaptiveCard",
            "body": [{
                    "type": "ColumnSet",
                    "columns": [{
                            "type": "Column",
                            "items": [{
                                "type": "Image",
                                "style": "Person",
                                "url": "https://cloudfabrix.com/blog/wp-content/uploads/2022/05/rdabot.png",
                                "size": "Medium",
                                "height": "40px"
                            }],
                            "width": "auto"
                        },
                        {
                            "type": "Column",
                            "items": [{
                                    "type": "TextBlock",
                                        "horizontalAlignment": "Left",
                                    "text": "CloudFabrix Databot",
                                    "weight": "Lighter",
                                    "color": "Accent"
                                },
                                {
                                    "type": "TextBlock",
                                    "weight": "Bolder",
                                    "text": "AppDynamics Event: {{ id }}",
                                    "verticalAlignment": "Left",
                                    "wrap": true,
                                    "color": "Light",
                                    "size": "Large",
                                    "spacing": "Small"
                                }
                            ],
                            "width": "stretch"
                        }
                    ]
                },
                {
                    "type": "ColumnSet",
                    "columns": [{
                            "type": "Column",
                            "width": 35,
                            "items": [{
                                    "type": "TextBlock",
                                    "text": "App Name:",
                                    "color": "Light"
                                },
                                {
                                    "type": "TextBlock",
                                    "text": "Impacted Entity:",
                                    "weight": "Lighter",
                                    "color": "Light",
                                    "spacing": "Small"
                                },
                                {
                                    "type": "TextBlock",
                                    "text": "Created:",
                                    "weight": "Lighter",
                                    "color": "Light",
                                    "spacing": "Small"
                                },

                                {
                                    "type": "TextBlock",
                                    "text": "Severity:",
                                    "weight": "Lighter",
                                    "color": "Light",
                                    "spacing": "Small"
                                },

                                {
                                    "type": "TextBlock",
                                    "text": "Type:",
                                    "weight": "Lighter",
                                    "color": "Light",
                                    "spacing": "Small"
                                },

                                {
                                    "type": "TextBlock",
                                    "text": "Summary:",
                                    "weight": "Lighter",
                                    "color": "Light",
                                    "spacing": "Small"
                                }

                            ]
                        },
                        {
                            "type": "Column",
                            "width": 65,
                            "items": [{
                                    "type": "TextBlock",
                                    "text": "{{app_name}}",
                                    "color": "Light"
                                },
                                {
                                    "type": "TextBlock",
                                    "text": "{{ affectedEntities_name }}",
                                    "color": "Light",
                                    "weight": "Lighter",
                                    "spacing": "Small"
                                },
                                {
                                    "type": "TextBlock",
                                    "text": "{{ eventTime }}",
                                    "weight": "Lighter",
                                    "color": "Light",
                                    "spacing": "Small"
                                },

                                {
                                    "type": "TextBlock",
                                    "text": "{{ severity }}",
                                    "weight": "Lighter",
                                    "color": "Light",
                                    "spacing": "Small"
                                },

                                {
                                    "type": "TextBlock",
                                    "text": "{{ type }}",
                                    "weight": "Lighter",
                                    "color": "Light",
                                    "spacing": "Small"
                                },


                                {
                                    "type": "TextBlock",
                                    "text": "{{ summary }}",
                                    "weight": "Lighter",
                                    "color": "Light",
                                    "spacing": "Small"
                                }


                            ]
                        }
                    ],
                    "spacing": "Padding",
                    "horizontalAlignment": "Center"
                },
                {
                    "type": "TextBlock",
                    "text": "{{ description }}",
                    "wrap": true
                },
                {
                    "type": "TextBlock",
                    "text": "Resources:"
                },
                {
                    "type": "ColumnSet",
                    "columns": [{
                            "type": "Column",
                            "width": "auto",
                            "items": [{
                                "type": "Image",
                                "altText": "",
                                "url": "https://developer.webex.com/images/link-icon.png",
                                "size": "Small",
                                "width": "30px"
                            }],
                            "spacing": "Small"
                        },
                        {
                            "type": "Column",
                            "width": "stretch",
                            "items": [{
                                "type": "TextBlock",
                                "text": "[{{ id }}]({{deepLinkUrl}})",
                                "horizontalAlignment": "Left",
                                "size": "Medium"
                            }],
                            "verticalContentAlignment": "Left",
                            "horizontalAlignment": "Left",
                            "spacing": "Small"
                        }
                    ]
                }
            ],
            "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
            "version": "1.2"
        }
    }]
}

You may run following pipeline snippet to load the formatting template into your environment:

1
2
3
4
@dm:add-template
    url = 'https://bot-docs.cloudfabrix.io/data/ft/ft-ca6-appd-event-notification-to-webex-template' &
    name = 'appd-event-notification-to-webex-template' &
    description = ''




Formatting-Template: cato-payload-template

{
  accountMetrics(
    accountID: {{accountID}}
    timeFrame: "{{timeFrame}}"
    groupInterfaces: {{groupInterfaces}}
    groupDevices: {{groupDevices}}
  ) {
    id
    from
    to
    granularity
    sites {
      id
      interfaces {
        metrics {
          duration
          granularity
          bytesDownstream
          bytesUpstream
          bytesTotal
          lostDownstream
          lostDownstreamPcnt
          lostUpstream
          lostUpstreamPcnt
          packetsDownstream
          packetsUpstream
          jitterUpstream
          jitterDownstream
          packetsDiscardedDownstream
          packetsDiscardedUpstream
          rtt
          hostCount
          hostLimit
          flowCount
        }
        name
        timeseries {
          data
          label
          sum
          units
          info
        }
        annotations {
          time
          label
          shortLabel
          type
        }
        periods {
          duration
          title
          type
        }
        remoteIPInfo {
          ip
          countryCode
          countryName
          city
          state
          provider
          latitude
          longitude
        }
        remoteIP
        socketInfo {
          id
          serial
          isPrimary
          platform
          version
          versionUpdateTime
        }
        ipsecInfo {
          isPrimary
          catoIP
          remoteIP
          ikeVersion
        }
        interfaceInfo {
          id
          name
          upstreamBandwidth
          downstreamBandwidth
        }
      }
      metrics {
        duration
        granularity
        bytesDownstream
        bytesUpstream
        bytesTotal
        lostDownstream
        lostDownstreamPcnt
        lostUpstream
        lostUpstreamPcnt
        packetsDownstream
        packetsUpstream
        jitterUpstream
        jitterDownstream
        packetsDiscardedDownstream
        packetsDiscardedUpstream
        rtt
        hostCount
        hostLimit
        flowCount
      }
      name
      info {
        name
        type
        description
        countryCode
        region
        countryName
        isHA
        connType
        creationTime
        sockets {
          id
          serial
          isPrimary
          platform
          version
          versionUpdateTime
        }
        ipsec {
          isPrimary
          catoIP
          remoteIP
          ikeVersion
        }
      }
      hostCount {
        data
        label
        sum
        units
        info
      }
      flowCount {
        data
        label
        sum
        units
        info
      }
      hostLimit {
        data
        label
        sum
        units
        info
      }
    }
    timeseries {
      label
    }
  }
}

You may run following pipeline snippet to load the formatting template into your environment:

1
2
3
4
@dm:add-template
    url = 'https://bot-docs.cloudfabrix.io/data/ft/ft-f91-cato-payload-template' &
    name = 'cato-payload-template' &
    description = ''

Pipelines using this Formatting-Template




Formatting-Template: mondaydotcom-graphql-template

{ boards (limit:1) {
  name
  id
  description
  items {
    name
    column_values {
      title
      id
      type
      text
} } } }

You may run following pipeline snippet to load the formatting template into your environment:

1
2
3
4
@dm:add-template
    url = 'https://bot-docs.cloudfabrix.io/data/ft/ft-645-mondaydotcom-graphql-template' &
    name = 'mondaydotcom-graphql-template' &
    description = ''

Pipelines using this Formatting-Template




Formatting-Template: webex-payload-with-card

{
    "roomId": "{{roomId}}",
    "markdown": "Incident Notification",
    "attachments": [{
        "contentType": "application/vnd.microsoft.card.adaptive",
        "content": {
            "type": "AdaptiveCard",
            "body": [{
                    "type": "ColumnSet",
                    "columns": [{
                            "type": "Column",
                            "items": [{
                                "type": "Image",
                                "style": "Person",
                                "url": "https://cloudfabrix.com/blog/wp-content/uploads/2022/05/rdabot.png",
                                "size": "Medium",
                                "height": "40px"
                            }],
                            "width": "auto"
                        },
                        {
                            "type": "Column",
                            "items": [{
                                    "type": "TextBlock",
                                        "horizontalAlignment": "Left",
                                    "text": "CloudFabrix Databot",
                                    "weight": "Lighter",
                                    "color": "Accent"
                                },
                                {
                                    "type": "TextBlock",
                                    "weight": "Bolder",
                                    "text": "ServiceNow Incident: {{ number }}",
                                    "verticalAlignment": "Left",
                                    "wrap": true,
                                    "color": "Light",
                                    "size": "Large",
                                    "spacing": "Small"
                                }
                            ],
                            "width": "stretch"
                        }
                    ]
                },
                {
                    "type": "ColumnSet",
                    "columns": [{
                            "type": "Column",
                            "width": 35,
                            "items": [{
                                    "type": "TextBlock",
                                    "text": "Created:",
                                    "color": "Light"
                                },
                                {
                                    "type": "TextBlock",
                                    "text": "Priority:",
                                    "weight": "Lighter",
                                    "color": "Light",
                                    "spacing": "Small"
                                },
                                {
                                    "type": "TextBlock",
                                    "text": "State:",
                                    "weight": "Lighter",
                                    "color": "Light",
                                    "spacing": "Small"
                                },

                                {
                                    "type": "TextBlock",
                                    "text": "Category:",
                                    "weight": "Lighter",
                                    "color": "Light",
                                    "spacing": "Small"
                                },

                                {
                                    "type": "TextBlock",
                                    "text": "Subcategory:",
                                    "weight": "Lighter",
                                    "color": "Light",
                                    "spacing": "Small"
                                },

                                {
                                    "type": "TextBlock",
                                    "text": "Configuration Item:",
                                    "weight": "Lighter",
                                    "color": "Light",
                                    "spacing": "Small"
                                },



                                {
                                    "type": "TextBlock",
                                    "text": "Caller:",
                                    "weight": "Lighter",
                                    "color": "Light",
                                    "spacing": "Small"
                                },
                                {
                                    "type": "TextBlock",
                                    "text": "Age:",
                                    "weight": "Lighter",
                                    "color": "Light",
                                    "spacing": "Small"
                                },

                                {
                                    "type": "TextBlock",
                                    "text": "Title:",
                                    "weight": "Lighter",
                                    "color": "Light",
                                    "spacing": "Small"
                                }
                            ]
                        },
                        {
                            "type": "Column",
                            "width": 65,
                            "items": [{
                                    "type": "TextBlock",
                                    "text": "{{ sys_created_on}}",
                                    "color": "Light"
                                },
                                {
                                    "type": "TextBlock",
                                    "text": "{{ priority }}",
                                    "color": "Light",
                                    "weight": "Lighter",
                                    "spacing": "Small"
                                },
                                {
                                    "type": "TextBlock",
                                    "text": "{{ state }}",
                                    "weight": "Lighter",
                                    "color": "Light",
                                    "spacing": "Small"
                                },

                                {
                                    "type": "TextBlock",
                                    "text": "{{ category }}",
                                    "weight": "Lighter",
                                    "color": "Light",
                                    "spacing": "Small"
                                },

                                {
                                    "type": "TextBlock",
                                    "text": "{{ subcategory }}",
                                    "weight": "Lighter",
                                    "color": "Light",
                                    "spacing": "Small"
                                },


                                {
                                    "type": "TextBlock",
                                    "text": "{{ cmdb_ci }}",
                                    "weight": "Lighter",
                                    "color": "Light",
                                    "spacing": "Small"
                                },


                                {
                                    "type": "TextBlock",
                                    "text": "{{ caller_id }}",
                                    "weight": "Lighter",
                                    "color": "Light",
                                    "spacing": "Small"
                                },

                                {
                                    "type": "TextBlock",
                                    "text": "{{ calendar_duration }}",
                                    "weight": "Lighter",
                                    "color": "Light",
                                    "spacing": "Small"
                                },

                                {
                                    "type": "TextBlock",
                                    "text": "{{ short_description }}",
                                    "weight": "Lighter",
                                    "color": "Light",
                                    "spacing": "Small"
                                }

                            ]
                        }
                    ],
                    "spacing": "Padding",
                    "horizontalAlignment": "Center"
                },
                {
                    "type": "TextBlock",
                    "text": "{{ description }}",
                    "wrap": true
                },
                {
                    "type": "TextBlock",
                    "text": "Resources:"
                },
                {
                    "type": "ColumnSet",
                    "columns": [{
                            "type": "Column",
                            "width": "auto",
                            "items": [{
                                "type": "Image",
                                "altText": "",
                                "url": "https://developer.webex.com/images/link-icon.png",
                                "size": "Small",
                                "width": "30px"
                            }],
                            "spacing": "Small"
                        },
                        {
                            "type": "Column",
                            "width": "stretch",
                            "items": [{
                                "type": "TextBlock",
                                "text": "[{{ number }}](https://{{snowhostId}}.service-now.com/task.do?sys_id={{ number }})",
                                "horizontalAlignment": "Left",
                                "size": "Medium"
                            }],
                            "verticalContentAlignment": "Left",
                            "horizontalAlignment": "Left",
                            "spacing": "Small"
                        }
                    ]
                }
            ],
            "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
            "version": "1.2"
        }
    }]
}

You may run following pipeline snippet to load the formatting template into your environment:

1
2
3
4
@dm:add-template
    url = 'https://bot-docs.cloudfabrix.io/data/ft/ft-4b9-webex-payload-with-card' &
    name = 'webex-payload-with-card' &
    description = ''