SOLVED

Re: Need Help Using a Webhook to push leads into Cvent using their SOAP API

Go to solution
Anonymous
Not applicable

Need Help Using a Webhook to push leads into Cvent using their SOAP API

Hello!

Our Marketo & Cvent instances are already integrated, with Cvent being able to push leads to us via a triggered campaign using a Web Service API call. However, we would like to have all registration forms and what not on the Marketo side, so we can control campaign flow, and then push the registrants back into Cvent.

From the documentation I saw on Cvent, it looked like this would be something I could do with their SOAP API user, using a Marketo webhook. I was then provided info for their API user: an account, an Account, an API Username, and an API Password, along with their server URL.

That said, I'm new at webhooks, and I'm not sure I'm constructing it correctly...in that I know I'm not using it correctly, but I have no idea what I'm doing wrong. I set up the webhook like so:

URL: https://api.cvent.com/soap/xxxxxxx.ASMX?xxxx

Request Type: Post

Template: Account=accountName&Key=accountPassword&fieldX={{lead.fieldX}}&fieldY={{lead.fieldY}}&fieldZ={{lead.fieldZ}}

Request Token Encoding: JSON

Response Type: XML

I know this isn't right, but I modeled it off of another Webhook I saw, which is how I got 'account=xxx&Key=xxx'. But I don't really have a key provided, just the username and password, which, my understanding is, that I'll only have a key provided once I have a successful login?

Just to show you how not right it is, I ran a triggered campaign to call the webhook, and I get the following error, which I find very amusing:

<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><soap:Fault><soap:Code><soap:Value>soap:Receiver</soap:Value></soap:Code><soap:Reason><soap:Text xml:lang="en">Server was unable to process request. ---&gt; Data at the root level is invalid. Line 1, position 1.</soap:Text></soap:Reason><soap:Detail /></soap:Fault></soap:Body></soap:Envelope>


So, dear community members, would you be able to help me figure out what I need to do to construct this?

And, if my approach is 100% not right, do any of you have ideas on how to push lead updates into Cvent from Marketo?

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Need Help Using a Webhook to push leads into Cvent using their SOAP API

A simplified diagram is below.  Note the entire process takes place while the webhook connection (1) is still open -- you connect to the gateway, the gateway does SOAP stuff including the auth layer, then passes the response back to Marketo (in your case probably just a success/failure response since you're pushing via SOAP).

You could use XML for the webhook payloads as well but JSON is way easier to type, so since you're not forced to use XML there I would use JSON.

pastedImage_1.png

View solution in original post

10 REPLIES 10
SanfordWhiteman
Level 10 - Community Moderator

Re: Need Help Using a Webhook to push leads into Cvent using their SOAP API

Hi Alex,

Yes, that definitely is not a SOAP payload. SOAP uses XML (for both request and response).

Are you positive that this API is suitable for webhooks? Does it have a separate authentication step? If so, it would have to be gatewayed via another intermediate webhook. Where's the documentation?

Anonymous
Not applicable

Re: Need Help Using a Webhook to push leads into Cvent using their SOAP API

Hi Sanford!

Yeah, I'm more used to working with REST APIs (you've actually helped me answer a bunch of questions with those when I was at another company ), so I'm still getting familiar on how SOAP is different.

There apparently *is* a separate authentication step, though I don't know how to make it work with the webhook.

Unfortunately, I have documentation, but I can't attach or send from my office due to security constraints. However, I can copy/paste the relevant bit from the Cvent documentation:

Use the Login call to log in to the Cvent server and start a client session. A client application must log in and obtain a

CventSessionHeader and server URL before making any other API calls. If you are not sure what your API credentials are,

contact your account manager.

Basic Steps

1. A client application invokes the Login call, passing in the Cvent account number, username, and password.

2. Upon calling, the Web service authenticates the login, and verifies if the request is coming from any of predefined

IP addresses. You can set up your list of allowed IP addresses. To do this, log into your Cvent account and go to

Admin > Integrations > SOAP API Usage and click Edit next to your API username.

3. If authentication is successful, the Login call returns the CventSessionHeader for the session and the URL that

should be used to make all subsequent API calls for that session.

Note: Sessions automatically expire one hour after the session was created.

4. After logging in, a client application needs to set the CventSessionHeader in the SOAP header so the Cvent Web

service can validate subsequent requests for this session. Then specify the server URL as the target server for

subsequent service requests.

Note: Development tools differ in the way you specify session headers and server URLs. For more information, see

the documentation for your particular development tool.

General Syntax

LoginResult = cventapi.Login(string AccountNumber, string UserName, string Password)

