I'm using DocuSign's API in an iOS application to sign documents. Everything is going fine, except for the Carbon Copy experience.
I have two signers, with routing orders 1 and 2. Then, I have several CC recipients, all with routing order 3.
When the document is signed, the CC recipients receive an email alerting them that the document was signed, but they don't receive the note they should be getting. I know I'm setting this property well: when the CC recipients have a routing order of 1 or 2, they receive an email with the note, and then they receive an email when the document is signed.
How can I get my CC recipients to receive their email at the right point in time, with the note I want them to see?
Here's the log from DocuSign:
POST https://na2.docusign.net:8822/restapi/v2/accounts/6580857/envelopes
Content-Length: 284777
Content-Type: application/json
Connection: keep-alive
Accept: application/json
Accept-Language: en-US; q=1.0
Host: na2.docusign.net
User-Agent: Sales/1.0(iPhone; iOS 9.3.2; Scale/2.00)
X-DocuSign-Authentication: {"Username":"[email1]","Password":"[omitted]","IntegratorKey":"[omitted]"}
X-DocuSign-SDK: Obj-C
X-Forwarded-For: 69.74.21.33
X-SecurityProtocol-Version: TLSv1.2
X-SecurityProtocol-CipherSuite: ECDHE-RSA-AES256-GCM-SHA384
{"status":"sent","documents":[{"documentId":"1","documentBase64":"[omitted]","name":"Test Name"}],"emailSubject":"Subject","emailBlurb":"","recipients":{"signers":[{"email":"[email1]","routingOrder":"1","clientUserId":"1001","tabs":"[omitted]", recipientId":"1","name":"John Doe"},{"note":"This is a note that appears during the signing experience","tabs":"[omitted]","email":"[email2]","clientUserId":"1002","routingOrder":"2","recipientId":"2","name":"Jane Doe"}],"carbonCopies":[{"roleName":"Carbon Copy","routingOrder":"3","email":"[email3]","recipientId":"3","note":"This note does not appear in the email sent to the address.","name":"John Smith"}]}}
201 Created
Content-Type: application/json; charset=utf-8
{
"envelopeId": "f3421750-6884-4f84-a318-d4637151222c",
"uri": "/envelopes/f3421750-6884-4f84-a318-d4637151222c",
"statusDateTime": "2016-07-12T12:51:24.4870000Z",
"status": "sent"
}
I notice that I'm leaving the email blurb section empty. Could this be a potential solution, or does that field's content get displayed to all parties involved in the signing? In practice, I need to be able to have several different notes for several CC recipients. As far as I know, this can be achieved on DocuSign's website, so I don't see why it couldn't be done through the API.
In fact, it seems my problem was caused by a misunderstanding of DocuSign's API. The note field is designed to provide a note that only appears during the signing experience, while the "emailNotification":{"emailSubject":"TEST","emailBody":"TEST"} field is designed to do what I was trying to achieve.
Related
I programmed my ESP8266 to read the soil moisture. Depending on the moisture a water pump gets activated. Now I wanted the ESP to tweet different sentences, depending on the situation.
Therefore I connected my twitter account to thingspeak.com and followed this code
Connecting to the internet works fine.
Problems:
It does not tweet every time and if it tweets, only the first word from a sentence shows up at twitter.
According to the forum, where I found the code, I already tried to replace all the spaces between the words with "%20". However then nothing shows up at twitter at all. Also single words are not always posted to twitter.
This is the code I have problems with:
// if connection to thingspeak.com is successful, send your tweet!
if (client.connect("184.106.153.149", 80))
{
client.print("GET /apps/thingtweet/1/statuses/update?key=" + API + "&status=" + tweet + " HTTP/1.1\r\n");
client.print("Host: api.thingspeak.com\r\n");
client.print("Accept: */*\r\n");
client.print("User-Agent: Mozilla/4.0 (compatible; esp8266 Lua; Windows NT 5.1)\r\n");
client.print("\r\n");
Serial.println("tweeted " + tweet);
}
I don't get any error messages.
Maybe you could help me to make it visible if the tweet was really sent and how I manage to tweet a whole sentence.
I am using the Arduino IDE version 1.8.9 and I am uploading to this board
The rest of the code works fine. The only problem is the tweeting.
Update
I now tried a few different things:
Checking server response
Works and helps a lot. The results are:
Single words as String don't get any response at all
Same for Strings like "Test%20Tweet"
Strings with multiple words like "Test Tweet" get the following response and the first word of the String shows up as a tweet
HTTP/1.1 200 OK
Server: nginx/1.7.5
Date: Wed, 19 Jun 2019 18:44:22 GMT
Content-Type: text/html; charset=utf-8
Content-Length: 1
Connection: keep-alive
Status: 200 OK
X-Frame-Options: SAMEORIGIN
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, POST, PUT, OPTIONS, DELETE, PATCH
Access-Control-Allow-Headers: origin, content-type, X-Requested-With
Access-Control-Max-Age: 1800
ETag: W/"RANDOM_CHARS"
Cache-Control: max-age=0, private, must-revalidate
X-Request-Id: THE_ID
1
I think the Content-Length might be the problem?
But I don't know how to change it in this code.
Checking if the connection succeded
I implemented this into my code an it never shows up on the monitor. So I think i never have a problem with not connecting.
Use a hostname instead of IP address
I tried it and never got a bad request. On the other hand nothing shows up on twitter at all.
Check if your tweet variable contains any new-line characters (carriage return or line feed). For example, the following variable would cause problems
String tweet = "Tweet no. 1\r\n";
due to the new-line characters at the end. These characters will cause the first line of the HTTP request to be cut short. I.e., instead of
GET /apps/thingtweet/1/statuses/update?key=api_key&status=Tweet no. 1 HTTP/1.1\r\n
it would become
GET /apps/thingtweet/1/statuses/update?key=api_key&status=Tweet no. 1\r\n
and the server would reject it with a 400 (Bad request) error.
On the other hand
String tweet = "Tweet no. 1";
would be fine.
If your tweets may contain such characters, then try encoding them before passing them to client.print():
tweet.replace("\r", "%0D");
tweet.replace("\n", "%0A");
Use a hostname instead of IP address
According to https://uk.mathworks.com/help/thingspeak/writedata.html, the relevant hostname for the API you are using is api.thingspeak.com. Use that instead of the IP address. This is preferable because the IP address a hostname points to can change regularly. (The IP address you are using doesn't even seem to be correct - and may already be out of date.)
I.e., change
if (client.connect("184.106.153.149", 80)) {
to
if (client.connect("api.thingspeak.com", 80)) {
API endpoint
Are you sure you are using the correct API endpoint? According to the link above, it looks like the API endpoint you need is https://api.thingspeak.com/update.json - so you may need to change
client.print("GET /apps/thingtweet/1/statuses/update?key=" + API + "&status=" + tweet + " HTTP/1.1\r\n");
to
client.print("GET /update.json?api_key=" + API + "&status=" + tweet + " HTTP/1.1\r\n");
Check if the connection succeeded
Presently, your device sends the HTTP request if connects to the server successfully - but doesn't give any indication if the connection fails! So add an else block to handle that scenario and notify the user via the serial console.
if (client.connect("api.thingspeak.com", 80)) {
client.print("GET /apps/thingtweet/1/statuses/update?key=" + API + "&status=" + tweet + " HTTP/1.1\r\n");
// etc.
}
else {
Serial.println("Connection to the server failed!");
}
Checking server response
To check the response from the server, add the following block to your main loop - which will print the server response via the serial console.
delay(50);
while (client.available()) {
String response_line = client.readString();
Serial.println(response_line);
}
To clarify: that code should go inside your loop() function.
The response should include a status line - such as HTTP/1.1 200 OK if the request was successful, or HTTP/1.1 400 Bad Request if there was a problem.
In the case of a Bad request response, the full message will quite likely contain more information about the precise reason the request failed.
HTTP vs HTTPs
Lastly, are you sure that the API supports (plain, unencrypted) HTTP as well as HTTPs? If not, that may be your problem.
I was able to get the mail object with attachment using following API Call
https://graph.microsoft.com/v1.0/me/messages/${messageId}?$expand=attachments
I need to save raw MIME for the mail (i.e. .eml) which will be uploaded to our internal CRM.
I understand that one can make a simple .eml file in below fashion but I want to know if there is a simpler alternative to get this from the API directly.
To: Demo-Recipient <demo#demo.example.com>
Subject: EML with attachments
X-Unsent: 0
Content-Type: multipart/mixed; boundary=--boundary_text_string
----boundary_text_string
Content-Type: text/html; charset=UTF-8
<html>
<body>
<p>Example</p>
</body>
</html>
----boundary_text_string
Content-Type: application/octet-stream; name=demo.txt
Content-Transfer-Encoding: base64
Content-Disposition: attachment
ZXhhbXBsZQ==
----boundary_text_string
Content-Type: application/octet-stream; name=demo.log
Content-Transfer-Encoding: base64
Content-Disposition: attachment
ZXhhbXBsZQ==
----boundary_text_string--
There are two ways one can get a message in raw format (MIME), and both are now available in v1.0 of the Microsoft Graph API:
Append a $value to a get message operation.
If a message is attached as a file or item to another Outlook item (message or event) or group post, you can get that message attachment by appending $value to the get attachment operation.
Get MIME content of a message describes the two scenarios.
In general, keeping an eye on the Microsoft Graph blog site, the what's new topic, or the changelog topic (if it's API or permissions updates) would help you discover additions and updates you were looking for. In particular, the ability to get the MIME format of a message or message type attachment was introduced in April 2019 in the beta version, and promoted to v1.0 in September a few months later.
I'm hoping I can get some help with adding news the D2L. I've tried a lot and have gotten to the point where I don't know what else to try.
The error I keep on getting is 404. So, I'm thinking that either something is wrong with the URL I'm trying, or the data I'm sending (or maybe content type that is being sent).
I saw that when adding news, you need to pass it a multipart/mixed POST body. So, I've tried changing my code to include that, but I'm still not sure what is going on.
I don't think it's a permissions thing because I'm supposed to have full access with this account (and it's not 403, but 404)
This is the data I'm trying to send.
Overall Content Type:
ContentType: multipart/mixed;boundary=6da451c7
Data Being Sent:
--6da451c7
Content-Type: application/json
{"Title":"Test News Title","Body":{"Text":"Testing Testing 123...Testing Testing","Html":"<p>Testing Testing 123...Testing Testing</p>"},"StartDate":"2013-11-17T20:07:11Z","EndDate":"2013-12-02T20:07:11Z","IsGlobal":false,"IsPublished":false,"ShowOnlyInCourseOfferings":false}
--6da451c7
And here is the URL i'm trying to POST data to (slightly modified to not include personal data).
https://gsutest.desire2learn.com/d2l/api/le/1.3/6606/news/?x_a={{TOKEN}}&x_b={{TOKEN}}&x_c={{TOKEN}}&x_d={{TOKEN}}&x_t={{TIMESTAMP}}
I'm not sure where to go from here, any help would be nice. I realize I could be creating my POST body data wrong, but I'm just not sure what to try.
Thanks!
----Edit----
Ran a POST using fiddler and captured this data
POST https://gsutest.desire2learn.com/d2l/api/le/1.3/6606/news?x_a={{APPID}}&x_b={{USERID}}&x_c=OR0KIlHnHChrBvhHT99HVkH4WrD9dw_uPlpTGzKOdXc&x_d=b_TmyIHdTOL3U5bkNa1UNn11S4Yg7Cc3GOBoI911gLE&x_t={{TIMESTAMP}} HTTP/1.1
Content-Type: multipart/mixed;boundary=1649e26b
Host: gsutest.desire2learn.com
Content-Length: 342
Expect: 100-continue
Connection: Keep-Alive
--1649e26b
Content-Type: application/json
{"Title":"Test News Title","Body":{"Text":"Testing Testing 123...Testing Testing","Html":"<p>Testing Testing 123...Testing Testing</p>"},"StartDate":"2013-11-19T21:07:03.838Z","EndDate":"2013-12-04T21:07:01.413Z","IsGlobal":false,"IsPublished":false,"ShowOnlyInCourseOfferings":false}
--1649e26b
----Edit #2----
Ran another POST using fiddler and captured this data. The data that I'm sending came from: http://docs.valence.desire2learn.com/basic/fileupload.html#simple-uploads (under the upload to news section)
POST https://gsutest.desire2learn.com:443/d2l/api/le/1.3/6606/news/?x_a={{APP_ID}}&x_b={{USER_ID}}&x_c=rdzAFVUE6xBS24N5nE_4Hf5sbwpvJH1OVJaK4Ow-XT8&x_d=TmadrEGw55aKwS1uuNo68kvaR_pvYLUWJdsFa7LhrEQ&x_t={{TIMESTAMP}}" HTTP/1.1
Content-Type: multipart/mixed;boundary=xxBOUNDARYxx
Host: gsutest.desire2learn.com:443
Content-Length: 270
--xxBOUNDARYxx
Content-Type: application/json
{"EndDate": null, "IsPublished": false, "ShowOnlyInCourseOfferings": false,"Title": "Test title", "Body": {"Text": "Test body text", "HTML": null},"StartDate": "2013-02-20T13:15:30.067Z", "IsGlobal": false}
--xxBOUNDARYxx
I'm still getting "HTTP/1.1 404 Not Found" as the response headers.
Using the data you provided, I discovered that you are missing the millisecond value in your UTCDateTime format. By adding a millisecond value of .067 and .068 to each of the dates, I am able to POST successfully. I did this by using the Getting Started Sample against an LMS where I have an Instructor account with privileges to POST News items.
To exchange data with another system we send the data as an email attachment to a dedicated address. The email is generated using ActionMailer v3.2.12.
The problem is that when the email arrives at its destination, a redundant attachment named ATT00001.c is a part of the email, in addition to the attachment we created. This causes issues with the import routine at the other end.
A big part of the problem is that we know almost nothing about how the email is being handled at the destination . We also dont know what type of email server is in use and dont have access to check what the email actually looks like when it arrives. We can send it to one of our own addresses and it looks fine there.
I know this is not a lot to go on, but perhaps one of you guys have seen these ATT00001-attachments being added to machine generated emails before.
config.action_mailer.smtp_settings
address: smtp.<mailprovider>.com
port: 587
domain: ourdomain.com
authentication: login
user_name: <removed>
password: <removed>
enable_starttls_auto: false
Update:
We've been able to obtain a copy of the problematic email and it shows the email body rendered after the attachment as an attachment of its own.
We've tried setting ActionMailer's parts_order to make sure the attachment is generated after the email body, it did not help.
Update2:
Sending to my gmail account and showing original raw data I get this.
SENT MAIL
in receipt response from recipient to the correct attachment (the autocreated one creates an error log entry)
(...) cut: to from and through email header information
Mime-Version: 1.0
Content-Type: multipart/mixed;
charset=UTF-8
Content-Transfer-Encoding: 7bit
--
Date: Thu, 28 Feb 2013 12:15:23 +0100
Mime-Version: 1.0
Content-Type: text/plain;
charset=UTF-8
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="thefile.mscons"
Content-ID: <512f3c4b6e875_a8f756dcc642fe#bjorns_arch.mail>
VU5BOisuPyAnVU5CK1VOT0M6Mys3MDgwMDAzNDExNzE2OjE0OlRJTUVSKzcw
... many more lines like this ...
ODAwMDUwNTEyMTc6MTQ6VElNRVIrMTMwMjI4OjEyMTUrUE9XRVNUMTMwMjI4
----
This is with body nil in actionmailer
Next is a RESPONSE from the recipient system, sent to my gmail. It's a receipt on the correct attachment (the extra attachement generates an error, flushing their system)
RECEIVED MAIL
(..) unintersting header stuff with addresses
Content-Disposition: attachment;
filename="afilename.txt"
Content-Transfer-Encoding: base64
Content-Type: Application/EDIFACT; charset="iso-8859-1"
Mime-Version: 1.0
Date: Sat, 16 Feb 2013 11:07:10 +0100
From: ediel#example.com
To: ***#gmail.com
Subject: thesubject
Message-ID: <511f5a53.850a700a.2fa0.2a0eSMTPIN_ADDED_BROKEN#mx.google.com>
X-TM-AS-Product-Ver: IMSS-7.0.0.6298-6.8.0.1017-19380.002
X-TM-AS-User-Approved-Sender: Yes
X-Greylist: Sender is SPF-compliant, not delayed by
milter-greylist-4.0 (isp-app27-vm.isp.example.com [213.239.116.46]);
Sat, 16 Feb 2013 11:07:11 +0100 (CET)
X-ExampleIKT-MailScanner-Information: Please contact the ISP for more information
X-ExampleIKT-MailScanner-ID: r1GA7BqD021150
X-ExampleIKT-MailScanner: Found to be clean
X-ExampleIKT-MailScanner-From: ediel#example.com
X-Spam-Status: No
VU5BOisuPyAnVU5CK1VOT0M6Mys3MDgwMDA1MDUxMjE3OjE0OlRJTUVSKzcwODAwMDM0MTE3MTY6
.. more..
pUSU1FUisxJ1VOVCszKzEnVU5aKzErMjAxMzAyMDAyNDg1Nzcn
something suspicious with the Content-Type? Is a new (empty) attachment generated from the stuff prior to -- in the sent email?
I believe this is to do with inline attachments and Exchange server. Some clients, Apple Mail in particular allow you to add inline attachments, that is, a MIME attachment sandwiched in between text/body parts of an email. Exchange server expects that all attachments appear after any text portion of a mail.
Everything after the attachment in your mail gets treated as an attachment, so the body gets stuffed into a file and named as you reported it to be named. Seeing as you're using ActionMailer, see this answer and possible this answer, which explains that you need to switch the order of the lines of code, and possibly play with some other settings.
Our problem is solved, though unfortunately I cant say what caused the redundant attachment. We worked around it by sending a non-multipart email that contained only the attachment. This solution obviously wont work for people who need to send a multipart email.
Sending non-multipart email with an attachment in Rails is not straight forward. You cant use the attachment helper method and a blank body, you need to put the attachment content in the email body and manually specify the disposition.
class MailMan < ActionMailer::Base
def test
attachment_content = "my attachment"
disposition = "attachment; filename=\"test.txt\""
mail(body: attachment_content, content_disposition: disposition)
end
end
I've managed to get an adaptive payments script to work in the apigee console, here is the request:
X-PAYPAL-REQUEST-DATA-FORMAT: JSON
X-PAYPAL-APPLICATION-ID: APP-80W284485P519543T
X-HostCommonName: svcs.sandbox.paypal.com
Host: svcs.sandbox.paypal.com
Content-Length: 428
X-PAYPAL-DEVICE-IPADDRESS: 127.0.0.1
X-Forwarded-For: 10.203.10.109
X-PAYPAL-REQUEST-SOURCE: APIGEE-CONSOLE-1.0
X-Target-URI: https://svcs.sandbox.paypal.com
X-PAYPAL-RESPONSE-DATA-FORMAT: JSON
Content-Type: text/plain; charset=ISO-8859-1
Connection: Keep-Alive
"{
"actionType":"PAY",
"currencyCode":"USD",
"receiverList":{"receiver":[{"amount":"5.00","email":"cam_1315509411_per#btinternet.com"}]},
"returnUrl":"http://apigee.com/console/-1/handlePaypalReturn",
"senderEmail":"qwom_1315508825_biz#btinternet.com",
"feesPayer":"SENDER",
"cancelUrl":"http://apigee.com/console/-1/handlePaypalCancel?",
"requestEnvelope":{"errorLanguage":"en_US", "detailLevel":"ReturnAll"}
}"
How do I actually post this information to the https://svcs.sandbox.paypal.com/AdaptivePayments/Pay url? I can't find the easiest way to do it, should I use cURL and what are the variables names for each post value?
That depends on the rest of your application. PHP with cURL is fairly straightforward, but it's not too much of a hassle in other languages either.
PayPal has sample code online at https://www.x.com/developers/PayPal/documentation-tools/code-sample/78
If you were to do this yourself, you'd need to (in a nutshell):
- Send a proper HTTP header with the X- headers as shown above including the application ID.
- Send the API call via JSON, SOAP or NVP as POST or GET to the API endpoint
- Decode the response and act accordingly