-1

I following the documentation here to create a token for the Conversation API. https://www.twilio.com/docs/conversations/quickstart?code-sample=code-fetch-your-new-conversation&code-language=Node.js&code-sdk-version=3.x#configure-the-conversations-demo-application-using-codesandboxio

twilio token:chat --identity testPineapple --chat-service-sid ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX --profile project-danger

This works for me, but these tokens expire after a given time. How do you refresh this token for a Conversation? I am creating these tokens from node.js.

Berry Blue
  • 15,330
  • 18
  • 62
  • 113

1 Answers1

0

On the Twilio Official Doc

Once you generate a token and pass it to the client, Client can subscribe to tokenAboutToExpire events which is fired 3 minute before your token is expired

client.on('tokenAboutToExpire', function() {  
   // Same way you generated the token for the first time
   fetchToken(function(updatedToken) {
     chatClient.updateToken(updatedToken);
   });
});
Shankar Regmi
  • 854
  • 1
  • 7
  • 16