Requirement
- We are working on a requirement where we need to send customer details (FirstName , LastName , EmailAddress) entered into web-form to "External API end point"
- So once customer submit his/her details via web-form , customer will redirect to "Thank You Page" (Cloudpage)
Implementation we did as below
- Once customer submits details via web-form we are sending these details to "Thank you page" via Form -POST method , also on Thank you page we are using HTTPPOST2 ampscript function to send these details to "External-API-Endpoint" as below.
Code on "Thank you Page"
%%[
set @FirstName = RequestParameter('FirstName')
set @LastName = RequestParameter('LastName')
set @email = RequestParameter('email')
set @authurl = "https://staging/SampleEndpoint/"
set @@payload = Concat('{"FirstName": "',@FirstName,'","LastName": "',@LastName,'","Email": "',@email,'"}')
set @key = "xxxxxxxxx-secret-key"
SET @httppost = HTTPPost2(@authurl,"application/json",@payload,false,@apistatusCode,@respheader,"Key",@key)
]%%
Issue -:
- HTTPPOST2 ampscript is taking too much time , resulting slow load of Thank you Page. ( Approx 10-15 seconds )
- Thank you Page is loading only after HTTPPOST2 ampscript processing
- We see Success (200) , and successfully send details to "External API endpoint" but take too much time to load Thank you page
Additional Query I have
Is HTTPPOST2 ampscript function is a secured method/way to send Customer details to external API endpoint from CloudPage?