Skip to content

Webhook SendGrid Examples

amccook edited this page Aug 17, 2023 · 10 revisions

Prerequisites

  • A SendGrid account
  • A Dynamic Template that is configured to accept Turbonomic variables.
  • Follow these instructions to setup a SendGrid account and configure a Dynamic Template.

Examples

For each example, the following details will be shared:

  • Screenshot of example
  • Variables used from Turbonomic's Action DTO
  • User Variables you must supply
  • Link to JSON Workflow DTO to add webhook to your Turbonomic instance
  • Link to unescaped template JSON in case you want to modify the template to your liking prior to escaping.

Each example has been written for a specific Action. Please note the platform (On-Prem, Cloud, Container, etc), entity (VM, DB, Workload Controller, etc), and action (Move, Resize, etc) when implementing the webhooks. Webhooks may fail if implemented on the incorrect platform, entity, or action as certain Action DTO variables only exist for specific types of actions.

On-Prem VM Resize

This Workflow DTO was written to accommodate On-Prem > VM > Resize actions. It could work for other actions as long as the action DTO has the same variables.

  • Action DTO Variables

    • $action.target.displayName
    • $action.valueUnits
    • $action.currentValue
    • $action.newValue
    • $action.target.uuid
    • $action.actionState
    • $action.actionMode
    • $action.userName
    • $action.updateTime
    • $action.details
    • $action.risk.subCategory
    • $action.risk.reasonCommodities (then using a #foreach loop, iterate through each commodity, $resizeRisk)
  • User Variables:

    • <FROM_EMAIL_ADDRESS> - The sender of the email (Be sure to setup Sender Authentication in your SendGrid account.)
    • <REPLY_TO_EMAIL_ADDRESS> - The email address the recipient will see when replying to the email.
    • <REPLY_TO_NAME> - The name the recipient will see when replying to the email.
    • <TO_EMAIL_ADDRESS> - The email address of the recipient.
    • <CC_EMAIL_ADDRESS> - (Optional) The email address of CC recipient.
    • <CC_NAME> - (Optional) The name of CC recipeint.
    • <YOUR_TURBONOMIC_URL> - The hostname or IP address of your Turbonomic instance. Do not include http/https in name.
    • <SENDGRID_DYNAMIC_TEMPLATE_ID> - Your Dynamic Template ID from SendGrid.
    • <YOUR_SENDGRID_API_KEY> - Your SendGrid API Key
  • Workflow DTO: On-Prem VM Resize

  • Unescaped Template: On-Prem VM Resize