Git Product home page Git Product logo

chatbase-dotnet's Introduction

.NET Library for Chatbase

A .NET library for the Chatbase API written in C#

This is not an official Google product.

Package Information

Nuget package page

Install

Using the Package Manager Console run the following command:

Install-Package Chatbase

Account Setup

Please see the Getting Started Section for information on configuring one's account and obtaining an API key.

Using the library

One can send individual messages to the Generic and Facebook rest APIs:

Generic:

using Chatbase;

Chatbase.Client client = new Chatbase.Client();

Chatbase.Message msg = new Chatbase.Message();
msg.api_key = "123"; // required
msg.user_id = "xyz"; // required
msg.intent = "test";
msg.version = "0.1";
msg.content = "This is a test.";
msg.type = Chatbase.Message.UserMessage; // default, required
msg.not_handled = false; // default
msg.feedback = false; //default
var resp = client.Send(msg).Result; // Get the result of the async task
// Write the return status-code from the API request
Console.WriteLine(resp.StatusCode);

Facebook:

using Chatbase;

Chatbase.Client client = new Chatbase.Client();

// Agent messages
agnMsg = new Chatbase.FBAgentMessage();
agnMsg.SetRecipientID("123");
agnMsg.SetMessageID("456");
agnMsg.SetMessageContent("hey");
agnMsg.intent = "say-hello";
agnMsg.version = "0.2";
var firstTask = client.Send(agnMsg);

// User messages
usrMsg = new Chatbase.FBUserMessage();
usrMsg.SetSenderID("abc");
usrMsg.SetRecipientID("123");
usrMsg.SetMessageID("456");
usrMsg.SetMessageContent("hey");
usrMsg.intent = "say-hello";
usrMsg.version = "0.2";
var secondTask = client.Send(usrMsg);

One can send sets of messages as well to the Generic and Facebook rest APIs:

Generic:

using Chatbase;

Chatbase.Client client = new Chatbase.Client();

Chatbase.MessageSet set = new Chatbase.MessageSet("api-key");

// New messages made from the set will have the api-key already set
Chatbase.Message msg = set.NewMessage();
// ... Set fields as one would a regular message like the example above
set.Add(msg)
var task = Client.Send(set);

Facebook:

using Chatbase;

Chatbase.Client client = new Chatbase.Client();

// Agent Message Set
Chatbase.FBAgentMessageSet agnSet = new Chatbase.FBAgentMessageSet("api-key");
Chatbase.FBAgentMessage agnMsg = agnSet.NewMessage();
// ... Set fields as one would a regular FBAgentMessage
agnSet.add(agnMsg)
var firstTask = client.Send(agnSet);

// User Message Set
Chatbase.FBUserMessageSet usrSet = new Chatbase.FBUserMessageSet("api-key");
Chatbase.FBUserMessage usrMsg = usrSet.NewMessage();
// ... Set fields as one would a regular FBUserMessage
usrSet.add(usrMsg);
var secondTask = client.Send(usrSet);

Tests

Please place tests in Chatbase.Tests project directory. To run tests, from the Chatbase.Tests project directory enter the following in a command-prompt:

$ dotnet test

This requires the dotnet Core CLI tools to be installed.

chatbase-dotnet's People

Contributors

cristiancavalli avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

chatbase-dotnet's Issues

Session Flow only updates with one branch

Hi,

I am facing an issue while using the Chatbase session flow. Only one branch is appearing for my API even though several other intents are available.
image

Even though we have several messages with different intents, only 9 are being showcased in session flow. What could be the issue on this?
image

Chatbase not showing dashboard data

Hi there, struggling to find some forum to get help on this. We've started using chatbase and are struggling to see our data in the dashboard. The API returns 200's with message_ids. Anyone able to point me in the right direction in terms of how to debug this further?

Why do we need api_key in Message? Shouldn't it use the api_key in Client?

I initialized Client class by passing an api key in its constructor.
var client = new Client(apikey);

Calling Client.SendAsync with a Message having a null or empty api key will return a BadRequest. If I do set the api key in the Message it works. Isn't the point of having the api key in the client to use that api key across all messages?

I'm thinking that instead of an api key per message it makes more sense to have it per Client instance. A message should focus on what it is - a message and not concern itself with the api key. What do you think?

Installing the NuGet Package

Install-Package : Could not install package 'Chatbase 1.0.0'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.5.2', but the package does not contain any assembly references or 
content files that are compatible with that framework. For more information, contact the package author.
At line:1 char:1
+ Install-Package Chatbase
+ ~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

Do I have to have another sort of project for this? I am trying to add it to an existing project.

Chatbase 'Add collaborators' allows the user to edit or delete the agent

Hi there,

Not sure where else to log these issues. We're trying to add a collaborator to an agent. Having added them with 'view only' mode they are in fact able to edit and even delete the agent. This does not seem right. I don't want a view-only user being able to edit anything!

Also, there does not seem to be any way of now viewing the people I have added as collaborators. We'd need to be able to revoke access etc.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.