SparkPost: Syntax for substitutions when sending messages via SMTP - smtp

I am trying to send messages via SparkPost.com's SMTP API, and use their key:value substitution during message generation.
Not sure if my problem is simply syntax, or if my logic is wrong. I add this header during my SMTP conversation:
X-MSYS-API: {"options": {"open_tracking" : true, "click_tracking" : true},"substitution_data": {"imgurl":"images.mydomain.com"}}
Then, in my message body, I insert {{imgurl}} where I need images.mydomain.com to appear.
My end results are that the {{imgurl}} "tokens" are replaced by nothing. So something is going on there. I don't see the original string ( the {{imgurl}}).
Any idea what I have done wrong here?

The SMTP API does not currently support the use of templating with substitution markers, or the use of templates.
You will need to use the REST API if you want to use substitution markers.
We at SparkPost are always interested in improving the user experience. If you have any suggestions, please let us know. For instance, would it help to add a note to https://www.sparkpost.com/api#/reference/smtp-api that substitution markers are not supported via the SMTP API?

Related

WooCommerce api authentication error oauth_consumer_key parameter is missing

I try to fetch all product data list in json from WooCommerce API and type address bar http://www.batata.in/wc-api/v3/orders. But it give an error:
{"errors"[{"code":"woocommerce_api_authentication_error","message":"oauth_consumer_key parameter is missing"}]}
I tried all things but issue is not fixed. Rest API is on.
If anybody know any other way to find product list in json format from WooCommerce WordPress plugins, then please tell me.
I have faced the same problem. After some research, I have solved this issue. Kindly check that your site secure or not [http or https]. I missed the "s" for http.
Please note that you need to provide consumer key, nonce, signature with your rest api call. Following is the format which worked for me.
http://SomeURL.com/wc-api/v2/orders?oauth_consumer_key=########&oauth_timestamp=######&oauth_nonce=#############&oauth_signature_method=HMAC-SHA256&oauth_signature=##########################
For generating nonce and signature I recommend you use some wrapper available for your platform. I used php so got a nice library here.
https://github.com/woocommerce/wc-api-php
Important:- Even after following all above steps correct I got the same issue you faced. It kept giving me error "oauth_consumer_key parameter is missing" which actually was misleading. The issue I figured out was the basic http auth. I had http authentication in place so the curl request I used to fire was returning 401 unauthorized. If you are using php you will understand following line.
curl_setopt($this->ch, CURLOPT_USERPWD, "USERNAME:PASSWORD");
And it worked. So point here is you can try this or play around with your curl/socket or any client you are building and don't focus on the error message as it is misleading most of the time.
Sandipa Mukherjee's answer is right.
For http:// additional oauth parameters are required, because it's not safe.
My suggestion is to use the https:// server for wordpress.
Please refer to https://scriptstown.com/how-to-setup-cloudflare-ssl-and-configure-origin-certificate-for-apache/

Parse Json in Logic App from Stream Analytics -> Service Hub -> Logic Apps

