twilio how to get possible users












2















I retrieved an access token from my server and have connected the JavaScript SDk chat client like so. I have created a channel like so. The next step I'd like to invite a user like this. In that example they invite the user 'elmo'. Where do I get 'elmo' or how do I present the user with a selection of possible 'elmo's? The client sdk has no list users functionality.



Edit:

It looks like the REST API has a list users method. But can't find any examples of it used. Should the 1st person chat client be using the REST API as well to supplement gaps in the client SDK or should it get the identity from backend? Our team has different interpretations of the docs: twilio REST API is strictly for backend vs. twilio REST API can and should be used any where. Moved to twilio REST API: strictly backend?










share|improve this question





























    2















    I retrieved an access token from my server and have connected the JavaScript SDk chat client like so. I have created a channel like so. The next step I'd like to invite a user like this. In that example they invite the user 'elmo'. Where do I get 'elmo' or how do I present the user with a selection of possible 'elmo's? The client sdk has no list users functionality.



    Edit:

    It looks like the REST API has a list users method. But can't find any examples of it used. Should the 1st person chat client be using the REST API as well to supplement gaps in the client SDK or should it get the identity from backend? Our team has different interpretations of the docs: twilio REST API is strictly for backend vs. twilio REST API can and should be used any where. Moved to twilio REST API: strictly backend?










    share|improve this question



























      2












      2








      2








      I retrieved an access token from my server and have connected the JavaScript SDk chat client like so. I have created a channel like so. The next step I'd like to invite a user like this. In that example they invite the user 'elmo'. Where do I get 'elmo' or how do I present the user with a selection of possible 'elmo's? The client sdk has no list users functionality.



      Edit:

      It looks like the REST API has a list users method. But can't find any examples of it used. Should the 1st person chat client be using the REST API as well to supplement gaps in the client SDK or should it get the identity from backend? Our team has different interpretations of the docs: twilio REST API is strictly for backend vs. twilio REST API can and should be used any where. Moved to twilio REST API: strictly backend?










      share|improve this question
















      I retrieved an access token from my server and have connected the JavaScript SDk chat client like so. I have created a channel like so. The next step I'd like to invite a user like this. In that example they invite the user 'elmo'. Where do I get 'elmo' or how do I present the user with a selection of possible 'elmo's? The client sdk has no list users functionality.



      Edit:

      It looks like the REST API has a list users method. But can't find any examples of it used. Should the 1st person chat client be using the REST API as well to supplement gaps in the client SDK or should it get the identity from backend? Our team has different interpretations of the docs: twilio REST API is strictly for backend vs. twilio REST API can and should be used any where. Moved to twilio REST API: strictly backend?







      twilio twilio-programmable-chat






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Dec 3 '18 at 17:00







      William Lohan

















      asked Nov 28 '18 at 0:25









      William LohanWilliam Lohan

      1,102629




      1,102629
























          1 Answer
          1






          active

          oldest

          votes


















          1














          Twilio developer evangelist here.



          In my opinion Twilio's Chat API should not be the central source of truth of the users in your system. I don't know anything more about your application than what you've written here, but I would expect that you have a user model within your own system that you have used to generate or create an identity that is then used by the Chat API as well as how your user logs in to your system. I would then use that user model to connect users and provide their identities so that they can join chats together.






          share|improve this answer
























          • I simplified the issue to get a response. This is what we are doing already, we have an authenticated endpoint on our server that tells us all of the "users" that the authenticated user is can interact with. The problem with that is that if another user has never logged in, or never used the chat feature, then an access token has never been generated, thus twilio is not aware of the identity so if you try to add or invite that identity with the client sdk it errors.

            – William Lohan
            Dec 3 '18 at 16:38











          • So it seems somehow (client or backend) you have to know the identities twilio is aware of, yet while the docs are highly opinionated else where this is a grey area, and I can't find in any of the examples.

            – William Lohan
            Dec 3 '18 at 16:46











          • So, if the user doesn't exist in chat yet, you can create a user using the REST API.

            – philnash
            Dec 4 '18 at 2:44











          • That leads me back to the root of the issue is how do I know if a user has been created yet.

            – William Lohan
            Dec 4 '18 at 16:17











          • Also speaking of solutions that use the REST API, still not clear on were to do that stackoverflow.com/questions/53598372/…

            – William Lohan
            Dec 4 '18 at 16:20











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53510298%2ftwilio-how-to-get-possible-users%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          Twilio developer evangelist here.



          In my opinion Twilio's Chat API should not be the central source of truth of the users in your system. I don't know anything more about your application than what you've written here, but I would expect that you have a user model within your own system that you have used to generate or create an identity that is then used by the Chat API as well as how your user logs in to your system. I would then use that user model to connect users and provide their identities so that they can join chats together.






          share|improve this answer
























          • I simplified the issue to get a response. This is what we are doing already, we have an authenticated endpoint on our server that tells us all of the "users" that the authenticated user is can interact with. The problem with that is that if another user has never logged in, or never used the chat feature, then an access token has never been generated, thus twilio is not aware of the identity so if you try to add or invite that identity with the client sdk it errors.

            – William Lohan
            Dec 3 '18 at 16:38











          • So it seems somehow (client or backend) you have to know the identities twilio is aware of, yet while the docs are highly opinionated else where this is a grey area, and I can't find in any of the examples.

            – William Lohan
            Dec 3 '18 at 16:46











          • So, if the user doesn't exist in chat yet, you can create a user using the REST API.

            – philnash
            Dec 4 '18 at 2:44











          • That leads me back to the root of the issue is how do I know if a user has been created yet.

            – William Lohan
            Dec 4 '18 at 16:17











          • Also speaking of solutions that use the REST API, still not clear on were to do that stackoverflow.com/questions/53598372/…

            – William Lohan
            Dec 4 '18 at 16:20
















          1














          Twilio developer evangelist here.



          In my opinion Twilio's Chat API should not be the central source of truth of the users in your system. I don't know anything more about your application than what you've written here, but I would expect that you have a user model within your own system that you have used to generate or create an identity that is then used by the Chat API as well as how your user logs in to your system. I would then use that user model to connect users and provide their identities so that they can join chats together.






          share|improve this answer
























          • I simplified the issue to get a response. This is what we are doing already, we have an authenticated endpoint on our server that tells us all of the "users" that the authenticated user is can interact with. The problem with that is that if another user has never logged in, or never used the chat feature, then an access token has never been generated, thus twilio is not aware of the identity so if you try to add or invite that identity with the client sdk it errors.

            – William Lohan
            Dec 3 '18 at 16:38











          • So it seems somehow (client or backend) you have to know the identities twilio is aware of, yet while the docs are highly opinionated else where this is a grey area, and I can't find in any of the examples.

            – William Lohan
            Dec 3 '18 at 16:46











          • So, if the user doesn't exist in chat yet, you can create a user using the REST API.

            – philnash
            Dec 4 '18 at 2:44











          • That leads me back to the root of the issue is how do I know if a user has been created yet.

            – William Lohan
            Dec 4 '18 at 16:17











          • Also speaking of solutions that use the REST API, still not clear on were to do that stackoverflow.com/questions/53598372/…

            – William Lohan
            Dec 4 '18 at 16:20














          1












          1








          1







          Twilio developer evangelist here.



          In my opinion Twilio's Chat API should not be the central source of truth of the users in your system. I don't know anything more about your application than what you've written here, but I would expect that you have a user model within your own system that you have used to generate or create an identity that is then used by the Chat API as well as how your user logs in to your system. I would then use that user model to connect users and provide their identities so that they can join chats together.






          share|improve this answer













          Twilio developer evangelist here.



          In my opinion Twilio's Chat API should not be the central source of truth of the users in your system. I don't know anything more about your application than what you've written here, but I would expect that you have a user model within your own system that you have used to generate or create an identity that is then used by the Chat API as well as how your user logs in to your system. I would then use that user model to connect users and provide their identities so that they can join chats together.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 29 '18 at 20:46









          philnashphilnash

          38.6k93554




          38.6k93554













          • I simplified the issue to get a response. This is what we are doing already, we have an authenticated endpoint on our server that tells us all of the "users" that the authenticated user is can interact with. The problem with that is that if another user has never logged in, or never used the chat feature, then an access token has never been generated, thus twilio is not aware of the identity so if you try to add or invite that identity with the client sdk it errors.

            – William Lohan
            Dec 3 '18 at 16:38











          • So it seems somehow (client or backend) you have to know the identities twilio is aware of, yet while the docs are highly opinionated else where this is a grey area, and I can't find in any of the examples.

            – William Lohan
            Dec 3 '18 at 16:46











          • So, if the user doesn't exist in chat yet, you can create a user using the REST API.

            – philnash
            Dec 4 '18 at 2:44











          • That leads me back to the root of the issue is how do I know if a user has been created yet.

            – William Lohan
            Dec 4 '18 at 16:17











          • Also speaking of solutions that use the REST API, still not clear on were to do that stackoverflow.com/questions/53598372/…

            – William Lohan
            Dec 4 '18 at 16:20



















          • I simplified the issue to get a response. This is what we are doing already, we have an authenticated endpoint on our server that tells us all of the "users" that the authenticated user is can interact with. The problem with that is that if another user has never logged in, or never used the chat feature, then an access token has never been generated, thus twilio is not aware of the identity so if you try to add or invite that identity with the client sdk it errors.

            – William Lohan
            Dec 3 '18 at 16:38











          • So it seems somehow (client or backend) you have to know the identities twilio is aware of, yet while the docs are highly opinionated else where this is a grey area, and I can't find in any of the examples.

            – William Lohan
            Dec 3 '18 at 16:46











          • So, if the user doesn't exist in chat yet, you can create a user using the REST API.

            – philnash
            Dec 4 '18 at 2:44











          • That leads me back to the root of the issue is how do I know if a user has been created yet.

            – William Lohan
            Dec 4 '18 at 16:17











          • Also speaking of solutions that use the REST API, still not clear on were to do that stackoverflow.com/questions/53598372/…

            – William Lohan
            Dec 4 '18 at 16:20

















          I simplified the issue to get a response. This is what we are doing already, we have an authenticated endpoint on our server that tells us all of the "users" that the authenticated user is can interact with. The problem with that is that if another user has never logged in, or never used the chat feature, then an access token has never been generated, thus twilio is not aware of the identity so if you try to add or invite that identity with the client sdk it errors.

          – William Lohan
          Dec 3 '18 at 16:38





          I simplified the issue to get a response. This is what we are doing already, we have an authenticated endpoint on our server that tells us all of the "users" that the authenticated user is can interact with. The problem with that is that if another user has never logged in, or never used the chat feature, then an access token has never been generated, thus twilio is not aware of the identity so if you try to add or invite that identity with the client sdk it errors.

          – William Lohan
          Dec 3 '18 at 16:38













          So it seems somehow (client or backend) you have to know the identities twilio is aware of, yet while the docs are highly opinionated else where this is a grey area, and I can't find in any of the examples.

          – William Lohan
          Dec 3 '18 at 16:46





          So it seems somehow (client or backend) you have to know the identities twilio is aware of, yet while the docs are highly opinionated else where this is a grey area, and I can't find in any of the examples.

          – William Lohan
          Dec 3 '18 at 16:46













          So, if the user doesn't exist in chat yet, you can create a user using the REST API.

          – philnash
          Dec 4 '18 at 2:44





          So, if the user doesn't exist in chat yet, you can create a user using the REST API.

          – philnash
          Dec 4 '18 at 2:44













          That leads me back to the root of the issue is how do I know if a user has been created yet.

          – William Lohan
          Dec 4 '18 at 16:17





          That leads me back to the root of the issue is how do I know if a user has been created yet.

          – William Lohan
          Dec 4 '18 at 16:17













          Also speaking of solutions that use the REST API, still not clear on were to do that stackoverflow.com/questions/53598372/…

          – William Lohan
          Dec 4 '18 at 16:20





          Also speaking of solutions that use the REST API, still not clear on were to do that stackoverflow.com/questions/53598372/…

          – William Lohan
          Dec 4 '18 at 16:20




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53510298%2ftwilio-how-to-get-possible-users%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks

          Calculate evaluation metrics using cross_val_predict sklearn

          Insert data from modal to MySQL (multiple modal on website)