Search code examples
system.net.webexception

Stream send create new blasts returns (422) unprocessable entity


I am trying to schedule a new blast to send emails. I am calling the below URL

https://app.streamsend.com/audiences/1/blasts.xml

posting the below xml to the service

<blast>
  <from>
    <name>Customer Service</name>
    <email-address>[email protected]</email-address>
  </from>
  <to>
    <audience-id>1</audience-id>
    <filter-id></filter-id>
    <include-lists>5</include-lists>
    <exclude-lists>7</exclude-lists>
  </to>
  <subject>My First Blast</subject>
  <body>
    <email-id>9</email-id>
  </body>
  <options>
    <track-views>true</track-views>
    <track-clicks>true</track-clicks>
    <include-social-bar>false</include-social-bar>
  </options>
  <scheduled-for>2015-02-17T20:00:00Z</scheduled-for>
</blast>

I am getting WebException showing error 422 unprocessable entity. Please help me in resolving this issue.


Solution

  • Before scheduling a blast we must first verify the email mentioned in the email-address tag([email protected]). This is to ensure compliance with the U.S. Can-Spam Law.

    <blast>
      <from>
        <name>Customer Service</name>
        <email-address>[email protected]</email-address>
      </from>
      <to>
        <audience-id>1</audience-id>
        <filter-id></filter-id>
        <include-lists>5</include-lists>
        <exclude-lists>7</exclude-lists>
      </to>
      <subject>My First Blast</subject>
      <body>
        <email-id>9</email-id>
      </body>
      <options>
        <track-views>true</track-views>
        <track-clicks>true</track-clicks>
        <include-social-bar>false</include-social-bar>
      </options>
      <scheduled-for>2015-02-17T20:00:00Z</scheduled-for>
    </blast>
    

    To verify the email address, Login to stream send web portal and try to set up a blast. Steps to set up a blast

    Step 1: Mention the sender email address information

    Step 2: Activation link is sent to the email mentioned in step 1. Once the user activates the link, the sender account is verified successfully.

    We will be able to schedule the blasts after verification without any issues.

    Note: In stream send one audience Id is created per account, usually the value is 1, sometimes it may have a value other than 1. While scheduling a blast it is better to check for the audience id by calling the API rather than hard coding the value.