0

I am trying to integrate my Watson Assistant to BOX. I tried to use boxsdk in my Cloud Function Action. But it gives me exception - No module named 'boxsdk'

Has anyone tried integrating BOX with Watson Assistant or tried using the API's in cloud functions? Is this possible?

It works fine if I try on my local deployment or using Online Python

Here's a simple code snippet -

import sys
import boxsdk

def main(dict):
    return { 'message': 'Hello world' }
data_henrik
  • 16,724
  • 2
  • 28
  • 49
Techidiot
  • 1,921
  • 1
  • 15
  • 28

1 Answers1

1

You can do that.

The standard Python runtimes for IBM Cloud Functions do not contain the Box SDK. It is possible to include your own choice of Python modules. In that case you have to use one of the documented methods to pack the function and required modules.

I did something like this for my GitHub stats project. If you want to build a Docker-based Python runtime, I recommend taking a look at the offical Docker base for Python and Cloud Functions.

data_henrik
  • 16,724
  • 2
  • 28
  • 49
  • Thank you! So, I've two questions - Is there any way to ask for this enhancement to get the module added to the Runtimes? And second, what would be an ideal approach to use the module? Do I need to develop the entire working code on my local machine and deploy it as zip as Action and use the endpoint as a Webhook? – Techidiot May 13 '20 at 14:07
  • 1) Open an issue against the repo and ask for boxsdk to be added. 2) I don't understand. For Watson Assistant, you can use the Cloud Function web action as webhook. See my tutorial for an example: https://cloud.ibm.com/docs/tutorials/slack-chatbot-database-watson.html – data_henrik May 13 '20 at 14:14
  • Yes. I am going to use this as a Web Action. Basically, my goal is to read some files kept on Box. I tried using IBM Box Service, but looks like its depreciated. – Techidiot May 13 '20 at 14:17
  • 1
    An alternative method here would be to use Watson Discovery to connect to your box folder and pull the documents into discovery. ( you may need to check the price plans for access to the box crawler). You can then connect to Watson Discovery either by search skill (if you have the right assistant plan), or by a cloud function. Note: Make the individual documents sharable - not the folder. The individual documents in the discovery box collection will then contain meta-data that is the url to the document in box. This url can be returned to assistant, allowing the user to view the document. – timd May 14 '20 at 10:59
  • @timd Thank you. Yes, that sounds good too. This is for a POC and running on LITE so I think thats not an option right now. But will keep a note of it. – Techidiot May 14 '20 at 20:35