Page 1 of 1

sendgrid "text Body"

Posted: Sat Jun 27, 2015 11:49 am
by Michael4771079

Hi,
I have a sendgrid service which runs on the tester tab
I have setup the service and all works except "text Body"
If I enter some text in request parameter text, the email is sent.

I have some js which I have added to the js green button in before send mapping
Here is the code, this code works in another app that was published

any ideas why this code is not getting the localstorage values?
Have things changed?

Thanks

codevar name = localStorage.getItem("name") + "\n&quot

var mobile = localStorage.getItem("mobile") + "\n&quot

var email = localStorage.getItem("email") + "\n&quot

var address = localStorage.getItem("address") + "\n&quot

var totalprice = localStorage.getItem("totalprice") + "\n&quot

var deal1Array = localStorage.getItem("deal1Array");
deal1Array = deal1Array.replace(/[\[\]\{\}]/gi, "").replace(/"/gi, " ").replace(/ ,/gi, "\n") + "\n&quot

var deal2Array = localStorage.getItem("deal2Array");
deal2Array = deal2Array.replace(/[\[\]\{\}]/gi, "").replace(/"/gi, " ").replace(/ ,/gi, "\n") + "\n&quot

var deal4Array = localStorage.getItem("deal4Array");
deal4Array = deal4Array.replace(/[\[\]\{\}]/gi, "").replace(/"/gi, " ").replace(/ ,/gi, "\n") + "\n&quot

var kidsArray = localStorage.getItem("kidsArray");
kidsArray = kidsArray.replace(/[\[\]\{\}]/gi, "").replace(/"/gi, " ").replace(/ ,/gi, "\n") + "\n&quot

var mainorderArray = localStorage.getItem("mainorderArray");
mainorderArray = mainorderArray.replace(/[\[\]\{\}]/gi, "").replace(/"/gi, " ").replace(/ ,/gi, "\n") + "\n&quot

var calzoneArray = localStorage.getItem("calzoneArray");
calzoneArray = calzoneArray.replace(/[\[\]\{\}]/gi, "").replace(/"/gi, " ").replace(/ ,/gi, "\n") + "\n&quot

var garlicArray = localStorage.getItem("garlicArray");
garlicArray = garlicArray.replace(/[\[\]\{\}]/gi, "").replace(/"/gi, " ").replace(/ ,/gi, "\n") + "\n&quot

var kebabArray = localStorage.getItem("kebabArray");
kebabArray = kebabArray.replace(/[\[\]\{\}]/gi, "").replace(/"/gi, " ").replace(/ ,/gi, "\n") + "\n&quot

var grillArray = localStorage.getItem("grillArray");
grillArray = grillArray.replace(/[\[\]\{\}]/gi, "").replace(/"/gi, " ").replace(/ ,/gi, "\n") + "\n&quot

var burgerArray = localStorage.getItem("burgerArray");
burgerArray = burgerArray.replace(/[\[\]\{\}]/gi, "").replace(/"/gi, " ").replace(/ ,/gi, "\n") + "\n&quot

var wrapArray = localStorage.getItem("wrapArray");
wrapArray = wrapArray.replace(/[\[\]\{\}]/gi, "").replace(/"/gi, " ").replace(/ ,/gi, "\n") + "\n&quot

var livesundriesorderArray = localStorage.getItem("livesundriesorderArray");
livesundriesorderArray = livesundriesorderArray.replace(/[\[\]\{\}]/gi, "").replace(/"/gi, " ").replace(/ ,/gi, "\n") + "\n&quot

return " Name: " + name + " " + "\n"+ "Mobile Number: " + mobile + " " + "\n"+
"Email: " + email + " " + "\n"+
"Delivery Address: " + address + " " + "\n" +
"\n" + "Meal Deal: " + "\n" + deal1Array + " " + "\n" +
"Meal Deal: " + "\n" + deal2Array + " " + "\n" +
"Meal Deal: " + "\n" + deal4Array + " " + "\n" +
"Kids Meal: " + "\n" + kidsArray + " " + "\n" +
"Pizzas: " + "\n" + mainorderArray + " " + "\n" +
"Calzone: " + "\n" + calzoneArray + " " + "\n" +
"Garlic Bread: " + "\n" + garlicArray + " " + "\n" +
"Kebabs: " + "\n" + kebabArray + " " + "\n"+
"Charcoal Grill: " + "\n" + grillArray + " " + "\n" +
"Burgers: " + "\n" + burgerArray + " " + "\n" +
"Wraps: " + "\n" + wrapArray + " " + "\n" +
"Sundries: " + "\n" + livesundriesorderArray + " " + "\n" +

"Total Price: " + totalprice + " &quot/code


sendgrid "text Body"

Posted: Sat Jun 27, 2015 12:04 pm
by Serhii Kulibaba

Hello Michael,

What data do you receive? It is better to use storage variables for storing arrays in the localStorage https://devcenter.appery.io/documenta...


sendgrid "text Body"

Posted: Sat Jun 27, 2015 12:25 pm
by Michael4771079

Thanks for prompt reply Sergiy.
I get error,400 bad request, when I look at preview of error in network here is what I see

api_key:xxxxx
api_user:xxxxx
to:a href="mailto:digimob@live.com" rel="nofollow"digimob@live.com/a
toname:Anglo Pizza
from:a href="mailto:digimob@live.com" rel="nofollow"digimob@live.com/a
subject:New Order
fromname:michael
text:

the text parameter is empty
all data is saved in localstorage variables
toname is from localstorage
from is also from localstorage

Is my code correct or have some changes been made since I last implemented this service?


sendgrid "text Body"

Posted: Sat Jun 27, 2015 2:45 pm
by Michael4771079

error has changed, here is a screenshot of error

Image


sendgrid "text Body"

Posted: Sun Jun 28, 2015 1:33 pm
by Serhii Kulibaba

Michael, plese show us server's response data. It should contain full error with detail description.
Plese enable proxy for your service:
https://devcenter.appery.io/documenta... It should fix your second issue


sendgrid "text Body"

Posted: Sun Jun 28, 2015 2:24 pm
by Michael4771079

Hi Sergiy,
here is the response to the service

Hi Sergiy,
This is the response from sendgrid service, I unchecked proxy because I couldnt get the service to work with, so I went with a simple service setup with creds typed in server settings, service works in service tab, but no in browser

Reload the page to get source for: https://api.sendgrid.com/api/mail.sen...
=xxxxxxxxxxxxxxx&to=digimob%40live.com&toname=Anglo+Pizza&from=digimob%40live.com&subject=New+Order&fromname
=michael&text=+Name%3A+michael%0A+%0AMobile+Number%3A+07760711409%0A+%0AEmail%3A+digimob%40live.com%0A
+%0ADelivery+Address%3A+123+any+street%0A+%0A%0AMeal+Deal%3A+%0A+Mealdeal1+%3A+Meal+Deal+1%0A+Pizza+
%3A+Mighty+Meat%0A+Toppings+%3A+Pepperoni%2CSalami%2CCheese%0A+Kebab+%3A+1%2Cx%2CDonner%2CKebab%0A+Served_With
+%3A+Chips%0A+Sauce+%3A+Chilli%0A+TotalPrice+%3A+%C2%A310.80+%0A+%0AMeal+Deal%3A+%0A%0A+%0AMeal+Deal
%3A+%0A%0A+%0AKids+Meal%3A+%0A%0A+%0APizzas%3A+%0A+Pizza+%3A+Al+Fungi%0A+Size+%3A+12+Inch+Stuffed+Crust
%0A+Toppings+%3A+%0A+TotalPrice+%3A+%C2%A37.50+%0A+%0ACalzone%3A+%0A%0A+%0AGarlic+Bread%3A+%0A%0A+%0AKebabs
%3A+%0A+Kebab+%3A+Donner+Kebab%0A+Served_With+%3A+Chips%0A+Sauce+%3A+Chilli%0A+Price+%3A+%C2%A35.00+
%0A+%0ACharcoal+Grill%3A+%0A%0A+%0ABurgers%3A+%0A%0A+%0AWraps%3A+%0A%0A+%0ASundries%3A+%0A%0A+%0ATotal
+Price%3A+23.3%0A+


sendgrid "text Body"

Posted: Sun Jun 28, 2015 3:17 pm
by Michael4771079

Hi Sergiy,
Thanks for your efforts here proxy reinstated and problem solved, thanks again


sendgrid "text Body"

Posted: Mon Jun 29, 2015 11:21 pm
by Michael4771079

Hi,
Sergiy's suggestion to reinstate proxy for sendgrid works in firefox, service runs perfect and email arrives as expected.

this error is not resolved in chrome, appreyio tester app or xcode build ipa installed on iphone and ipad from itunes
error 400 bad request
{"message": "error", "errors": ["Missing email body"]}

I ran the app from the tester app with weinre and got the same error 400, I can only assume the same error is happening in xcode app

It seem the new setup for sendgrid has a problem with my code for getting values from LSV's

worked in previous app, and works in firefox.

Really dont have a clue how to resolve this, any ideas?

To test please test in firefox to see good result and others to see error.

App name anglopizza
id d80b69bc-eec2-4d14-9658-4103686dcb13
Open app, click anglo, login with "a" for log and pass, click blue button on footer, select some items and click order button for each.
Click cart button on footer,
click order button
see console

Thanks


sendgrid "text Body"

Posted: Tue Jun 30, 2015 7:41 pm
by Serhii Kulibaba

Michael,

I got two errors in console:
http://prntscr.com/7n8l6c

Second error will disappear automatically after fixing the first one.

The first's one cause is here: http://prntscr.com/7n8mbg
Please use replace method with values which are not empty. (Just add "if-else" construction)


sendgrid "text Body"

Posted: Wed Jul 01, 2015 4:16 pm
by Michael4771079

Thanks Sergiy,
all working now