I'm using the gmail api to create a Gmail manager to my application (php). I'm using the documentation provided by google for php and all works correctly except the dynamic emails. I was looking for information about it but I didn't find anything.
I show you some examples of how I see it in my application and how it should be.
Pinteres email:
To access AMP Email using GMAIL API, you should probably get the raw email. This can be done by passing the format as raw. The details are available in the official documentation here.
Example code will be somewhat like below in javascript:
function getMessage(userId, messageId, callback) {
var request = gapi.client.gmail.users.messages.get({
'userId': userId,
'id': messageId,
'format' : 'raw'
});
request.execute(callback);
}
Note: Please note that the response will be raw base64 data.
If you are unable get it here, then Gmail should probably be stripping off the same from the response for security reasons. AMP Email is considered sensitive.
Related
Could someone please supply an example of the use of the DocuSign REST API EnvelopeAttachment: update request (PUT
/restapi/v2.1/accounts/{accountId}/envelopes/{envelopeId}/attachments/{attachmentId})? What I want to do is add an attachment to an envelope in draft mode that will be seen by the signer when it is sent. Not a signer attachment. An attachment that will be seen by the signer in the signing page.
The example in the DocuSign REST API documentation is terribly vague.
I think we should clear up what your objective is, and why you want an envelopeAttachment over a signerAttachment. You say:
What I want to do is add an attachment to an envelope in draft mode that will be seen by the signer when it is sent.
EnvelopeAttachments are not visible through the interface and signers will not be able to see it unless they use the API to download envelopeAttachments. View the source for my claim here. If you want to have a document signer see an attachment, you do want signer attachments. Maybe this blog post is what you are looking for if not.
All that being said, I can also provide some examples for EnvelopeAttachments. The request I'm making in my example is a create, but as far as I can tell the difference between update and create exists server side and the request is the same. These are in groovy.
// define the data for the request
def attachmentContent = JsonOutput.toJson([
attachments: [ [
attachmentId: 1,
label: "ExampleLabel",
attachmentType: ".txt",
name: "ExampleName",
accessControl: "senderAndAllRecipients",
data: ExampleFile.contents.bytes.encodeBase64().toString()
] ]
])
// put request against this url for adding attachments
def attachmentUrl = "${ESIGN_API_URL}/v2/accounts/${ACCT_ID}/envelopes/${ENV_ID}/attachments"
// invokeDocuSignApi is just a wrapper for a curl request
def response = invokeDocuSignApi("PUT", attachmentUrl, attachmentContent, ACCESS_TOKEN)
This will add attachments to the envelope. These attachments are only visible through the API, so they won't work for your problem statement and I recommend signerAttachments.
Of note, envelopeAttachments added when the envelope is a draft are deleted when the envelope is sent. You can add envelopeAttachments to an in progress envelope, so I just added them after sending. Not sure if it's a bug or not but the workaround is simple. I'll update this thread after I figure it out : )
I have learned that what I wanted to do was add a document to the envelope rather than adding an attachment. I am now successfully adding documents to my envelope and everything is working as I would expect.
I'm just starting with Visualize.js to embedd jasper reports in a web page.
The first hurdle I ran into was authenticating to the server. It kept failing with "Authentication Error"
Okay, double check password, still no worky. After tracking the requests, and following the same steps to authenticate to the server directly, I discovered that when using visualize.js, it places the userID/pwd in the query string and performs a GET request. WHAT!? The problem was that I had special characters in the password that were not URL friendly. So, not only are they putting clear text passwords in the request URL, they aren't bothering to URL encode it.
I fixed it by encoding it myself, but this is blasphemy if you ask me. The userID and password will be in clear text in the request whether you are using SSL/TSL or not. Why on earth aren't they doing a POST?
So, the actual question: Is there a way to configure this to use POST instead of GET for the auth process?
This code does work, but again it is processed as a GET. The standard jasper login page does not do that.
visualize({
server: "http://myseverurl/jasperserver-pro",
auth: {
name : "myUserID",
password: encodeURIComponent("myWierdPassword**+&&&")
}
}, function(v){
alert('in callback');
}, function(err){
alert("ERROR: " + JSON.stringify(err));
});
I have a simple vuetify contact form and I want to send this forms by email.
I have tried to use a method to send the email, but it does not work, because its on client side. So I get CORS issues.
Here's my code:
async send() {
if (this.$refs.form.validate()) {
try {
const sgMail = require("#sendgrid/mail");
sgMail.setApiKey(process.env.SENDGRID_API_KEY);
const msg = {
to: "test#example.com",
from: "me#mydomain.com",
subject: "Sending with SendGrid is Fun",
text: "and easy to do anywhere, even with Node.js",
html: "<strong>and easy to do anywhere, even with Node.js</strong>"
};
sgMail.send(msg);
}
}
}
Is Express (or an other backend) required? Is there a way to make it work using a middleware?
EDIT
Apparently, it's just not possible: https://github.com/sendgrid/sendgrid-nodejs/issues/730
The CORS policy from Sendgrid does not allow you to use their API from the browser (The 'Access-Control-Allow-Origin' header has a value 'https://sendgrid.api-docs.io').
Quoted from https://sendgrid.com/docs/for-developers/sending-email/cors/ :
In SendGrid's case, we do not allow our customers to make a browser-based call to our v3/mail/send endpoint. (...)
You can create a server-based application, which will protect your API keys from being released to the world. Languages like NodeJS, PHP, Ruby, Python, C#, Go, and Java, and others can be implemented to make calls to the API from the security of a locked down server environment.
You have to send the email from a server, which is a good thing since your API Key would be exposed by the browser otherwise.
If you are using Nuxt in SSR mode (with Node running), I guess you could create a "Server Middleware" ( https://nuxtjs.org/api/configuration-servermiddleware ), for example with a path like "/api/mail", that will send the email.
If you are using nuxt-generate to create a static site, you can use a "function as a service", with something like "https://webtask.io/", to create a small node script; that you can trigger by url from your client to send the email.
In my Gmail-addon, I want to be able to read the raw (MIME) message of the current email.
How can I do that?
You can retrieve the message ID of the current message using e.messageMetadata.messageId at function buildAddOn(e){}. I cannot uderstand about raw (MIME) message in your question. So I propose 2 patterns.
If you want the raw data of Byte[], you can retrieve it from message ID using Gmail.Users.Messages.get() of Advanced Google Services as follows.
Gmail.Users.Messages.get("me", messageId, {format: "RAW"}).raw
If you use this, please enable Gmail App at Advanced Google Services and API console.
If you want the raw data of String, you can retrieve it from message ID using GmailApp.getMessageById() as follows.
GmailApp.getMessageById(messageId).getRawContent()
Note :
If you use this, please set "https://www.googleapis.com/auth/gmail.addons.execute", "https://mail.google.com/" to the scopes.
If other scopes are required to be added, please also add them.
References :
Gmail Add-on
Gmail.Users.Messages.get()
getMessageById(id)
If I misunderstand your question, I'm sorry.
I'm currently running Orchard v1.9.3, and I would like to use Orchard's web request workflow activity to make an API call to MailChimp's API (http://developer.mailchimp.com/documentation/mailchimp/reference/lists/members/#create-post_lists_list_id_members). I was able to determine the value for the URL field should have the following form:
https://us14.api.mailchimp.com/3.0/lists/My_MailChimp_list_id/members/
Since I'm saving data to my MailChimp list, I'm going to select "PUT" for the verb drop down field. Based on MailChimp's API documentation, I was going to enter the following value in the "Headers" field:
'content-type: application/json'
MailChimp expects a JSON-formatted request, so I'm going to choose "Json" in the "Form Format" drop-down field.
The part that I'm struggling with is the "Form Values" field. According to the API docs, the data should have the following format, "'{"email_address":"urist.mcvankab+3#freddiesjokes.com", "status":"subscribed"}'". I know MailChimp expects my e-mail address in lieu of "urist.mcvankab+3#freddiesjokes.com", but I don't understand how to map the first name, last name, and email address values from my Orchard form into this Json request.
According to the documentation you linked to, the API expects a POST request. But maybe it supports PUT all the same, I don't know.
Regarding your question, you can access the submitted FORM values via the following token:
#FormSubmission.Field:MyFieldName
So for example, if the Dynamic Forms field name you used is named EmailAddress, your JSON should look something like this:
{
"email_address":"#FormSubmission.Field:EmailAddress",
"status":"subscribed"
}
PS: Kudos for using Dynamic Forms and the Web Request Activity!