Article: Adding authentication to verify user when trying to access the bot

Problem Scenario:
If you are aiming to implement authentication in the bot, particularly when the user initiates a conversation, and you want to verify the user to prevent or limit access to only those authorized to use the bot.

Solution:
This requirement can be achieved by creating an Oauth profile and passing it through a service node.

Please refer to the information present in the below reference documentation for generating an OAuth profile.

Once the Oauth profile is created, it can be passed through a service node.

Please refer to the below reference documentation for working with a service node.

  • Create a bot action node → service node.

  • Click on edit request in the request definition as per the above screenshot
  • Within Auth, you can select the Oauth profile that you have created
  • Choose the API method (get/post/put, etc) and the headers along with the API end point.
  • Once saved, you can test it for authentication.

Note:
This service node can be adjusted within the Build page wherever required as per the requirement.
If you need it at the very start with the welcome message, you can create it accordingly.