I tried to look for this way of adding a Zap action into an HTML button either for a website or a rich email but I couldn't find one.
Obviosuly, adding a link to a button is very simple; but is there a way to create a such Zapier link? That will trigger a Zap.
I believe webhook will trigger via a GET request with query params. So if you have an HTML button that sends the user to such a URL, it'll kick off an action.
You should also be able to use an onClick handler to call fetch to send a POST request to the webhook url. But, there may be CORS issues with this approach.
Related
In emails, the only type of action possible is to send link (GET method).
What is the correct approach to send a link that will execute a POST action in the app (Eg. accept friendship)?
I see two possible solutions:
custom GET action only used in the email (eg. /action?type=accept_friendship&user_id=10)
get to a page and execute javascript on load to execute the action (eg. what Twitter does to follow back a user from an email)
How does those solutions compare? Are there others?
Thanks
A link with a GET action is ok as long as you include a unique token in the url to confirm validity & origin of the action
I want (in my rails app) to submit a post request to another site, setting some headers, when the user clicks a button. I want the user to be sent to the other site (rather than just have a request in the background or something).
I'm a bit stuck: my understanding so far is
a) Regular form submission (which handles the POST) can't set headers, so i can't just have a regular form on the page.
b) I could set headers in the controller, make the button go to that action, then send the request from there, but i can't do a POST redirect_to so this isn't possible.
Are either of the above possible after all? Is there another way to do this?
I have one web application running on Struts. User is hitting below url directly from browser -
http://:/Test/servlet.do?name=XX&address=YYY
By default this request is submitted as GET by the user. Now my question is
1) how do I change user request to POST?
Use JQuery post or ajax methods, using an empty form with hidden keys.
There are plenty of browser add-ons that will let you send your request as POST (such as DHC by Restlet and Advanced REST client for Chrome)
Remember GET is inside the ans is set into links. POST are usually done by , or GET is possible too. So hitting a URL or link as you said is not possible to do over html, use PHP or Jquery so have it GET instead .
In rails, can I get a form submit to send the info in the form both to an external URL, and also post to my own server, all with one click from the user?
In the create or update actions in the controller, after the save action:
require 'net/http'
Net::HTTP.get('www.example.com', '/index.html?'+params)
You have to do it yourself, preferably by triggering the external request after you're done with your procedure, hopefully using message queuing.
I have an HTML form in MVC ASP.NET which the user fills out and the request goes to the server [AJAX] then we send a mail them to inform them. I use the hidden key to store information on the page.
I find that someone changed the key and then clicked then it's a problem that the mail go to other who are unknown for this case.
How can I be sure that nobody changes the hidden key and request is valid. The thing I want to do that HTML. antioforeignkey who is suitable for that.
But how can I implement antiforeignkey when I send AJAX request to server.
Are there any tricks to solve this problem in MVC?
Check out this link: http://blog.stevensanderson.com/2008/09/01/prevent-cross-site-request-forgery-csrf-using-aspnet-mvcs-antiforgerytoken-helper/
This link will help with AntiForgeryToken and Ajax calls: http://blogs.us.sogeti.com/swilliams/2009/05/14/mvc-ndash-using-antiforgerytoken-over-ajax/
Be sure to add #Html.AntiForgeryToken() to your form then you can use jQuery to pull that value. With the value you can then add it to the data attribute of your jQuery Ajax call.
var token = $('input[name=__RequestVerificationToken]').val();