title: How to assign variables in a mailgun email template (Node js)?
body: <p>I've made a google cloud function in which I send an email with some variables I receive from another place.
  I'm using <em><a href="https://github.com/mailgun/mailgun-js" rel="nofollow noreferrer">mailgun.js</a></em> and I'm trying to send the email with a template I've already created in mailgun. 
  The issue is that I can't find a way to replace the placeholder variables in my template.</p>
  
  <p>This is the code:</p>
  
  <pre><code>mg.messages.create('domain', {
      from: 'email',
      to: [email],
      subject: 'subject',
      template: 'template',
      // How to replace the template variables???
    })
    .then(res =&gt; console.log('Resolved &gt;&gt;&gt;&gt;&gt; ', res))
    .catch(err =&gt; console.log('MAILGUN ERROR &gt;&gt;&gt;&gt; ', err))
  </code></pre>
  
  <p>The <a href="https://documentation.mailgun.com/en/latest/user_manual.html#templates" rel="nofollow noreferrer">mailgun docs</a> says this:</p>
  
  <pre><code>var data = {
    from: 'Excited User &lt;me@samples.mailgun.org&gt;',
    to: 'alice@example.com',
    subject: 'Hello',
    template: 'template.test',
    h:X-Mailgun-Variables: '{"title": "API Documentation", "body": "Sending messages with templates"}' // Notice this
  };
  </code></pre>
  
  <p>As far as I know one cannot write "<code>h:X-Mailgun-Variables</code>" as a key in any object.</p>
  
  <p>Does anybody know where or how do I need to put it?</p>
  
  <p>I thought that it should be sent as a header but neither <em><a href="https://github.com/mailgun/mailgun-js" rel="nofollow noreferrer">mailgun/mailgun-js</a></em> nor <em><a href="https://github.com/highlycaffeinated/mailgun-js" rel="nofollow noreferrer">highlycaffeinated/mailgun-js</a></em> specifies how to pass headers.</p>