Stream send create new blasts returns (422) unprocessable entity - system.net.webexception

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>xxx#example.com</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.

Before scheduling a blast we must first verify the email mentioned in the email-address tag(xxx#example.com). This is to ensure compliance with the U.S. Can-Spam Law.
<blast>
<from>
<name>Customer Service</name>
<email-address>xxx#example.com</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.

Related

Mulesoft choice router - no action needed on the default path - is there a Mulesoft placeholder component that doesn't squander resources?

I have a subflow that ensures an OAuth access token is current. The token value is saved in an object store that expires the entry shortly before it times out. When expired, a new token value is retrieved and placed in the object store.
I didn't find any straightforward examples of a Mule v3 methodology to refresh a token that utilizes an object store, so here's the code, if anyone's interested.
<sub-flow name="get_token">
<objectstore:retrieve config-ref="TokenStore" key="StatusToken" defaultValue-ref="#['expired']" targetProperty="StatusToken" doc:name="Get token from Object Store"/>
<choice doc:name="Expired?">
<when expression="#[flowVars.StatusToken == 'expired']">
<set-payload value="#[{'grant_type':'refresh_token', 'refresh_token':'${RefreshToken}'}]" doc:name="Set payload for token refresh"/>
<http:request config-ref="HTTP-Token" path="${tokenPath}" method="POST" doc:name="Get new token">
<http:request-builder>
<http:header headerName="Content-Type" value="application/x-www-form-urlencoded"/>
</http:request-builder>
</http:request>
<dw:transform-message doc:name="Write token to flowVar">
<dw:set-variable variableName="StatusToken">
<![CDATA[
%dw 1.0
%output application/java
---
payload.access_token
]]>
</dw:set-variable>
</dw:transform-message>
<objectstore:store config-ref="TokenStore" key="StatusToken" value-ref="#[flowVars.StatusToken]" doc:name="Put token to Object Store"/>
</when>
<otherwise>
<set-variable variableName="Useless" value="#['']" doc:name="Useless placeholder"/>
</otherwise>
</choice>
</sub-flow>
The flow works well as designed, but here's my question. A choice router checks to see if the token has expired. There is no action required otherwise, and the flow errors out if the default path is empty. What's the simplest element to minimize processing and any resource utilization on the default path?
Following Ryan Carter's comment, this could be marked as a duplicate, but not really.
Here's the link:
How do I implement IF in mulesoft
Summary
Mule 4:
The <otherwise> tag is not needed
Mule 3:
A component is needed. I tend to use Logger with the level of TRACE, since log4j2 is smart and won't substitute parameters if the level is set to DEBUG and higher. However, if you really need to debug a flow, it would be good to see that it got routed correctly.

What is a good returnURL

I am trying to find an example of a good "returnURL" to be used with the Microsoft-Graph-UWP-Connect-SDK example in github.
<Application.Resources>
<!-- Add your client id here. -->
<x:String x:Key="ida:ClientID">xxxxx</x:String>
<x:String x:Key="ida:ReturnUrl">???????</x:String>
</Application.Resources>
I've tried using the Application Registration Portal, but I cannot find the correct entry or results.
Return URIs are the addresses that are allowed to be redirected on to pass the token/codes after authentication. From this example, I’ll use a Raspberry in a UWP. The name will be “laurellerpitest” and will return to port 81 on page token. So http://laurellerpitest:81/token
Important: Do give a read to Getting the access token on the same page.
And see if this works,
<Application.Resources>
<!-- Add your client id here. -->
<x:String x:Key="ida:ClientID">ENTER_YOUR_CLIENT_ID</x:String>
<x:String x:Key="ida:ReturnUrl">`http://laurellerpitest:81/token</x:String>
</Application.Resources>

Mule Imap: Store Email Attachments to a location and forward the email to other ID

I am using Mule Imap connector to fetch the mails from server.I can get emails with attachments and without, i have used attachments-list evaluator to return me the attachments in the email and using splitter to iterate through the list and copy the attachments to folder.
But problem here is i need to forward the same email to another id without attachments and only body.
Since i have used the attachments-list evaluator i am not able to access the Email body.
Any help on how to forward the same email without attachments would be appreciated.
Below is the configuraiton xml of the flow
<imap:connector name="IMAP1" validateConnections="true" doc:name="IMAP" checkFrequency="15000"/>
<expression-transformer name="returnAttachments" doc:name="Expression">
<return-argument evaluator="attachments-list" expression="*"/>
</expression-transformer>
<file:connector name="fileName" doc:name="File">
<file:expression-filename-parser/>
</file:connector>
<email:email-to-string-transformer name="Email_to_String" doc:name="Email to String"/>
Store the message payload in a flow variable before the expression-transformer with:
<set-variable variableName="emailBody" value="#[message.payload]" />
Then restore it before the smtp:outbound-endpoint:
<set-payload value="#[flowVars.emailBody]" />
And remove email-to-string-transformer, it's useless.

Why can't I get CreditCardTxnInfo in ReceivePaymentAddRs?

I'm using QBMS to process credit card payments. Then, I'm using QBXML and the QB Web Connector to add these payments into QB. I have QBMS payment processing working fine, and the ReceivePaymentAddRq to QB correctly adds the transactions data in QB. My problem is that I can't get QB to return the CreditCardTxnInfo in the ReceivePaymentAddRs markup. My QBXML request is in the following form:
<ReceivePaymentAddRq><ReceivePaymentAdd>
<CustomerRef><ListID>8000074A-1369078671</ListID></CustomerRef>
<TxnDate>2013-04-27</TxnDate>
<TotalAmount>21.05</TotalAmount>
<PaymentMethodRef><FullName>Visa</FullName></PaymentMethodRef>
<Memo>Some note about the payment.</Memo>
<DepositToAccountRef><FullName>Undeposited Funds</FullName></DepositToAccountRef>
<CreditCardTxnInfo><CreditCardTxnInputInfo>
<CreditCardNumber>xxxxxxxxxxxx6224</CreditCardNumber>
<ExpirationMonth>7</ExpirationMonth><ExpirationYear>2015</ExpirationYear>
<NameOnCard>John G Smith</NameOnCard>
<CreditCardAddress>7 Walnut Lane</CreditCardAddress>
<CreditCardPostalCode>11714</CreditCardPostalCode>
<CreditCardTxnType>Charge</CreditCardTxnType>
</CreditCardTxnInputInfo>
<CreditCardTxnResultInfo><ResultCode>0</ResultCode>
<ResultMessage>Status OK</ResultMessage>
<CreditCardTransID>ME0147410371</CreditCardTransID>
<MerchantAccountNumber>6241710108583287</MerchantAccountNumber>
<AuthorizationCode>08368C</AuthorizationCode>
<ReconBatchID>240141438 1R19595257770038186280AKTO03</ReconBatchID>
<PaymentGroupingCode>5</PaymentGroupingCode>
<PaymentStatus>Completed</PaymentStatus>
<TxnAuthorizationTime>2013-04-28T02:49:10</TxnAuthorizationTime>
<TxnAuthorizationStamp>1367117354</TxnAuthorizationStamp>
<ClientTransID>qc947863</ClientTransID>
</CreditCardTxnResultInfo>
</CreditCardTxnInfo>
<IsAutoApply>true</IsAutoApply>
</ReceivePaymentAdd>
<IncludeRetElement>CustomerRef</IncludeRetElement>
<IncludeRetElement>PaymentMethodRef</IncludeRetElement>
<IncludeRetElement>TotalAmount</IncludeRetElement>
<IncludeRetElement>CreditCardTxnInfo</IncludeRetElement>
</ReceivePaymentAddRq>
I expected the response to include the credit card transaction information (CC number, CC Trans ID, etc.). I need this info so that I can match up responses to the requests in my web service. Unfortunately, the response I'm getting looks like this:
<ReceivePaymentAddRs statusCode="0" statusSeverity="Info" statusMessage="Status OK">
<ReceivePaymentRet>
<CustomerRef><ListID>8020014A-1367478579</ListID><FullName>Smith, John</FullName></CustomerRef>
<TotalAmount>51.05</TotalAmount>
<PaymentMethodRef><ListID>80000004-1232402081</ListID><FullName>Visa</FullName></PaymentMethodRef>
</ReceivePaymentRet>
</ReceivePaymentAddRs>
Where's the CreditCardTxnInfo?
Did you authorize your application to "allow access to sensitive data"?
For QBWC, add <PersonalDataPref>pdpRequired</PersonalDataPref> to the QWC file.
Reference: https://member.developer.intuit.com/qbSDK-Current/doc/html/QBWC%20Developers%20Guide/04_TeachingQBWC_AboutYourWebService.6.2.html
For QBSDK users, you can use the AuthPreferences object to require access.
Reference: https://member.developer.intuit.com/qbSDK-Current/doc/html/QBSDK%20Programmers%20Guide/04_SupportingUserAuth.6.3.html
C# Sample:
RequestProcessor2 rp = new RequestProcessor2();
AuthPreferences auth = (AuthPreferences)rp.AuthPreferences;
auth.PutPersonalDataPref(QBXMLRPPersonalDataPrefType.pdpRequired);
rp.OpenConnection2("", "Your App Name", QBXMLRPConnectionType.localQBD);

Sending an order into Quickbooks via IPP doesn't work when transaction date is in the past

I've edited the question to make it more clean and focused now that I've investigated more.
Syncing orders are working for today's date and future dates, but not for dates in the past. I'm testing now directly in the API explorer.
Here is the add order request and response:
<!--Add order request-->
<Add xmlns="http://www.intuit.com/sb/cdm/v2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
RequestId="ecc53f53d70f0a52de4c88021721ba32"
xsi:schemaLocation="http://www.intuit.com/sb/cdm/v2 ./RestDataFilter.xsd ">
<OfferingId>ipp</OfferingId>
<ExternalRealmId>688875295</ExternalRealmId>
<Object xsi:type="SalesOrder">
<Header>
<DocNumber>6</DocNumber>
<TxnDate>2010-12-25</TxnDate>
<CustomerId idDomain="QB">4</CustomerId>
<SalesRepId idDomain="QB">1</SalesRepId>
</Header>
<Line>
<ItemId idDomain="QB">1</ItemId>
<Qty>6</Qty>
</Line>
</Object>
</Add>
<!--Add order response-->
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<RestResponse xmlns="http://www.intuit.com/sb/cdm/v2">
<Success RequestId="ecc53f53d70f0a52de4c88021721ba32">
<ObjectRef>
<Id idDomain="NG">802721</Id>
<SyncToken>1</SyncToken>
<LastUpdatedTime>2013-04-29T15:26:53Z</LastUpdatedTime>
</ObjectRef>
<RequestName>SalesOrderAdd</RequestName>
<ProcessedTime>2013-04-29T15:26:53Z</ProcessedTime>
</Success>
</RestResponse>
Here is the sync status and sync activity. There was only one entity with SalesOrder, but the times don't match up, so I don't believe its referencing the same order that I added via API explorer. Also, the order that I added did not appear in Quickbooks also.
<SyncStatusResponse>
<NgIdSet>
<NgId>802721</NgId>
<NgObjectType>SalesOrder</NgObjectType>
</NgIdSet>
<RequestId>DB7F4BF877006079E040900A0F1B14C1</RequestId>
<StateCode>8</StateCode>
<StateDesc>Record netted with QB</StateDesc>
<MessageCode>70</MessageCode>
<MessageDesc>MBL Netter success using QB SDK ext_ack_id</MessageDesc>
<ResponseLogTMS>2013-04-29T15:38:02.0Z</ResponseLogTMS>
</SyncStatusResponse>
<SyncActivityResponse>
<SyncType>Writeback</SyncType>
<StartSyncTMS>2013-04-10T12:42:21.0</StartSyncTMS>
<EndSyncTMS>2013-04-29T08:38:02.0</EndSyncTMS>
<EntityName>SalesOrder</EntityName>
<EntityRowCount>20</EntityRowCount>
</SyncActivityResponse>
From the sync status response, state code 8 means
Record netted. Synchronized. Object created in Data Services. Sync Manager has acknowledged synchronizing the object and mapped its NG ID to a QB ID in QuickBooks. Equivalent to StateCode 1 (for object created in QuickBooks).
Message code 70 seems to be ok base on its description, but it wasn't listed in the documentation.
In Quickbooks Destop, by default only the current Fiscal year transactions are displayed. Could you try changing the Date filter to "All", to see if the Sales Order made it ?
So your Request is succeeding but you are not seeing it in QuicKBooks after sync is run.
Check the sync status of the object, or you can see all the sync activity by calling these APIS
http://docs.developer.intuit.com/0025_Intuit_Anywhere/0050_Data_Services/v2/0500_QuickBooks_Windows/0600_Object_Reference/SyncActivity
http://docs.developer.intuit.com/0025_Intuit_Anywhere/0050_Data_Services/v2/0500_QuickBooks_Windows/0600_Object_Reference/SyncStatus
Even though your request succeeded, before it can by synced to QuickBooks it must pass the business rules to be created/updated on the desktop.
If your object encountered an error (lets say it was a duplicate) then you can add an errored object filter on your query to query for it as well.
regards
Jarred

Resources