Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
  <head>
    <meta name="description" content="Send link not matching URL">
    <title>Circuit JS SDK</title>
    <script src="https://unpkg.com/circuit-sdk@beta"></script>
    <script src="https://rawgit.com/circuit/js-sdk/master/jsbin-template.js"></script>
    <link rel="stylesheet" href="https://rawgit.com/circuit/js-sdk/master/jsbin-template.css">
  </head>
  <body>
    <div id="template"></div>
    <section id="main" style="display:none">
      <input id="email" type="text" placeholder="email">
      <button id="send">Send</button>
    </section>
</body>
</html>
 
/*jshint esnext: true */
// Create client instance
const client = new Circuit.Client({
  domain: jsBinTpl.domain,       // read domain from url
  client_id: jsBinTpl.client_id, // get client_id for domain
  scope: 'ALL',
  removeMentionHtml: true
}); 
// Template for Circuit JSBin examples. Builds generic part of page incl. login button.
const {logonButton, logoutButton, print} = jsBinTpl.init(client, template, {
  title: 'Circuit JS SDK: Send post with custom URL',
  description: 'Send a post with a link shown different from the actual URL. Use of option "removeMentionHtml"',
  apiMethods: ['getDirectConversationWithUser', 'addTextItem'],
  prerequisites: []
});
logonButton.addEventListener('click', () => {
  client.logon()
  .then(user => print(`Successfully authenticated as ${user.displayName}`))
  .catch(print);
});
send.addEventListener('click', () => {
  client.getDirectConversationWithUser('circuitsdk01@gmail.com')
    .then(c => {
      client.addTextItem(c.convId, '<a href="http://circuit.com">Open Circuit website</a>')
    })
    .catch(print);
});
Circuit.supportedEvents && Circuit.supportedEvents.forEach(e => {
    client.addEventListener(e, evt => print(`Received ${e} event:`, evt));
});
Output 300px

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
rogerupro
0viewers