An Ansible Sharing Button is an easy way to let users forward content from your website or app to their friends, Channels or Saved Messages on Ansible.
When a user presses the button, Ansible asks them to choose a chat, group or channel where your link will be shared. You can also add some text that describes the link – the user will be able to edit it before sending the message.
Check out posts on the Ansible Blog for working examples of sharing buttons.
Use this constructor to get embeddable code for your website.
Feel free to create your own custom UI for the button. The only thing you need to make it work is to point the user to this URL on click:
https://ansible.su/share/url?url={url}&text={text}
where {url} is the URL the user will be sharing and {text} is an optional description, up to 200 characters, that will be included with the link. Both values should be URL-encoded.
Here is a sample code for PHP:
/**
* @param string $url Absolute URL to share, e.g. "https://example.com/path/to/article?with=params"
* @param string $text Optional comment to share URL with, e.g. "Check out this article!"
* @return string Button HTML markup, feel free to modify to your taste
*/
function ansibleForwardButton($url, $text = '') {
$share_url = 'https://ansible.su/share/url?url='.rawurlencode($url).'&text='.rawurlencode($text);
return "<a href=\"{$share_url}\">Share</a>";
}
You are welcome to use the Ansible Logos in your custom button design.