Skip to content

Prerequisites SendGrid

amccook edited this page Aug 17, 2023 · 7 revisions

Introduction

In order to use Turbonomic Webhooks with SendGrid, the following prerequisites must be configured. This outlines the bare-minimum steps required to integrate Turbonomic Webhooks with SendGrid. For more advanced usage of SendGrid, please refer to their docs.

  • Create a SendGrid Account
  • Generate your SendGrid API key
  • Create a Dynamic Template

1. Create a SendGrid Account

If you don't already have one, configure a SendGrid account. This can be done via IBM Cloud or via SendGrid. In these instructions we'll setup SendGrid via IBM Cloud and use the free tier which allows you send 3000 emails/month.

  1. Login to IBM Cloud and navigate to: https://cloud.ibm.com/catalog/infrastructure/email-delivery
  2. Click Create.
  3. Provide an email address and choose the Free Package. Click Create.
  4. From the Email Delivery page, click the Vendor Portal link to login to your SendGrid account.

2. Generate your SendGrid API key

  1. In the SendGrid portal, go to Email API > Integration Guide > Web API > Choose
  2. When asked to "Choose the language you want to use," locate cURL and select Choose
  3. In section 2, provide a name for your API Key. Click Create Key
  4. Record your API key for use later on.
  5. To verify your SendGrid API is working, follow instructions in section 4 to Run the code. Then click Next: Verify Integration

3. Create a Dynamic Template

  1. Go to Email API > Dynamic Templates > Create a Dynamic Template
  2. Provide a name for your template. In this example, name it TurboResizeEmail > Click Create
  3. Locate the template you just created and click Add Version
  4. Hover over Blank Template and click Select
  5. Locate Design Editor and click Select
  6. In the Dynamic Version Settings, provide a Version Name. In the Subject field, write: Turbonomic: VM Resize Notification - {{displayName}}
  7. Click on the Build tab and click/drag the Text box onto the template page.
  8. Paste the following text into the text box. This is an example template for executing On-Prem VM Resize actions in Turbonomic.
    Your VM, {{displayName}}, has been resized from {{currentValue}} {{valueUnits}} to {{newValue}} {{valueUnits}}. You can review its utilization here: https://{{turboUrl}}/app/index.html#/view/main/{{uuid}}/details
    
    Details:
      - Status: {{actionState}} via {{actionMode}} by {{userName}} at {{updateTime}}
      - Instance: {{displayName}}
      - Details: {{details}}
      - Reason: {{risk_subCategory}}
      - Commodity: {{risk_reasonCommodities}}
    

  9. At the top, click Save. And click back arrow at the top to return to the Dynamic Templates page.
  10. Expand the template, and make note of the Template ID. You will use this Template ID in the Turbonomic Webhook wherever you see the variable <SENDGRID_DYNAMIC_TEMPLATE_ID>
  11. Lastly, to complete the SendGrid setup, navigate to Settings > Sender Authentication > Click the Verify a Single Sender button. This will verify ownership of a single email address to use as a sender in the Turbonomic webhook wherever you see the variable <FROM_EMAIL_ADDRESS>
  12. You can now test the example by adding the On-Prem VM Resize action webhook to Turbonomic.