This topic contains 4 replies, has 3 voices, and was last updated by lev 8 years, 3 months ago.
Using Iguana to talk to salesforce.com
-
I know that there are definitely customers that have done this since I know of a few large sites which Iguana is used a lot where saleforce.com is a big part of the environment.
There is a little bit of finagling in terms of getting the handshaking right to get a session with saleforce.com – I was wondering if anyone who has done it would be happy to share a few lines of Lua code to do it?
There is a good REST API to use:
https://www.salesforce.com/us/developer/docs/api_rest/
So it doesn’t look that hard but I thought I would ask to see if anyone else has done this before we dive in.
Hi Eliot, as I shared via our email conversation, OAuth2 is required by SF for authentication and there’s more than a few lines of code to implement it in Iguana, especially since you need to maintain state between invocations due to the fact that session tokens expire and need to be refreshed periodically. We built this functionality for a customer recently and it’s working well, but there’s setup in Salesforce to enable access to the appropriate SF objects, code in Iguana to manage the sessions tokens, and a separate Iguana facility needed to re-establish authentication in the event the external app/user account is deleted/recreated or its password reset.
Jeff Drumm ◊ VP and COO ◊ HICG, LLC. ◊ http://www.hicgrp.com
I think what we found confusing was much of the salesforce.com documentation is a little out of date with how screens look etc.
Do you need to have a receiving web service – i.e. outside of the firewall to get notifications back from saleforce.com?
It depends on the type of interface you’re building. If what you want is effectively real-time events from Salesforce, you’d need to write some Apex code on the SF side to invoke an Iguana web service and associate it with a SF trigger. The trigger would fire off the web service invocation when an update is necessary.
We didn’t do that, even though there’s data flowing in both directions. The “inbound” interface polls SF every 30 seconds, calling a SOQL query to fetch the attributes for the objects that have been updated.
Jeff Drumm ◊ VP and COO ◊ HICG, LLC. ◊ http://www.hicgrp.com
Given the app on ‘salesforce’ side had been properly configured and kindly contributed by one of our customers, the following line worked for us today for first successful authentication using OAuth2:
function main()
local Url = 'https://login.salesforce.com/services/oauth2/token'
local grant_type = 'password'
local client_id ='my_client_id'
local client_secret ='my_client_secret'
local username = 'my_user_name'
local password ='my_password'local Auth = {grant_type = grant_type,
client_id = client_id,
client_secret = client_secret,
username = username,
password = password}local J = net.http.post{url = Url,
parameters = Auth,
live=true}local T = json.parse(J)
local accessToken = T.access_token
local signature = T.signature
end
You must be logged in to reply to this topic.