I'm trying to build a logic app that inserts data into a Sql database. The data is coming from s Stream Analytics job, outputting it on a Service Bus topic, consumed in Logic Apps in Service Bus trigger.
To populate the properties of the row inserted (lets say it only has one column 'Name'), I've found that this should work using following syntax:
"body": {
"Name": "#{json(decodeBase64(triggerBody()['ContentData'])).Name}"
},
Provided the message body contains a 'Name' property.
However I get following error message when running this:
{"code":"InvalidTemplate","message":"Unable to process template language expressions in action 'Insert_row' inputs at line '1' and column '2017': 'The template language function 'json' parameter is not valid. The provided value '#\u0006string\b3http://schemas.microsoft.com/2003/10/Serialization/��{\"time\":\"2016-05-25T10:29:17.4953250Z\",\"Name\":\"Y-Axis\",\"Value\":81.0,\"Date\":\"2016-05-25T10:29:17.4953250\",\"EventProcessedUtcTime\":\"2016-05-25T10:29:17.5525449Z\",\"PartitionId\":2,\"EventEnqueuedUtcTime\":\"2016-05-25T10:29:17.2220000Z\"}\u0001' cannot be parsed: 'Unexpected character encountered while parsing value: #. Path '', line 0, position 0.'. Please see https://aka.ms/logicexpressions#json for usage details.'."}
So it seems like that the content is enclosed in another envelope that is preventing json parsing to work.
1) Any simple way how to get around this?
2) Isn't such an integration all within Microsoft Stack just supposed to work without this mocking around?
Thanks,
Stefan
with the limited string functions available in he workflow definition language I had to use a long winded way for removing the additional strings
#{json(substring(replace(decodeBase64(triggerBody()['ContentData']),'#string3http://schemas.microsoft.com/2003/10/Serialization/��', ''),0,sub(length(replace(decodeBase64(triggerBody()['ContentData']),'#string3http://schemas.microsoft.com/2003/10/Serialization/��', '')),1))).fieldname}
is there a better way to do this
Thanks for reporting this, you're right it should simply work. There is a known issue where ASA ServiceBus output JSON is being wrapped in a XML header. It will be addressed in a near future but can't specify a particular date. Could you please workaround it (maybe using substring/replace) until then ?
cheers,
Chetan
Sorry for the delay in getting back, this issue is now fixed. Its exposed under a new compatibility level (1.1) to avoid breaking existing solutions. Please use this URL to configure your job with compat level 1.1 and give it a try.
cheers!

Filemaker JSON httpspost

I am trying to use the plivo.com api with Filemaker to send SMS with my database.
I am using "insert from URL" to POST to the api, like below:
(ACCOUNTID, FROMNUMBER, and TONUMBER has been switched out)
httpspost://api.plivo.com/v1/Account/ACCOUNTID/Message/{"src":"FROMNUMBER", "dst":"TONUMBER", "text":"Testing text"}
The plivo site said something about using JSON for receiving, I had tested with other Filemaker solutions (FmSms) and confirm the functionality is working, so it has to be my post query is in the wrong format.
Would be great if someone of experience can give me some pointer in solving this issue.
Linkage to Plivo's documentation regarding messaging
Thanks in advance
Sunny
This will not work with FileMaker alone. The webservice accepts content-type application/json, FileMaker can send x-www-form-urlencoded only.
It may be possible to use a web viewer with some javascript to handle the request and return data back to FileMaker. See the blog post here: http://www.soliantconsulting.com/blog/2014/11/filemaker-and-javascript-ajax-post
Also, the free base elements plugin will allow you to set custom headers and should also work.

Can Hubot send an HTML or other type of formatted message to Hipchat?

Looking at the Hubot documentation there seems to be no way to send a formatted message to the Hipchat client from a Hubot script.
Does anyone know of a way to better present lines of text sent from Hubot?
Version 1 of the Hipchat API (albeit deprecated) suggests that a message_format parameter can be used to specify an HTML message.
Many thanks.
It is possible, according to this article

Compose e-mail via URL-params (googlemail)

I'm working on an extension for chrome, where i need to compose gmail messages from URL. Anyone knows how i set the recipient and the subject via URL-Param?? Is there a better approach to do that or is this even possible?
Thx
#Pekka's response is good for a general mailto, but to get a Gmail compose window pre-filled, you need to use a URL like the following : http://mail.google.com/mail/?view=cm&fs=1&tf=1&to=TO_ADDRESS#example.com&cc=CC_ADDRESS#example.com&bcc=BCC_ADDRESS#example.com&su=SUBJECT&body=BODY -- with your parameters URL-encoded.
But be careful that you don't go beyond Google's character limit or you'll get a
"414 - Request-URI Too Large" error, as explained in this StackOverflow question: Prefilling large volumes of body text in GMAIL compose getting a Request URI too long error
Check this article.
mailto:recipient#example.com?subject=Hi!&body=Hi!
You can even specify headers, I didn't know that.