title: API Gateway Mapping Template for SNS not recognising TopicArn parameter
body: <p>I have a POST method which integrates with SNS. It initially accepted a <code>TopicArn</code> query string parameter and a <code>Message</code>, however to avoid client applications having knowledge of the ARN, and to move the message content into the request body, I needed to make use of an API Gateway mapping template.</p>
  <p>I added the below Velocity (VTL) code under an <code>application/json</code> mapping template (fake account ID):</p>
  <pre><code>TopicArn=$util.urlEncode('arn:aws:sns:eu-west-2:1234567890123:MyTopic')
  &amp;Subject=$util.urlEncode('Contact form message')
  &amp;Message=$util.urlEncode($input.body)
  </code></pre>
  <pre><code>I ran a test using the console with a body of:
  {
      &quot;name&quot;: &quot;test&quot;,
      &quot;email&quot;: &quot;test@test.com&quot;,
      &quot;message&quot;: &quot;test message&quot;
  }
  </code></pre>
  <p>but this returns the error:</p>
  <blockquote>
  <p>Invalid parameter: TopicArn or TargetArn Reason: no value for required parameter</p>
  </blockquote>
  <blockquote>
  <p>Endpoint request body after transformations: TopicArn=arn%3Aaws%3Asns%3Aeu-west-2%1234567890123%3AMyTopic
  &amp;Subject=Contact+form+message
  &amp;Message=%7B%0A++++%22name%22%3A+%22test%22%2C%0A++++%22email%22%3A+%22test%40test.com%22%2C%0A++++%22message%22%3A+%22test+message%22%0A%7D
  Sending request to <a href="https://sns.eu-west-2.amazonaws.com/?Action=Publish" rel="nofollow noreferrer">https://sns.eu-west-2.amazonaws.com/?Action=Publish</a>
  Received response. Status: 400</p>
  </blockquote>
  <p>I'm not particularly familiar with VTL, but I literally copied some example syntax from AWS docs yet the <code>TopicArn</code> parameter doesn't appear to be passed to SNS.</p>
  <p>Can anyone see what I've done wrong here?</p>