Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Populating a different input context based on the channel/team #11

Open
saisub opened this issue Sep 10, 2017 · 16 comments
Open

Populating a different input context based on the channel/team #11

saisub opened this issue Sep 10, 2017 · 16 comments

Comments

@saisub
Copy link

saisub commented Sep 10, 2017

Is there a way to populate different input contexts depending on which channel/team the message comes from. I am trying to respond with different messages based on who is asking -- a customer vs an employee for the same question

@zengfenfei
Copy link
Collaborator

zengfenfei commented Sep 11, 2017

I think so. You can check the groupId of glip message to tell which channel/team the message comes from.

If you want to know who is asking, check the creatorId of the glip message.

@saisub
Copy link
Author

saisub commented Sep 11, 2017

Hmm. I could not find a way to access that information in API.AI. Will continue looking. Alternatively is there a way to have multiple AI agents connect via the same Ringcentral API or do I have to create a Ringcentral APP for each one. Essentially I am trying to have different agents for different audiences. Can I have multiple bits in GLIP all of which are enabled via a single API.AI integration?

@zengfenfei
Copy link
Collaborator

Sorry, I'm not sure what do you mean by "that information in API.AI".

@embbnux
Copy link
Owner

embbnux commented Sep 12, 2017

Hi, @saisub You can create multiple APIAi instance in your app. But you need to update constructor codes in here, to pass token as a params from outside when you new a ApiAi instance.

@embbnux
Copy link
Owner

embbnux commented Sep 12, 2017

BTW, @saisub welcome to join our RingCentral Developers discuss group in Glip. You can talk with ours developers and PM directly. Join by here. Or search RingCentral Developers in Glip.

@saisub
Copy link
Author

saisub commented Sep 13, 2017

Can you tell me how I can assign the group ID, creator ID, etc from a glip message to parameters in an API.AI intent? I.e. how do I acess them inside API,AI. Thanks a bunch

Sai

@embbnux
Copy link
Owner

embbnux commented Sep 14, 2017

How about sending group ID and creator ID to API.AI by sessionId in request

@saisub
Copy link
Author

saisub commented Sep 14, 2017

I think I am missing something basic. In glip the user types something and in api.ai I have the console where I can put intents etc. I don't see how I can pass or access any of the hidden variables like group ID etc. Do I have to do some JSON hacking or use webhooks/write separate javascript or am I missing something basic

@saisub
Copy link
Author

saisub commented Sep 15, 2017

In your code I see all of these variables. Do I just have to add code inside it --- Something like if groupID =x then do y inside "send message" or is there a way to expose those variable inside the API.AI UI so that I can just add intents like

If the user sai @xyz then post abc on the xyz channel etc. The problems I am trying to solve are the following:

1.) Whenever someone says @Team1 inside the everyone channel lets say--> I want to send notification to the people in team 1 by posting on the team1 channel or create an @mention for everyone in team1

2.) For a certain question I want to give different answers based on the groupID (i.e the team that it was posted in) /

I see that those variables exist in your code. Just don't know how to expose them inside API.AI's UI. Should I branch your code and try to write stuff in it? Is there a way to automatically have those values appended to everything that the user sends so that I can access them as parameters in the API.AI intents /entitys?

@saisub
Copy link
Author

saisub commented Sep 15, 2017

Some folks have talked about setting up a generic context like this for facebook for example. I wonder if we can create a glip context that gets assigned all of these values --> group ID, user ID etc. Also if we can expose glip sys parameters like group ID etc that can be changed ---> for example to send a message to team B when we get a message from team A. Don't know if any this make sense. Thanks for all your help

let apiaiRequest = apiAiService.textRequest(text,
{
sessionId: sessionIds.get(sender),
contexts: [
{
name: "generic",
parameters: {
facebook_user_id: sender
}
}
]
});

@saisub
Copy link
Author

saisub commented Sep 16, 2017

HI I was able to make changes to your code to extract the group ID of a team when there is an @team in the message and send a message to that channel. I now just need help with the following. The scenario

Somepone posts a message in team1 with a mention to team2 by saying in team 1 something like he @team2 respond to this please. I am able to send a message to the team2 (that part is working). I now would like to include the name of team1 and a link back. I can access the groupID of team from the msg.groupID but don't know how to compose a message so that a link to team1 shows up in the message I compose for team 2. Basically my message on team2 should be. Hey team2 there is an important message for you at name at team 1(link of team1)

@saisub
Copy link
Author

saisub commented Sep 16, 2017

BTW I have even succeeded in getting the link to show up in team2 in the raw form http://app.glip.com/groupID but can't seem to show it as an embedded link the link format does not seem to work

@embbnux
Copy link
Owner

embbnux commented Sep 17, 2017

Hi, @saisub You can send group Id or other params to API.AI by contexts. This is a example.

And the structure of my bot is:
Glip ---> Your Bot -> API.AI ---> Your Bot ---> Glip.

You can set you message logics in You Bot code. And use API.AI to choice actions and generate response message.

@saisub
Copy link
Author

saisub commented Sep 17, 2017

Thanks I will give it a try. BTW as per my previous entries. I have gotten pretty close to solving the message teamB when there is a mention in teamA with a @TeamB message. I can now send a message to teamB alerting them of a message in teamA. I can also include a link in that message which looks like https://app.glip.com/groupIDofteamA. I have not yet figured out how to embed the link as part of the message. I tried the link method but that does not work. It sends it to another tab in chrome.. Any thoughts of that would be great.

@embbnux
Copy link
Owner

embbnux commented Sep 17, 2017

I am afraid that Glip app don't support it. I will check it with my colleagues

@saisub
Copy link
Author

saisub commented Sep 18, 2017

Alternatively is there a way to @mention someone via the API. I could possibly just extract all the members of a team and send @mentions to them

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants