crim / pardot-java-client Goto Github PK
View Code? Open in Web Editor NEWA Java Client for the Pardot API
License: MIT License
A Java Client for the Pardot API
License: MIT License
In class SsoLoginRequest there is getApiHostname stub method that return always https://login.salesforce.com.
For the test environment, the login failed.
"The Pardot API currently requires a Pardot user to access, but starting with the Summer ’20 release the Pardot API will be available to Salesforce users as well. Once available, all Pardot API integrations will need to be updated to authenticate with a Salesforce user before the Spring ’21 release." - https://help.salesforce.com/articleView?siteLang=en_us&id=000353746&language=en_us&type=1&mode=1
It looks like the Salesforce OAuth is currently unsupported (not surprised with its recent implementation). I am currently working on integrating with the Pardot API and may get by with the existing Pardot authentication mechanism with this library, but would need to switch before the cutoff date. This may be something I can do with a little overriding of certain methods, but would prefer a first-class solution in the library itself.
Additional documentation on authentication: https://developer.pardot.com/kb/authentication/
It is possible to add cc or bcc in send email request? (i.e. EmailSendOneToOneRequest)
Hi,
when we call this method with a prospect that not exists in Pardot (email):
pardot.prospectRead(request);
we retrieve this error:
com.darksci.pardot.api.InvalidRequestException: Invalid API key or user key
How we could check if a prospect exists in Pardot without errors?
Pardot is dropping support for TLS V1.0, so lets migrate the client to use TLS v1.1
Hi,
is there any way to use pardot's dynamic content via API?
I can't find a way to download this content.
Is there any documentation for the library? The links just take one to the Pardot API...
Having to rely on suggestion for my IDE to figure out how this thing works.
Hi,
we use this library to send emails thought Pardot. When constructing the EmailSendOneToOneRequest request and we don't fill the withFromUserId field we get this error:
One or more required parameters are missing: (from_name AND from_email) OR from_user_id
Why isn't used the sender defined in the template?
It would be good to have this implementation, because Pardot API calls are limited.
@Crim is it possible to implement by you or you need help with it?
We need to have similar like this if possible:
existing: public Optional<Prospect> prospectRead(final ProspectReadRequest request)
expecting: public List<Prospect> prospectRead(List<ProspectReadRequest> request)
We are trying to use the 3.0.0 client in a Red Hat Fuse container which is an OSGI container and its failing because the MANIFEST.MF for this JAR does not contain the OSGI info.
EmailSendListRequest.java
public EmailSendListRequest withScheduledTime(final DateTime dateTime) {
return setParam("scheduled_time", dateTime);
}
dateTIme.toString() does not returns acceptable format per pardot integration.
Instead - format should be someting like
public EmailSendListRequest withScheduledTime(final DateTime dateTime) {
String date = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").format(dateTime.toDate());
return super.setParam("scheduled_time", date);
}
HttpClientRestClient.java
private <T> T submitRequest(final String url, Map<String, String> postParams, final ResponseHandler<T> responseHandler) throws IOException {
...
post.setEntity(new UrlEncodedFormEntity(params));
...
}
By default new UrlEncodedFormEntity(params) uses HTTP.DEF_CONTENT_CHARSET (ISO_8859_1)
With that a lot of languages are going to struggle - maybe UTF-8 will be a better fit?
post.setEntity(new UrlEncodedFormEntity(params, Consts.UTF_8));
Or at least method/config should be exposed.
post.setEntity(new UrlEncodedFormEntity(params, configuration.getDefContentCharset()));
It would be good to have this implementation as well.
Hi, we are using this library to integrate our app with pardot.
Our prospect request:
ProspectCreateRequest prospectCreate = new ProspectCreateRequest (); Prospect prospect = new Prospect (); prospect.setEmail(contactSf.getEmail()); prospect.setPhone(contactSf.getMobilePhone()); prospect.setFirstName(contactSf.getFirstName()); prospect.setLastName(contactSf.getLastName()); prospect.setCampaignId(this.getCampaignId()); prospect.setDoNotEmail(false); prospect.setOptedOut(false); prospect.setCrmContactFid(contactSf.getSfid()); prospect.setCustomField("Language", contactSf.getPreferredLanguage()); prospectCreate.withProspect(prospect); resultProspect = Optional.of(pardot.prospectCreate(prospectCreate));
but on pardot this prospect isn't linked to relative contact on salesforce, and when we print the resulting prospect the field crmContactFid is null:
log.info("Prospect added: {0}", resultProspect.get().toString());
Prospect added: Prospect{id=55127585, campaignId=182472, salutation='null', firstName='null', lastName='Test', email='[email protected]', company='null', prospectAccountId=0, website='null', jobTitle='null', department='null', country='null', addressOne='null', addressTwo='null', city='null', state='null', territory='null', zip='null', phone='null', fax='null', source='null', annualRevenue='null', employees='null', industry='null', yearsInBusiness='null', comments='null', notes='null', score=0, grade='null', lastActivityAt=null, recentInteraction='Never active.', salesforceFid='null', crmLeadFid='null', crmContactFid='null', crmOwnerFid='null', crmAccountFid='null', crmLastSync=null, crmUrl='null', isDoNotEmail=false, isDoNotCall=false, optedOut=false, isReviewed=false, isStarred=false, createdAt=2021-06-25T09:28:36.000, updatedAt=2021-06-25T09:28:36.000, assignedTo=null, customFields={}, campaign=Campaign{id=182472, name='Transactional Notifications', cost=null, folderId=null}, profile=Profile{id=723, name='Default', profileCriteria=[ProfileCriteria{id=3627, name='Company Size', matches='Unknown'}, ProfileCriteria{id=3629, name='Industry', matches='Unknown'}, ProfileCriteria{id=3631, name='Location', matches='Unknown'}, ProfileCriteria{id=3633, name='Job Title', matches='Unknown'}, ProfileCriteria{id=3635, name='Department', matches='Unknown'}]}, visitorActivities=null, listSubscriptions=null, visitors=null}
Why when we create a prospect with contact sf id this isn't created linked to the Salesforce Contact?
Hi,
we have encountered an issue in send list email, below our code:
ListCreateRequest requestList = new ListCreateRequest ();
com.darksci.pardot.api.response.list.List list = new com.darksci.pardot.api.response.list.List ();
list.setCrmVisible(false);
list.setDynamic(true);
list.setPublic(false);
list.setName("Remedy Email List - " + UUID.randomUUID().toString().substring(0, 8));
list.setTitle(list.getName());
requestList.withList(list);
list = pardot.listCreate(requestList);
for (Long prospectId : listIds) {
ListMembership listMembership = new ListMembership ();
listMembership.setProspectId(prospectId);
listMembership.setListId(list.getId());
listMembership.setOptedOut(false);
ListMembershipCreateRequest members = new ListMembershipCreateRequest ();
members.withListMembership(listMembership);
pardot.listMembershipCreate(members);
}
EmailSendListRequest request = new EmailSendListRequest ();
request.withCampaignId(this.getCampaignId());
request.withListIds(Arrays.asList(new Long [] {list.getId()}));
request.withFromUserId(pardotUser.getId());
request.withName(pardotUser.getFirstName());
request.withHtmlContent(htmlText);
request.withTextContent(text);
request.withSubject(StringUtils.isEmpty(requestDto.getSubject()) ? emailTemplate.getSubject() : requestDto.getSubject());
request.withEmailTemplateId(emailTemplate.getId());
DateTime dateTime = new DateTime ();
dateTime = dateTime.withFieldAdded(DurationFieldType.minutes(), 1);
request.withScheduledTime(dateTime);
Email email = email = pardot.emailSendList(request);
when we call pardot.emailSendList(request);
the library doesn't return and the thread remaining blocked inside this method.
This issue occurs only for some prospect, so could depend from pardot APIs?
we are using 3.2.0 version of your library.
Salesforce provides many different OAuth flows to meet specific security and integration needs. Currently only password flow is implemented. So it would be good to have Web Server OAuth flow implementation, which works with grant_type=authorization_code and access token.
This flow is great when you want the end-user to enter their credentials to authorize the integration and you don’t want to store the credentials on your system since it could be a security risk.
Hi, when we try to create a list on the Pardot training environment we don't have the possibility to create a test list. In this kind of environments only test email lists can be sent.
In the List class we have only these properties:
private Long id;
private String name;
private String title;
private String description;
private Boolean isPublic;
private Boolean isDynamic;
private Boolean isCrmVisible;
@jsonformat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime createdAt;
@jsonformat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime updatedAt;
Custom fields can have Multi-Select type and contain > 1 value.
In this case we see:
"error": "Cannot deserialize instance of java.lang.String out of START_OBJECT token\n at [Source: (StringReader); line: 54, column: 10] (through reference chain: com.darksci.pardot.api.response.prospect.ProspectReadResponse["prospect"]->com.darksci.pardot.api.response.prospect.Prospect["Add_Prospect01"])"
Root cause:
https://github.com/Crim/pardot-java-client/blob/master/src/main/java/com/darksci/pardot/api/response/prospect/Prospect.java#L125
src/main/java/com/darksci/pardot/api/response/prospect/Prospect.java:125
private Map<String, String> customFields = new HashMap<>();
is it possible to inhibit the logs printing that this pardot library? When you get the template it is printed on the console filling the available space.
if a string is returned for the account request then json conversion exception occurs.
i made a fix for that:
#78
Something like:
/**
* Selects prospects that were last updated after the specified time
* @param updateAfter The date to filter.
* @return RequestBuilder
*/
public ProspectQueryRequest withUpdateAfter(DateParameter updateAfter) {
return setParam("updated_after", updateAfter);
}
Thank you for the package. Thank you for updating with the new Authentication
I am using this library . I have requirement to get Prospects which are deleted but deleted search criteria not implemented yet.
Thanks in advance.
I am using ProspectQueryRequest to get Prospects records but it is logging a huge xml response on every request. Is there any way to stop this logging mechanism?
Thanks in advance :) .
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.