Comments (18)
I'll close this issue for now. With the new version of this library, I will create a demo repository showing off all supported messaging platforms.
from botman.
I still want to provide a separate repository with a Laravel example application to get you started. But I haven't found the time yet.
If you find some things in the documentation that could be improved, feel free to send pull requests.
from botman.
If you need any code (like what I have now from the #14 issue), let me know.
from botman.
Quick question, I see that the repo does support buttons, does it accept button requests too, or just send them?
from botman.
What do you mean by "Button requests"?
It allows sending (and responding) to Slack message buttons.
from botman.
That's what I meant, so in the value
do you put the same thing that's in the ->hears()
section?
from botman.
So from my code from yesterday, something like this, would it work?
public function handleBotRequest(Request $request)
{
$payload = $request->json();
if ($payload->get('type') === 'url_verification') {
return $payload->get('challenge');
}
$team = Company::find(1);
$slackBot = app('slackbot');
$slackBot->initialize($team->slack_info->bot->bot_access_token);
$slackBot->hears('ping', function (SlackBot $bot) {
$bot->reply(Question::create('PONG')->addButton(Button::create('Ping')->value('ping'))->callbackId('PINGPONG'));
});
$slackBot->listen();
}
from botman.
Yes exactly, that should work.
Here is an example from one of my bots:
$question = Question::create('Do you need a database?')
->fallback('Unable to create a new database')
->callbackId('create_database')
->addButtons([
Button::create('Yes')->value('yes'),
Button::create('No')->value('no'),
]);
$bot->reply($question, function (Answer $answer) {
if ($answer->isInteractiveMessageReply()) {
$decision = $answer->getValue();
if ($decision === 'yes') {}
}
});
Please note that the bot reply
method no longer exists. It got renamed to respond
from botman.
Ah, okay! Also, I scrapped what I had created and started a repo to make it easy, I can transfer if you want and I also have a dev site setup on a forge server so I could play with it more.
https://github.com/darkgoldblade01/slackbot-laravel
from botman.
How are you using $bot->reply($question, function())
when the second argument is supposed to be an array?
I am getting an error:
ErrorException: array_merge(): Argument #2 is not an array in /home/forge/***/vendor/mpociot/slackbot/src/Mpociot/SlackBot/SlackBot.php:248
from botman.
Ah - this was taken from a Conversation class and I just changed the syntax from $this->ask
(which only accepts two arguments) to $bot->reply
So this should be inside of a conversation too, since you need to get the users input.
from botman.
Okay, I am hoping to compile the examples we are coming up with into the repo I created for the laravel example.
from botman.
Btw, thanks @darkgoldblade01 for that repo, it'll come handy, I did try to follow @mpociot's blog post on it, but somehow I failed miserably ;-) I hope yours will get me through it!
from botman.
Sorry for that - I wrote the blog post while writing the library, which has now a more stable API.
I'll update the blogpost soon :)
from botman.
No worries about that, that'll just teach me to blindly follow step by step :P
from botman.
Well, thank you guys, I finally re-read this issue correctly (And #14) and got my bot working just fine on my part! Now the fun part begins...
from botman.
If you encounter any issues that could be shared let us know! :-)
from botman.
Honestly, at this moment, the only issue I encountered was probably due to the fact that I was trying to follow the blog post, the readme and two issues at the same time ;-)
from botman.
Related Issues (20)
- Whatsapp API HOT 2
- How can i save chat logs to a log file? HOT 4
- Separate "models", error forum/slack and Discord support HOT 3
- Welcome message when web widget opened? HOT 1
- illuminate\support package should be required
- Slow bot reply with telegram-driver HOT 6
- send button/icon HOT 1
- Telegram doesn't show emoji
- Invalid URL to access Slack channel HOT 2
- cURL error 60: SSL: no alternative certificate subject name matches target host name 'graph.facebook.co' HOT 7
- Bad Request: invalid user_id specified HOT 8
- Issue using botman commands with wit ai commands (intents)
- CallBackData button inline - Driver Telegram botman
- FacebookDriven verification error HOT 1
- Conversation lost when reload page HOT 5
- What are the limitations on Botman's regex capabilities? HOT 1
- Fatal error: Uncaught Error: Class "DriverManager" not found
- Is this package suite still maintained? HOT 1
- Need Laravel 11 Support HOT 1
- Telegram Bot Driver Issue HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from botman.