title: Sendgrid Python library and templates
body: <p>I am trying to use templates which I have created on Sendgrid. What I want to do is, use the template that I have created on Sendgrid to send an email (with substituting the substitution tags). </p>
  
  <p>Here is what I tried -</p>
  
  <pre><code>import sendgrid
  sg = sendgrid.SendGridClient('&lt;username&gt;', '&lt;password&gt;')
  message = sendgrid.Mail()
  message.add_to('&lt;to-email-address&gt;')
  message.set_subject('My Test Email')
  message.add_substitution('customer_link', 'http://my-domain.com/customer-id')
  message.add_filter('templates', 'enable', '1')
  message.add_filter('templates', 'template_id', '&lt;alphanumeric-template-id&gt;')
  message.add_from('&lt;from-email-address&gt;')
  status, msg = sg.send(message)
  </code></pre>
  
  <p>However, this gives me an error that <code>'{"errors":["Missing email body"],"message":"error"}'</code>. I tried adding the following lines but still the same error - </p>
  
  <pre><code>message.set_html('')
  message.set_text('')
  </code></pre>
  
  <p>So, the exact code I am using after using <code>set_html</code> is - </p>
  
  <pre><code>import sendgrid
  sg = sendgrid.SendGridClient('&lt;username&gt;', '&lt;password&gt;')
  message = sendgrid.Mail()
  message.add_to('&lt;to-email-address&gt;')
  message.set_subject('My Test Email')
  message.add_substitution('customer_link', 'http://my-domain.com/customer-id')
  message.add_filter('templates', 'enable', '1')
  message.add_filter('templates', 'template_id', '&lt;alphanumeric-template-id&gt;')
  message.add_from('&lt;from-email-address&gt;')
  message.set_html('')
  message.set_text('')
  status, msg = sg.send(message)
  </code></pre>
  
  <p>What am I missing here? The python documentation for the library doesn't seem to contain anything.</p>
  
  <p>Edit - One of the workaround that I found is derived from the answer below. I do set <code>message.set_html(' ')</code> and <code>message.set_text(' ')</code>, that is basically, give a whitespace string. This is weird, though, but works for this case.</p>