SendGrid Random HTML Comment Response - sendgrid-api-v3

Have been trying to create a campaign with SendGrid API. Adding lists, recipients, and recipients to lists all works fine. However, as soon as I try to add a new campaign my curl response is:
<!-- This is a random-length HTML comment: jbxzwrreejuenlcislnnrtqpepguufquskweywdclekzbirxeqwozopyiewqhjumbhfwyepoosmzwyazpdzexczablujrbjiixmmmqjsashcfuwhguidzmnlqwpkmqkyqiuwbrdbiikvyyfkdxzfkcfvhsiqhpwowvtgvydjfabodxkdoycmhxhwhrqznppcaxevndlmftpomkoivcbkeonofgabbwalstlrajpptuhfdananzdgzlnavbinpxyzrgknkrqhyywwdnyhvgmwkvrcvheadfgdqvfviqdnrniqzfijxchyecjyzleznlwbfdlfbuwrbzlkaeftbhsiyoluymrzohgqxesvxxiadcpucmufdhcoenyeoagnssktmphhaximhfegozmayralqxdbbjfcoxxgeoqjsnbgyejalqmmpesmepqnbwykjaaorvljcxttkasnqxbkvrsshwkzywazfltmiyqdzugoezoaeynbkfsldmliqyiujnnriwgzendfgllnhyhxisimqojpncarhhhcyfxecwentpymluxvakpffuednakvxtplgclyjgprpyvwabkqldocwehynpucpgjukycrbsflglqljjitquqxnghesizdofkdvnzmxdrfopjqtvqvzffndalnaupeclmldvgoabignoeccpkbemyjyjeumyxzefrysrbtwpbdrhnkomvlnsrwctxwzioafmmovkybzpanychdfuvxovsnkuxchzmnuogngdcnuvaxuaejfwh -->
Which isn't even JSON. It worked earlier, and on previous days, but all of a sudden the API responses are making no sense.

Related

How to create custom URL in apex to get Json response from third party application

I am sending some perameters to the third party application using rest api In one of the perameter I am sending A URL, This URL will use by third party application to send a json response after 5 or 10 min. My question is how may i create that URL for third party app that they will use to send the response.
If the 3rd party can send HTTP headers too you could send to them the current user's session id. If that user is API enabled (checkbox in profile/permission set) - you could write an Apex REST service that accepts POSTs. They'd call it with Authorization: Bearer <session id here> and it could work very nice. This trailhead might be a good start for you. (or can you contact their developers and maybe agree to make a dedicated user in SF for them so they'd log in under their own credentials and send it back?)
If they cannot send any special headers (it'd have to be unauthenticated connection to SF) - maybe you could make a Visualforce page, expose it as Site and then page's controller can do whatever you need. Maybe you already have something public facing (community?), maybe it'd be totally new... Check https://developer.salesforce.com/docs/atlas.en-us.206.0.salesforce_platform_portal_implementation_guide.meta/salesforce_platform_portal_implementation_guide/sites_overview.htm
If none of these work for you - does the url have to ping back to Salesforce. Maybe you have control over another server that can accept unauthenticated requests like that and have that one then call SF. Bit like a proxy. You could even set something up fairly easily on Heroku.
Last but not least. This would be extremely stupid but if all else fails - in a sandbox enable Web-to-Case or Web-to-Lead and experiment with these. At the end of the day they give you an url you can POST to and pass a form with data. I think it'd have to be Content-Type: application/x-www-form-urlencoded and if you mentioned JSON they're likely to send it as application/json so might not work. If it works - you could maybe save the payload in Description field of Cases (special record type maybe?) and do something with it. I'm seriously not a fan of this.

Microsoft Store collection REST API, Create Azure AD access tokens returns 404

I'm following the Tutorial "Manage product entitlements from a service" here,
Am getting stuck on step 3, where calls to request an access token return a 404 error.
Step1: In Azure Portal,
Created new WebApp, gave it a name & accepted all the defaults.
Selected the default AD directory and registered the app (used the
APP URL as the login URL).
Grabbed the AP ID _APP_ID_ and created app key _APP_SECRET_.
Updated manifest, replaced identifierURIs as described.
"identifierUris" : [
"https://onestore.microsoft.com",
"https://onestore.microsoft.com/b2b/keys/create/collections",
"https://onestore.microsoft.com/b2b/keys/create/purchase"
],
Step2: In MS DevCenter
Added _APP_ID_ to "Services-> Product collections and purchases -> Client ID".
Step3: Testing using Postman
I pulled the Azure AD Tenant ID _TENANT_ID_ from the PortalDiagnostics.json.
Using the provided sample, I used postman to post as follows:
POST https://login.microsoftonline.com/_TENANT_ID_/oauth2/token HTTP/1.1
Host: login.microsoftonline.com
Content-Type: application/x-www-form-urlencoded; charset=utf-8
grant_type=client_credentials
&client_id=_APP_ID_
&client_secret=_APP_SECRET_
&resource=https://onestore.microsoft.com
Host and content type are set in the headers, remainder is posted as raw text in the body.
POSTMAN with headers & body
POSTMAN headers
POSTMAN body
As you can see, the result is a 404 with no body, making this a little tough to trouble shoot.
Question:
Have I missed something obvious in steps 1 & 2?
Should I be able to test this with POSTMAN?
I'd appreciate any pointers; I can't find any other tutorials to cross reference.
So in this case the problem was a rogue HTTP/1.1 at the end of the URL + some unencoded content in the form data. Using Postman's x-www-form-urlencoded tab helped for that since it encodes all the fields for you.

Create Docusign documents and send emails from another system

I am trying to integrate Salesforce and Docusign. I'd like to send Create documents through a soap / rest call, and surpress the notification to the recipient. From Salesforce I'd like to send out the link to the envelope / documents through a branded email.
Is that possible? It seems like DS only supports a createAndSend call.
This documentation says I can create an envelope in draft form - https://docs.docusign.com/esign/restapi/Envelopes/Envelopes/create/ . It also says I get an envelope summary as a response.
https://docs.docusign.com/esign/restapi/Envelopes/Envelopes/create/#/definitions/envelopeSummary
As others have noted, Embedded Signing is the answer here. I've just done this with a client.
You would build the envelope with the SOAP API (good receipies from DocuSign on how to do this with APEX here: https://www.docusign.com/developer-center/recipes/docusign-for-salesforce).
When you define the Recipient, you would provide the ClientUserId in a CaptiveInfo object (use the ContactId for this). This tells DocuSign to skip sending the recipient an email, and you will handle this yourself.
Create and send the envelope (you can use templates as well).
You will need a portal or public Force.com site to move forward. The reason being that the URL for signing is a one-time-use link, and it expires 5 mins after it's generated. So you can't store it or send it in an email. By the time they click the link it will be dead.
So instead, you link to a Visualforce page you control. Add the ContactId to the URL as a parameter, so you know who is looking at the page.
When they load the page, you should have the Visualforce controller lookup the EnvelopeId (so if the page is about an Opportunity, you should store the EnvelopeId on the Opp or somewhere handy) and the recipient (use the ContactId to get the info about the recipient).
You then send this to DocuSign with the RequestRecipientToken method. It will return the token URL, and you can present it to the user.

Responses to emails sent from the API not threaded

I noticed that when I send messages from the gmail API and then get an email response to them, the response is never threaded with the original message. Repro steps:
On gmail.com, create a new email draft to someone. Don't send it.
Go to https://developers.google.com/gmail/api/v1/reference/users/drafts/list and log in at the bottom. Enter 'me' for userId and click Execute to get the ID for your draft.
Go to https://developers.google.com/gmail/api/v1/reference/users/drafts/send, log in at the bottom, enter 'me' for userId and fill in the ID from step 2. Click Execute to send the draft.
Have the other person respond to your email.
On gmail.com, the person's response is not threaded with the original email that was sent. However, this works just fine if you send from the gmail UI instead of the API. In examining the headers, the only difference is that the API adds a second 'Received' header. I'm not sure if this is the cause of gmail not threading.
Has anyone else seen this? What is the gmail.com UI different from the API when sending a draft?
It was a bug. Barring issues rolling out the fix, should be resolved by next Weds, July 9th.

How to send a multipart/mixed HTTP POST request through Runscope?

I want to send a HTTP POST request with Content-Type: Multipart/mixed using Runscope.
Any help/guidance would be great.
There are a couple ways to send data through us, each with varying support for multi-part form data.
Dashboard
When making requests through the dashboard, there is currently no way to add files or other multi-part data to a request. This is something we plan to support in the future, but we don't have a specific timline for implementing it yet.
From your code, via a Runscope URL
When you make a request from code that includes multipart data, it will be relayed through the Runscope URL in tact. The dashboard will display the file meta data that it relayed, but the files are not stored or displayed and retries will not re-send the file data again.
We're happy to help answer any questions in more detail by emailing us at help#runscope.com any time.

Resources