Whats the best method to send data from a Marketo form embedded on our website to a 3rd party service?
We need to take the information from the Marketo fields put it into an array and send it via CURL. In the header we need to include authorization token.
We get a response from the service
Success- direct user to confirmation page,
error we display error message on page.
Would the webhooks be the right approach?
https://developers.marketo.com/webhooks/
Thanks
Solved! Go to Solution.
We need to take the information from the Marketo fields put it into an array and send it via CURL. In the header we need to include authorization token.
I doubt that. The use of cURL vs. another HTTP library is an implementation detail. No service actually cares if you use cURL to send data to it.
What you want to do here is fire a standard XMLHttpRequest or Fetch from the browser within a Marketo Forms 2.0 onSuccess listener function. This lets you control where the browser goes next. Naturally the 3rd-party service needs to accept those XHR/Fetch requests: they’ll be cross-origin requests by definition, so the correct CORS headers need to be included by the service.
That would certainly work. You can use the form fill trigger to call the webhook and map the response in the setup of your webhook.
No, webhooks won’t work here. A webhook fires after the form has been submitted to Marketo, from within the Marketo platform. So you can’t use a webhook response to redirect someone’s browser to a new location.
@SanfordWhiteman So we would have to redirect them immediately to confirmation page after they complete the form. This means we wouldnt be able to catch the errors from the webhook and display a message to end user.
What about creating an HTML form and sending data to Marketo and service simultaneously?
We need to take the information from the Marketo fields put it into an array and send it via CURL. In the header we need to include authorization token.
I doubt that. The use of cURL vs. another HTTP library is an implementation detail. No service actually cares if you use cURL to send data to it.
What you want to do here is fire a standard XMLHttpRequest or Fetch from the browser within a Marketo Forms 2.0 onSuccess listener function. This lets you control where the browser goes next. Naturally the 3rd-party service needs to accept those XHR/Fetch requests: they’ll be cross-origin requests by definition, so the correct CORS headers need to be included by the service.
what is the use case? I don't think you've given us enough information to work out how to help you.
Why send it to a third party service for validation?
Why not use JS on page to do the validation?
etc.
I assume it’s something like an email validation service or an enrichment service. So not something that could be reimplemented locally.
The service is our user management platform. Basically we are offering a version of a free trial of our software.
Website visitor fills out lead form and we create an account for them. We need to check if the user exists already in our database. If they do we return a response saying "this user already exists".