How do I send the data to external API after a form is submitted on a landing page ? | Community
Skip to main content
April 19, 2016
Question

How do I send the data to external API after a form is submitted on a landing page ?

  • April 19, 2016
  • 2 replies
  • 5262 views

I have a marketo form on another landing page. I need to hit another external API to send the form data when the form is submitted. Please let me know what is the way of doing this in marketo.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

2 replies

Grégoire_Miche2
Level 10
April 19, 2016

Hi Nitish,

Use a webhook, as per your other post earlier today (Call webhook on form submission ). This is the only mechanism in Marketo than enables Marketo server to call an external service.

You also could use some Javascript on your LP and the forms 2.0 API (Forms 2.0 » Marketo Developers ​) but this would be a client side integration (the call would be done from the visitor's browser).

-Greg

SanfordWhiteman
Level 10
April 19, 2016

Nitish, please provide details about this "external API."  There's no single correct answer here.  As Greg mentioned, you can use a webhook to call an external API from the server side. However, if the API is equipped for cross-domain communication, you can call it from the browser which is far more efficient (there is no reason to involve the Marketo server in the transaction, as it just creates a possible bottleneck).

April 20, 2016

Hi Stanford, We want to directly feed a lead to our product 'ConnectAndSell' from Marketo form which in turn will dial the lead and will connect them to the users. Yes the API is equipped with cross-domain communication.

Grégoire_Miche2
Level 10
April 20, 2016

Hi Nitish,

Then you will need to call the API from the browser, on form submit. This will be done using the Javascript Forms 2.0 API. In the line of

MktoForms2.loadForm("//app-sjst.marketo.com", "785-UHP-775", 1057, function(form) {

    // Add an onSubmit handler

    form.onSubmit(function(){

        // Get the form field values

        var vals = form.vals();

        // You may wish to call other function calls here, for example to fire google analytics tracking or the like

        // callSomeFunction(vals);

        // We'll just alert them to show the principle

        alert("Submitted values: " + JSON.stringify(vals));

    });

});

-Greg