botframework-sdk icon indicating copy to clipboard operation
botframework-sdk copied to clipboard

[Skype for Business] Getting error "HTTP status code Forbidden"?

Open Tomiku opened this issue 9 years ago • 2 comments

Bot Info As registered in the Bot Developer Portal at https://dev.botframework.com

  • App ID: 3cc4e8d0-59a7-4146-aa54-1d5e73d4f2cc
  • SDK Platform: Node.js
  • SDK Version: Node version 6+
  • Active Channels: Skype for Business, MS Teams

Issue Description

I follow this one to create bot and enable hybrid portion https://msdn.microsoft.com/en-us/skype/skype-for-business-bot-framework/docs/bot-hybrid-support I'm a O365 user. When I add the sip address ([email protected]) to my Skype for Business Client and chat with [email protected] but it does not respond to me. I go to the Bot on the https://dev.botframework.com, i see Skype for Business "Health" has issues there. the issue is: "There was an error sending this message to your bot: HTTP status code Forbidden"

Code Example

var restify = require("restify");
var builder = require("botbuilder");
var Conversation = require("watson-developer-cloud/conversation/v1");
require("dotenv").config(
{
	silent: true
}
);
var contexts;
var workspace = process.env.WORKSPACE_ID || '';
var server = restify.createServer();
server.listen(process.env.port || process.env.PORT || 3978, function ()
{
	console.log("%s listening to %s", server.name, server.url);
}
);
var conversation = new Conversation(
	{
		url: "https://gateway.watsonplatform.net/conversation/api",
		version_date: Conversation.VERSION_DATE_2017_04_21
	}
	);
var connector = new builder.ChatConnector(
	{
		appId: process.env.MICROSOFT_APP_ID,
		appPassword: process.env.MICROSOFT_APP_PASSWORD
	}
	);
server.post("/api/messages", connector.listen());
var bot = new builder.UniversalBot(connector, function (session)
	{
		var payload =
		{
			workspace_id: workspace,
			context: '',
			input:
			{
				text: session.message.text
			}
		};
		var conversationContext = findOrCreateContext(session.message.address.conversation.id);
		if (!conversationContext)
			conversationContext = {};
		payload.context = conversationContext.watsonContext;
		conversation.message(payload, function (err, response)
		{
			if (err)
			{
				session.send(err);
			}
			else
			{
				console.log(JSON.stringify(response, null, 2));
				session.send(response.output.text);
				conversationContext.watsonContext = response.context;
			}
		}
		);
	}
	);
const logUserConversation = (event) => {
    console.log('message: ' + event.text + ', user: ' + event.address.user.name);
};

// Middleware for logging
bot.use({
    receive: function (event, next) {
        logUserConversation(event);
        next();
    },
    send: function (event, next) {
        logUserConversation(event);
        next();
    }
});
function findOrCreateContext(convId)
{
	if (!contexts)
		contexts = [];
	if (!contexts[convId])
	{
		contexts[convId] =
		{
			workspaceId: workspace,
			watsonContext: {}
		};
	}
	return contexts[convId];
}

From https://dev.botframework.com, I was able to connect the Bot to other channels like Skype, Teams. But for Skype for Business.

Could you please help me to know which is root cause ?

Thank you,

Tomiku

Tomiku avatar Nov 29 '17 08:11 Tomiku

Hi @Tomiku - What type of Skype for Business instance do you have?

From the docs:

The Skype for Business Bot Framework channel is currently supported for Skype for Business Online. Skype for Business Server 2015 is not supported.

The configuration for Skype for Business channel is different than most others since there is additional setup needed on the SfB server side by your tenant admin.

You can find the full details here: https://msdn.microsoft.com/en-us/skype/Skype-For-Business-Bot-Framework/docs/overview

nwhitmont avatar Nov 29 '17 18:11 nwhitmont

Thank you @nwhitmont for the answer!. It was very helpful to me. I follow your suggested link and I was able to do this:

"Skype for Business bots can be connected to Skype for Business Server users if Hybrid connectivity has been deployed in the environment. For more information about hybrid connectivity and bot setup, see Skype for Business Bot - Hybrid environment support."

I can chat with the Bot and can see Bot service reply. Only one issue that is [email protected] presence is not online, it always show "Presence Unknown". How can I make it only ?

And, Please share your ideas how do I need to make up Bot service (wrote by NodeJs) so that it can support both Skype for Business Hybrid and Skype for Business Server 2015. Was there any post, solution or example that Skype for Business Bot (wrote by NodeJs) support users of Skype for Business Server 2015 ?

Supper thanks !!!

Tomiku

Tomiku avatar Nov 30 '17 03:11 Tomiku