Have ideas to improve npm?Join in the discussion! »

    twilio-chat
    TypeScript icon, indicating that this package has built-in type declarations

    5.0.0 • Public • Published

    Twilio Chat client library

    Twilio Chat is a service for messages delivery over ip networks. Visit our official site for more detalis: https://www.twilio.com/chat

    Instantiating and using

    To use the library you need to generate a token and pass it to the Chat Client create factory.

    NPM

    npm install --save twilio-chat
    

    Using this method, you can require twilio-chat and then use the client:

    const Chat = require('twilio-chat');
    Chat.Client.create(token).then(client => {
        // Use client
    });
    

    or, if you prefer async/await syntax:

    const Chat = require('twilio-chat');
    let client = await Chat.Client.create(token);
    // Use client
    

    CDN

    Releases of twilio-chat.js are hosted on a CDN, and you can include these directly in your web app using a <script> tag.

    <script src="https://media.twiliocdn.com/sdk/js/chat/v5.0/twilio-chat.min.js"></script>

    Using this method, twilio-chat.js will set a browser global Twilio.Chat through which you can use the client :

    Twilio.Chat.Client.create(token).then(client => {
        // Use client
    });
    

    or, if you prefer async/await syntax:

    let client = await Twilio.Chat.Client.create(token);
    // Use client
    

    Changelog

    See this link.

    Keywords

    none

    Install

    npm i twilio-chat

    DownloadsWeekly Downloads

    48,916

    Version

    5.0.0

    License

    MIT

    Unpacked Size

    6.34 MB

    Total Files

    272

    Last publish

    Collaborators

    • avatar