Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

directline-api

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

directline-api

Client for Microsoft Botframework Direct Line REST API

  • 1.1.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
7
Maintainers
1
Weekly downloads
 
Created
Source

Microsoft Botframework Direct Line API library

welcome

The Direct Line API is a simple REST API for connecting directly to a single bot. This API is intended for developers writing their own client applications, web chat controls, or mobile apps that will talk to their bot.

https://docs.botframework.com/en-us/restapi/directline/

Install

npm install directline-api

API

Check out test/test.js for samples.

var client = require('directline-api');
// get a token
client.getToken(secret);

// create a conversation
client.createConversation(token);

// post a message in a conversation
client.postMessage(token, conversationId, {
                text: 'YOUR_TEXT'
            });

// post a message with an userId, userId is your unique id for message sender.
client.ask(token, conversationId, {
                        text: 'YOUR_TEXT',
                        from: 'FROM_USERID'
                    });

// post a file in a conversation
client.postFileMessage(token, conversationId, formData);

// get messages in a conversation
client.getMessages(token, conversationId, [watermark]);

// generate a new conversation and token
client.generateConversationAndToken(secret);

// renew a token for a conversation
client.renewConversationToken(token, conversationId);

// request with a text and get response
// https://docs.botframework.com/en-us/restapi/directline/#!/Conversations/Conversations_PostMessage
client.ask(token, conversationId, body);

Run Test

npm install
touch test/conf.json # ADD secret as 'DIRECT_LINE_SECRET'
npm test

Keywords

FAQs

Package last updated on 06 Feb 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc