Community
Showing results for 
Search instead for 
Do you mean 
Reply

Anyone playing with Zapier and wants auth scripting

Nickel Elite Contributor
Posts: 937
Country: USA

Anyone playing with Zapier and wants auth scripting

As mentioned at the conference I managed to get my prototype Zapier connector hooked up against the Premium API.

 

For anyone playing around with Zapier and wanting to get this going...

 

In the Dev view - on your "App" (the connector you're building), under Scriptinmg API go to </> Edit Code.  Here is my code:

 

 

Zap = {
contactid_post_poll: function(bundle) {
if (bundle.response.status_code === 401) {
throw new InvalidSessionException(); // So we can recall get_session_info
}
return JSON.parse(bundle.response.content);
},


get_session_info: function(bundle) {
var api_key,
api_key_request_payload,
api_key_response,
creds2,
uname,
db,
seedval,
trunkuri;

//Setup the obfuscated pass in the Authorization line
uname = bundle.auth_fields.username;
creds2 = bundle.auth_fields.password;
seedval= "Basic " + btoa(uname+ ":" + creds2);
//Pass DB Name
db=bundle.auth_fields.dbname;

trunkuri="https://" +bundle.auth_fields.url + "/act.web.api/authorize";

// Assemble the meta data for our key swap request
api_key_request_payload = {
method: 'GET',
url: trunkuri,
//'https://hootact.com/act.web.api/authorize',
headers: {
"Authorization" : seedval,
"Act-Database-Name" : db
}
};

// Fire off the key exchange request.
api_key_response = z.request(api_key_request_payload);

// Extract the `oken` from JSON.
api_key = api_key_response.content;


// This will be mixed into bundle.auth_fields in future calls.
return {"Authorization" : api_key};
},

contactid_pre_poll: function(bundle) {

//Get to contact interface need to set header with auth + token
var request = bundle.request;
request.headers["Authorization"] = "Bearer " + bundle.auth_fields.Authorization;
return request;
}

};

 

 

 

I have a username, password, dbname, and URL param field for authentication in my App, thus the variables.

 

 

Nickel Elite Contributor
Posts: 937
Country: USA

Re: Anyone playing with Zapier and wants auth scripting

FYI:  here is my Zapier connector to Premium API for development purposes only.  This is very early stage but I do have Create History and Contact going  

 

https://zapier.com/developer/invite/29730/2d42a4b296430880def53c5c55912001/

 

I have some sample zaps - User Voice, O365 Email and Survey Monkey integrations all running against the API.

 

 

Nickel Super Contributor
Posts: 352
Country: Canada

Re: Anyone playing with Zapier and wants auth scripting

I sort of expected this might be broken, but any word on fixing it or how to tweak this to get it to work with the current build?  I get a gateway timeout when I try to set this up.

Len Kamerman
ACT! Certified Consultant

Act E-mail Marketing Trainining Course:

http://actsoftware.training
Nickel Contributor
Posts: 886
Country: USA

Re: Anyone playing with Zapier and wants auth scripting

Allen - I just watched your ACC demo from back in November. I thought you said it was working with Act! Premium for Web, and maybe it is. However, when I went to the Zapier web site I see only Act! Essentials. I emailed Zapier and they say "nothing for Act! Premium for Web as they don't have an API yet".  Can you please clarify, does Zapier work with Act! Premium for Web? 

Dan Pisano
ACT! Certified Consultant
The Dapian Group, LLC
Employee
Posts: 236
Country: USA

Re: Anyone playing with Zapier and wants auth scripting

Dan, you can test drive Zapier Act! Premium app by following this:

https://zapier.com/developer/invite/32776/91dc6b5b73e723b662d9dd6b85c348d8/

 

We're in the pipeline for global activation, so you can expect we'll be in Zapier to the general public shortly.

 

--Xavier