First Cream project, feedback appreciated

Hi All;

I submitted my first cream project to codeshare, but due to a bug it didn’t produce an entry in the codeshare forum. That said, I’m new at this so I’d love some feedback, please see

In particular I’d love to know a better way to create the API call than assembling a string, tried to make something that could be JSON converted but it looked like I’d need to make a half dozen classes to get that working.

From here I’m going to learn some app XAML and get a crude UI up, then likely convert it to read a sensor on the other end of an xbee, and likely add and LED strip module to visualize moisture levels.


Updated to use the new NuGet package provided by GHI, much nicer!

@ Squeebee -
thanks for your great contribution.
I’m just trying to get it working but it seems that I have problems sending to SparkPost. I implemented an account, can send e-mails from this account and got an API key.
I inserted the API Key in your code for the word REDACTED

private const string SparkPostAPIKey = "REDACTED";

and inserted the e-mail address I used for the SparkPost account here for the word “authorization”

myClient.DefaultRequestHeaders.TryAddWithoutValidation("authorization", SparkPostAPIKey);

and chanced the reciepients
is that right?
However it did not work.
Are there other setting that have to be made on SparkPost?
What could be the reason?

This is what I get back:
Button Pressed!
9/27/2015 10:10:58 AM
Hmm, we seem to have no data.
StatusCode: 401, ReasonPhrase: ‘Unauthorized’, Version: 1.1, Content: System.Net.Http.StreamContent, Headers:
Connection: keep-alive
Server: msys-http
Cache-Control: no-store, no-cache
Date: Sun, 27 Sep 2015 17:11:01 GMT
Content-Length: 45
Content-Type: application/json

Edit 1:
I was as not right, this line has to be as it was:

myClient.DefaultRequestHeaders.TryAddWithoutValidation("authorization", SparkPostAPIKey);

And I need to have a template “daily-update” on SparkPost.
Can you please post the contents?

Edit 2:
Got my first e-mail from the device, still not with data from the device, but it works. Great

@ Squeebee -
I didn’t see that you included a template in your project in the file example.cs.
Now everything works perfect.
Really a very useful application.
How about sending SMS?
Kind regards: RoSchmi

@ RoSchmi - Hi RoSchmi, SMS could be achieved by an API call to a provider such as Nexmo or Twilio. I’ve used Nexmo in the past and I know they offer a free test account, implementing this API should be straightforward:

Glad you liked it, I’m planning on making a blog about it, when I do I will make sure to clarify the areas your asked about.

1 Like

I’m back on your project:

Plant Monitoring using Fez Cream, W10 IoT, and Sparkpost

Sending E-Mail notifications from the raspberry Pi via Sparkpost works fine.
I’m actually trying to port the application to a Spider II Mainboard but yet did not
succeed to access the SparkPost API via https.
Did you (or anybody else) mangage to use SparkPost with a NETMF/Gadgeteer board?
Of course other working solutions to send E-Mails from NETMF-boards are welcome as well.
Kind Regards