Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

How to create an API Command Button that calls an API

Hi, From an API call, I've been trying to output a Command Button that would in turn be able to make another API call.  Unfortunately no matter what I try all the parameters seem to be stripped out when the button is output.  I've also tried escaping characters with no success.  I'm assuming a syntax problem but I have been unable to figure it out.  Here's a very basic example of what I'm trying: sendChat('', `[Test1](!edy{{--title:t1}})`);   Thanks in advance for the help.
1514738974
The Aaron
Pro
API Scripter
It’s the colon. The chat parser thinks anything with a : in it is a URL and eats it. You could replace it with something like %%SEP%% and do a sub on that for : in your chat:message handler before regular parsing to get an easy fix. You might want to create a function that outputs your button and does a sub to put the %%SEP%% in just so you can completely ignore it. 
Yes, that was it!  I can finally proceed.  Thanks Aaron! 
1514811933

Edited 1514811969
Jakob
Sheet Author
API Scripter
Another thing that should be noted is that you can also create API command buttons in chat by just sending an <a> element: sendChat('', `<a href="!edy{{--title:t1}}">Test1</a>`); This has the advantage that you can also style the button to make it less ugly without having to rely on roll template styling.