tenfourty / chatbot

a hubot chatbot
2 stars 5 forks source link

hubot salesforce plugin #2

Open tenfourty opened 9 years ago

tenfourty commented 9 years ago

We need a plugin/script for hubut that will get hubot to follow all opportunities for a particular sales person in a room.

Something like:

hubot sfdc follow opportunity owner Jeremy #sales_jeremy #sales_uk

then every time any opportunities that Jeremy owns are updated the room(s) are updated with the changes.

We want to see all updates to all opportunities that a person owns.

To stop following a person just run:

hubot sfdc unfollow opportunity owner Jeremy

this will unfollow Jeremy from all the rooms.

Steps to achieve this:

  1. Get developer/API access to our sfdc room
  2. work out what the SOQL is for this
  3. build the actual script that will do this
  4. make sure that the data is stored in the hubot brain so it survives restarts
  5. make sure the script checks that the person to follow exists and gracefully handles the error
  6. make sure the script can run periodically (configureable) for each item being followed

Other future stuff could include:

Resources:

on chatter and auto follow I found these links:

gsjurseth commented 9 years ago

Off the top of my head I'd be more inclined to have a structure like so:

Where command is list, follow, unfollow and so on. Arguably you should be able to do something like this as well

and then hubot will respond by asking me to enter it into slack and then commit it.

tenfourty commented 9 years ago

yes that makes sense Geir.

we could have:

What do you think?

tenfourty commented 9 years ago

@gsjurseth this hubot repository is quite interesting:

https://github.com/spajus/hubot-pubsub

Not sure we would use it but it's an interesting idea to have a pub/sub model.

carloseberhardt commented 9 years ago

sebot did SFDC searching for opps, the problem was it uses user's (my) context, so if there were opps I couldn't see, they did not appear. You either need to have chatbot auth to sfdc with an account that can see everything (i'm not sure i like that) .. or have users auth through the bot, which makes this a harder thing to solve by a fair bit.

gsjurseth commented 9 years ago

Ah, very good point. The way I saw this being used was on a per room basis. That is, a room per opporutnity. That way the REP in question could, for example, do:

huboc ae login

That would reply (in a private message maybe?) with a link to login (via a proxy) and the bot would be waiting for that login (should probably timeout at some point). Then it just needs to keep the token cached in memory. If it expires then it could send another private message to the ae.

With that done maybe run this

hubot sfdc opp hm subscribe

So in theory I think we could make this work, but the login won't be any fun. Honestly, this is a ton of work to get this stupid login sorted..