Comments (18)
I'd like to second this. I'm trying to write a prototype application using this library and am having to refer to other projects to get an idea of how this library is supposed to work. So far it's proving very difficult.
from slackapi.
I agree that this library is missing some good examples and documentation how to use it. Especially for beginners its currently pretty hard to figure out how it works.
I therefore added a simple but complete example for sending a message to the wiki. Feedback is of course welcome!
https://github.com/Inumedia/SlackAPI/wiki/Complete-example-for-sending-a-message
from slackapi.
3rd this - How do you receive messages? I can't see any events for incoming messages?
from slackapi.
The SlackSocketClient has an incoming messages event.
from slackapi.
Check issue no 3 (closed) - Unless I've missed something the event is not firing:
Dim gSlackClient = New SlackSocketClient("xxxxxx")
AddHandler gSlackClient.OnHello, AddressOf OnSlackHello
AddHandler gSlackClient.OnMessageReceived, AddressOf OnSlackMessageRecieved
gSlackClient.Connect(AddressOf OnSlackConnected)
Private Sub OnSlackHello()
console.writeline("Hello") 'Fires
End Sub
Private Sub OnSlackMessageRecieved(ByVal obj As NewMessage)
Console.WriteLine(obj.text) 'Nothing
End Sub
Private Sub OnSlackConnected(ByVal LoginResponse As LoginResponse)
Console.WriteLine("connected") 'Fires
End Sub
from slackapi.
your app needs to stay running after you call .Connect(). the SlackAPI doesn't do that on its own.
from slackapi.
It's a winforms app so the connection is open.
from slackapi.
Are you running it on a separate thread from the UI thread? Maybe the thread is closing.
from slackapi.
Here is the C# I have running now in LINQPad if this helps.
var authToken = "ADD YOUR TOKEN HERE";
SlackSocketClient client = new SlackSocketClient(authToken);
SlackClient client2 = new SlackClient(authToken);
client2.TestAuth((art) => art.Dump());
client.Connect((connected) =>
{
//This is called once the client has emitted the RTM start command
"Started".Dump();
}, () =>
{
//This is called once the RTM client has connected to the end point
"Connected".Dump();
});
client.OnMessageReceived += (message) =>
{
message.Dump();
if (message.type == "message" && message.text == "test")
{
client.SendMessage((mr) => mr.Dump("Message Received"), message.channel, "Testing Socket");
var buttons = new Attachment();
buttons.text = "Lets pick a button";
buttons.color = "#FF0000";
client2.PostMessage((pmr) => pmr.Dump("Post Message Received"), message.channel, "Testing SlackClient", attachments: new[] { buttons});
}
};
The easiest way to see how it works is to have a play with linqpad or check out the integration tests.
I have implemented both the websocket sending of a message and web api posting a message in this as well.
from slackapi.
@chinswain I just used your exact code in LINQPad with my Auth token and it works.
from slackapi.
Here's a simple gist I had use for scriptcs.
https://gist.github.com/glennblock/8bab71fb01ddd26e09127aba2d41d02a
On Sun, Jul 24, 2016 at 8:50 PM Andrew McClenaghan [email protected]
wrote:
@chinswain https://github.com/chinswain I just used your exact code in
LINQPad with my Auth token and it works.—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#52 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAInRDJ6cQhcy-mTXFVIQsXwBCkenn0Eks5qZDJ3gaJpZM4I6tyl
.
from slackapi.
Can we send Messages with Buttons and Attachments using this SlackAPI?
from slackapi.
@vanshita see the example from @andymac4182 earlier in this thread. It includes a button from my read. I haven't tried it out, though.
from slackapi.
Hey @kenrachynski.
Thanks for helping me.
I tried the same code, but in Visual Studio 2015 with some changes and It is working now.
One more thing, I wish to send a direct message with all buttons and attachments instead of posting to a channel, I cannot find a function like PostMessage with post to direct user instead of channel. Could you please help me?
from slackapi.
@vanshita from memory you can post to the username
instead of the #channel
and that will work.
from slackapi.
@andymac4182 It is working when I am passing the user Id to the function, but not with username. Also, I am able to get the user list only from RTM and not websocket.
from slackapi.
Hi
I'm a beginner for this API and had a trouble with sending and receiving messages simultaneously with SlackSocketClient.
I managed to find a solution and add it to the wiki:
https://github.com/Inumedia/SlackAPI/wiki/RTM-API-example-for-just-parroting-messages-received
But review is required, because I'm not confident of my solution and English writing skill honestly...
from slackapi.
I'd like to see examples for interacting with dialogs. I noticed a Dialog model in the library. But I don't know how to use it.
from slackapi.
Related Issues (20)
- Extensions.ToProperTimeStamp for Slack Date formatting
- How do I resolve a missing_scope error HOT 4
- Add conversations.join method
- Build failing HOT 2
- Nuget push failing due to missing environment variable HOT 2
- Fix UpdateAsync (and Update) not to pass "as_user" unless specified
- "conversations.members" support
- target dotnet core and not .net framework HOT 6
- SlackTaskClient.DeleteMessageAsync takes a datetime but should take a timestamp string HOT 1
- Refactor GetUserListAsync (of SlackTaskClient) to allow arguments HOT 1
- Can't Specify Markdown Boolean in PostMessageAsync()
- rtm.start depreciated starting 2022/09/20 HOT 7
- [Bug] SlackTaskClient.GetChannelListAsync() returns unknown_method HOT 2
- It became impossible to connect to slack around 2022/9/27 HOT 4
- Add reactions.remove support.
- How to implement Conversation API HOT 2
- Rate limits HOT 1
- Is there an example of attaching text files to a message? HOT 1
- Is this still maintained?
- GetChannelListAsync() returns error of "unknown method". HOT 1
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 slackapi.