title: How to add Message Attributes to SNS Publish from API Gateway Integration Request
body: <p>I can find formats for this using the CLI </p>
  
  <pre><code>aws sns publish --topic-arn arn:aws:sns:us-west-2:111111111111:test
      --message "Testing the CLI" 
      --subject "From the CLI" --message-attributes "{\"somename\":
          {\"DataType\":\"String\",\"StringValue\":\"somevalue\"}}"
  </code></pre>
  
  <p>But what I can't find (or figure out) is how to do this from the Integration Request on an API Gateway. </p>
  
  <p>I believe it needs to be done as Query Parameters of the Integration Request, but the syntax is not the same as adding Message Attributes for SQS. I tested that by using a parameter naming notation along the lines of this example:</p>
  
  <pre><code>MessageBody=This+is+a+test+message
  MessageAttribute.1.Name=test_attribute_name_1
  MessageAttribute.1.Value.StringValue=test_attribute_value_1
  MessageAttribute.1.Value.DataType=String
  </code></pre>
  
  <p>I also tried:</p>
  
  <pre><code>MessageAttributes   '{"store":{"DataType":"String","StringValue":"example_corp"}}'
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/5kQsJ.png" rel="noreferrer"><img src="https://i.stack.imgur.com/5kQsJ.png" alt="enter image description here"></a></p>
  
  <p>So far can't get it working, any help is much appreciated.</p>