So my question to you now is...what do I need to do to get through this login step?

Note, I just installed Postman, hopefully that'll make this a little easier...

SanfordWhiteman
Level 10 - Community Moderator

Re: Need Help Using a Webhook to push leads into Cvent using their SOAP API

You won't be able to call this API as a webhook directly. You'll need an intermediate webhook to do the auth, followed by the data request, then return the response to Marketo.

Anonymous
Not applicable

Re: Need Help Using a Webhook to push leads into Cvent using their SOAP API

Gotcha. How would that be structured (or, at least, could you point me in the right direction to research)? I've been given a copy of Fiddler to handle requests, but I'm not sure if that's something that will prove useful or not.

SanfordWhiteman
Level 10 - Community Moderator

Re: Need Help Using a Webhook to push leads into Cvent using their SOAP API

A simplified diagram is below.  Note the entire process takes place while the webhook connection (1) is still open -- you connect to the gateway, the gateway does SOAP stuff including the auth layer, then passes the response back to Marketo (in your case probably just a success/failure response since you're pushing via SOAP).

You could use XML for the webhook payloads as well but JSON is way easier to type, so since you're not forced to use XML there I would use JSON.

pastedImage_1.png

Anonymous
Not applicable

Re: Need Help Using a Webhook to push leads into Cvent using their SOAP API

Good info, thanks!

I finally got the handshake call to work, which means I now get a response with a session header.

So now that we've got that out of the way, what's the best way to set up that 2nd call to push the information into Cvent? I need the session header in order to authenticate the push.

My thought was that I could somehow do a response mapping where I pop in the session header into a custom field, and then use that custom field in the 2nd payload, but I'm still trying to figure out how to format it. An example response looks like the following:

<?xml version="1.0" encoding="utf-8"?>

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">

<soap:Body>

<LoginResponse xmlns="http://sample.api.here">

<LoginResult LoginSuccess="true" ServerURL="http://sample.api.URL/yay" CventSessionHeader="SampleSessionHeader" ErrorMessage="" xmlns="sample.api.here" />

</LoginResponse>

</soap:Body>

</soap:Envelope>

The response mapping I would then feasibly try to use is LoginResponse.LoginResult.CventSessionHeader...right? I'm currently testing it right now, though I rarely get these things right on the first try, so I imagine there's something I'm missing.

Once that's figured out, I was basically thinking it would look something like this:

1. User fills out form, Webhook #1 is called

3. 2nd active campaign sees that webhook #1 is called, plus a filter of "user has filled out form", and then calls a 2nd webhook to push in the info

My other concern here is that a session is good for an hour. If two people fill a form out within a few minutes of each other, can I expect that to cause issues, as the first call always returns a different session header? I guess I could try putting in a wait step? Like, user fills out form, and if webhook #1 has been called in past 1hr, then wait 15 minutes before calling it again? Or is there a way to use that session header for multiple 2nd round calls for the hour that it's valid?

Thanks!!

SanfordWhiteman
Level 10 - Community Moderator

Re: Need Help Using a Webhook to push leads into Cvent using their SOAP API

I feel like you didn't follow that you can't reasonably do this with 2 webhooks? At least I would never try to do it that way, too much room for error and not what webhooks (which are stateless) are designed for.

Instead, Marketo connects -- one webhook call total per lead -- to an intermediate service (which you write and/or maintain). That service handles sessions, incl. caching session/identity keys (the identity endpoint may even be throttled, so you can't constantly call for a new key).

Anonymous
Not applicable

Re: Need Help Using a Webhook to push leads into Cvent using their SOAP API

Yes, you're right, I am still learning and didn't immediately understand. I went back and looked and it makes more sense now...I need a service in the middle to push the webhooks to, and then it in turn will manage my sessions with cvent.

Could you give an example of an intermediate service that I could utilize for this?

SanfordWhiteman
Level 10 - Community Moderator

Re: Need Help Using a Webhook to push leads into Cvent using their SOAP API

I went back and looked and it makes more sense now...I need a service in the middle to push the webhooks to, and then it in turn will manage my sessions with cvent.

Right.

Could you give an example of an intermediate service that I could utilize for this?

Depends on your level of coding skill, I'd say. You could turn this around quickly in any language, especially if you don't care about caching the SOAP session key across requests (merely reusing the session key within a single webhook call). Could host a single-purpose PHP page on someplace like FortRabbit, or Java/JS on AWS Lambda or similar serverless environment.

But more to the point -- I'm not allowed to make a specific suggestion publicly due to Community rules.