Gmail API User.Settings.SendAs Signature treating input as plain text only - html

I am using the following Gmail API using the PHP Google API Client Library.
https://developers.google.com/gmail/api/v1/reference/users/settings/sendAs/patch
This is my code that executes the call:
$signature = new Google_Service_Gmail_SendAs();
$signature->setSignature($this->signature);
$gmail->users_settings_sendAs->patch($this->email, $this->email, $signature);
I am passing a string value containing HTML code to update the signature.
When I update the signature using the above, it displays as plain text showing the HTML, as if it doesnt support HTML through the API method.
The API reference for the User.Settings.SendAs resource says the following about the signature parameter:
https://developers.google.com/gmail/api/v1/reference/users/settings/sendAs#resource
signature string An optional HTML signature that is included in messages composed with this alias in the Gmail web UI.
So this seems to indicate that it supports HTML. We have tried VERY basic HTML like the following:
<em>Test</em>
It shows the above as is as plain text.
Can anyone help me to understand what are we doing wrong. We want to use this API to update the signature with HTML.

So we found the issue. Our controller was using htmlentities on the html String which is what was causing it to be treated as plain text.

Related

Multiple arguments in a google Text to Speech api html GET request

I have a GET request in my code that gets an mp3 file from google's text to speech API. the request goes something like this.
api/getlink?word=testing
But I want to have multiple arguments in this request. Like a speakingRate argument. I have tried
api/getlink?word=testing,speakingRate=0.5
and
api/getlink?word=testing&speakingRate=0.5
but neither seem to work. I'm missing the right formatting or is this method just restricted to a single argument?

UiPath integration with Linkedin - Html characters not preserving formatting

We have an RPA on a site, to post a form. In the form we want to send HTML content with formatting. But the site is removing all the formatting, and is just showing html characters as is (like a text). But when we are copy pasting the content from tinymce editor (at our end) to the same site's form it is showing the content properly with formatting.
What needs to be done from my end while sending data to UiPath so that it puts the content in proper html format with formatting preserved?
I also tried sending html codes encoded by gson which is done by default. That also did not work.
This is when we are copy pasting the content -
And this is when we are sending data via uipath -
EDIT
This is what the uipath activity looks like (The description is being sent by an http api which uipath calls to get data) -
Thanks
Better use the Assign activity:
In the String variable website you simply save the HTML page. Now you can easily paste the variable anywhere. Also you don't need to paste the HTML in your editor via CTRL+V.
Just use the Type into activity:

How to embed html inside json in a format that Sendgrid API accepts?

I have been trying to send an HTML email using the Sendgrid API, but I have been unsuccessful in embedding the html inside the json request.
This is an example of the html I am trying to send (emailtpl):
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></head><body></body></html>
Things I have tried:
html.EscapeString(emailtpl)
strconv.Quote(emailtpl)
using backticks ` inside the json template
wrapping value with single quotes for the value in the json template.
base64.StdEncoding.EncodeToString([]byte(emailtpl)) only display the base64 gibberish.
Items #1 and #5 are the only solutions that Sendgrid has accepted, but the html sent is not correct (as shown in the screenshot).
Items #2 - #4 all result in Status 400 Bad Request.
Does anyone know how to embed html into Sendgrid API request that Sendgrid accepts AND it renders correctly?
Looking at the Sendgrid api docs, it looks like it should accept html. You will need to have the html properly escaped in the json string (and set the content->type = "text/html").
In your example template, the only problem I see are the double quotes in your meta tag. As a quick test to make sure everything is working, I would attempt to send the following html string:
<html><head></head><body>Hi!</body></html>
If that html string is successful, then you need to work on escaping your original html string example. The only invalid characters I see are the double quotes, which need to be escaped in json with backslashes. I'm not sure if go has a specific function for this, but it looks like this should work:
// import "strings"
strings.Replace(emailtpl, `"`, `\"`, -1)

How to get to the JSON text using the VBnet standard browser

Sorry it is difficult to provide code for this.
In a normal browser (firefox, IE etc) when I enter a Google Geo Code API URL
https://maps.googleapis.com/maps/api/geocode/xml?address=&key=
with myAddress and mykey set correctly. I get a the JSON response as text in the browser window.
I would like to do exactly the same with a VBNet browser control. That is-
Set aBrowser.Navigate property to my Google GeoCode API URL and then receive the JSON back as text in the browser that can be accessed with aBrowser.document.... .
However, VBnet seems to immediately abort the url navigation task and invites the user via a dialogue box to save a file. If I save the file and then inspect it, the content is the JSON text that I expected to see inside the browser document.
This is my first play with JSON and assumed that the VBNet browser would behave just like IE. I am missing something?
Thanks in advance.
Geoff
Had a play with the answer provided for for HTTP GET in VB.NET
This is easily adapted to work with Google GEO Code API and the JSON text is received into a string. I can then either process the string or place the string on the browser page.
This works for me.

HTML Formatting using Slack Web API

So we are implementing the Slack chat.postMessage API function in an application. It looks like this:
https://slack.com/api/chat.postMessage?token=XXXXXXX&channel=XXXXXXX&text=hello&pretty=1
The text you want to send in the message would replace the "hello" in this URL. Is it possible to use this API call to send that message in HTML instead of in plain text? For example if you want to send test
Then the API sends the literal HTML < ul >< li >... etc
Any way we could send this so it would appear like it should?
No, Slack doesn't support HTML for formatting messages. The documentation for message formatting is here: https://api.slack.com/docs/message-formatting.