0

I need to integrate an external form with Marketing Cloud, but it can't be done using DEManager.

I'm trying to use a webhook, which posts the form data into a CloudPage, but it's not working. When I use the Ampscript RequestParameter fuction, the webhook receives a HTTP 500 response code.

Is it possible to perform this action using SSJS? I'm also trying to use the Platform.Request.GetPostData() and the Platform.Function.ParseJSON() functions, with no success.

Does the Landing Page must be rendered in the browser to get this working?

EDIT

Here is my code:

%%[ 

Var @DataExtension,@email 

Set @DataExtension = 'LP GetSiteControl'

Set @email = RequestParameter('email')

InsertData(@DataExtension,'email',@email)

]%%
  • 1
    500 most likely means there is an error in your script. Can you post Cloud Page code? – Mateusz Bartkowiak Jul 13 at 9:25
  • @MateuszBartkowiak I just posted my Cloud Page code. When I submit the form, blank rows are added to the data extension. – Sergio Souza Jul 15 at 14:45
1

I would try two things:

1) In order for this to work also consider your data extension. If you e.g. have "email" as primary key, a duplicate entry will trigger a 500 (so your form might work once with an empty string, then fail). Also ensure that your input matches the Data type of the field.

2) your sending page should POST with the following two Headers:

accept-encoding: gzip 
Content-Type: application/x-www-form-urlencoded

The content-type means that the payload sent has to be assembled as a string in which the name/value pairs are concatenated, like this:

ContactKey=1234124&orderNumber=100007394&orderStatus=pending

,not in the form of a JSON or Javascript Object. Note there is no leading "?" as in a GET Query string.

  • Thank you Jonas. The webhook was sending the data in JSON format. I've chosen another webhook to integrate, which uses the "application/x-www-form-urlencoded" Content-Type and it's working now. – Sergio Souza Jul 18 at 18:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.