![| Embarcadero RAD Studio Delphi C++Builder Blogs How To Make A Fully Working Slack Bot In Under 10 Minutes](https://i0.wp.com/blogs.embarcadero.com/wp-content/uploads/2021/12/pexels-mikhail-nilov-8284722-1067385-scaled.jpg?resize=1140%2C694&ssl=1)
Slack is one of the leading communication platforms for millions of users. With it, you can perform instant messaging, document sharing, and a variety of other activities to improve the collaboration between team members. You can also automate or control many things with Bots in Slack by using IDE Software.
![imgcampaignhero3125292 | Embarcadero RAD Studio Delphi C++Builder Blogs img campaign hero 3125292](https://i0.wp.com/blogs.embarcadero.com/wp-content/uploads/2021/12/img-campaign-hero-3125292.jpg?resize=600%2C345&ssl=1)
Can you create Slack Bots using Delphi?
Yes you can!
SDriver is a Delphi wrapper for Slack API by Andrea Magni who is one of the Embarcadero MVPs. SDriver is a free and open-source wrapper for Delphi developers.
The best thing is that the wrapper utilizes the native HTTP client libraries for each supported platform – System.Net.HttpClient. And also implemented with System. Threading library to work asynchronously.
What are the features of SDriver?
- Compatible with FireMonkey, Visual Component Library, and also Non-visual components
- Support for Message Attachments
- Support for Incoming Webhooks
- Implemented using Native HTTP Client Libraries
- Async implementation using Parallel Programming Library
What are “Incoming Webhooks” in Slack?
Incoming Webhooks are a simple way to post messages from apps into Slack. By creating an Incoming Webhooks you get a unique URL which you can send a JSON payload with the message text and some options.
1 2 3 4 5 |
POST https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX Content-type: application/json { "text": "Hello, world." } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
implementation {$R *.dfm} uses System.Diagnostics , SDriver.Message, SDriver.Interfaces, SDriver.IncomingWebHook; procedure TForm1.SendActionExecute(Sender: TObject); var LWebHook: IMessageBuffer; LMessage: IMessage; LStopWatch: TStopWatch; begin LStopWatch := TStopWatch.StartNew; LMessage := TMessage.Create(EditMessage.Text + ' [' + TimeToStr(Now) + ']'); LMessage.UserName := EditUserName.Text; LMessage.Icon_URL := EditIcon_URL.Text; LMessage.Icon_Emoji := EditIcon_Emoji.Text; LMessage.Channel := EditChannel.Text; LWebHook := TIncomingWebHook.Create(EditWebHookURL.Text, False); LWebHook.Push(LMessage); LWebHook.Flush; end; procedure TForm1.SendActionUpdate(Sender: TObject); begin SendAction.Enabled := (EditWebHookURL.Text <> '') and (EditMessage.Text <> ''); end; |
Design. Code. Compile. Deploy.
Start Free Trial Upgrade Today
Free Delphi Community Edition Free C++Builder Community Edition