Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Mar 22 2021 17:07
    @MadLittleMods banned @VijayKu35355753_twitter
  • Jun 05 2018 23:13
    @MadLittleMods banned @LWSS
Wang Shidong
@wsdjeg
I can not share the token in group
curl -X POST -i -H "Content-Type: application/json" -H "Accept: application/json" -H "Authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxx" "https://api.gitter.im/v1/rooms/586c6a98d73408ce4f410f71/chatMessages" -d '{"text":"hello"}'
so I use xxxxxxxxxxxx as token
Eric Eastwood
@MadLittleMods
@wsdjeg hmm, I'm not seeing that problem at all if I just replace the access token and room ID.
Wang Shidong
@wsdjeg
image.png
image.png
I think the token is ok for me, because I can use the token to list all message and use it with stream api
But I can not use it to send message.
Eric Eastwood
@MadLittleMods
@wsdjeg I'm not sure. Are you able to reproduce with a different room and user?
Wang Shidong
@wsdjeg
But I only have one gitter account
Eric Eastwood
@MadLittleMods
@wsdjeg You're sending messages here. It uses the same API. What if you used this room ID 5790a3a2c2f0db084a24004d?
Wang Shidong
@wsdjeg
ok, I fixed it.
I use should use -d "{\"text\":\"hello\"}" instead
I think it is issue with cmd.exe
Eric Eastwood
@MadLittleMods
I see. The snippets you posted before work fine on macOS for reference
Wang Shidong
@wsdjeg
so how to deal with " in text context
-d "{\"text\":\"he\"llo\"}"?
-d "{\"text\":\"he\\\"llo\"}"
image.png
Eric Eastwood
@MadLittleMods
Glad you got it figured out. Thanks for following up!
Wang Shidong
@wsdjeg
@MadLittleMods hi, I have a question about using curl, when I use curl with stream api, it does not print result to stdout.
and with the same command, it works well in terminal
1 reply
Wang Shidong
@wsdjeg
Hi, what is the encoding of the server?
I can not send chinese charactors.
for exmaple: ����
6 replies
Wang Shidong
@wsdjeg
@MadLittleMods It seems issue of server encoding.
Wang Shidong
@wsdjeg
hi, how to send multiple line message, use hello\nworld does not work
@MadLittleMods the list all messages api does not return thread message?
Eric Eastwood
@MadLittleMods
@wsdjeg It's probably easiest to inspect what Gitter is doing in the browser to see what it's doing.
  • \n should work. Just make sure it's being escaped correctly
  • For threads, use /v1/rooms/:roomId/chatMessages/:chatId/thread?limit=50
Wang Shidong
@wsdjeg
yeah, I know, but I think it is better to get all messages when enter a room first time.
I have create the vimchat plugin, when enter a room first time, I hope I can get all history messages
Wang Shidong
@wsdjeg
btw, when list all messages, the message body maybe should include how many replies it has.
Ok, got it. it is threadMessageCount
Wang Shidong
@wsdjeg
@MadLittleMods I have a question about the api, I do not know why, sometione the response is comming from stderr when run curl command.
but the job exit code is 0.
Eric Eastwood
@MadLittleMods
@wsdjeg Sounds like an intricacy of curl instead of the API?
Wang Shidong
@wsdjeg
image.png
ok, I have fixed it.
currently the reply counts is displayed.
Wang Shidong
@wsdjeg
maybe, it seems an issue with curl.
Wang Shidong
@wsdjeg
@MadLittleMods I have test it, but I do not know why
I fount the response is print to curl stderr, and the response is correct. I think there is no error in response.
Wang Shidong
@wsdjeg
hi, is there an api to send screenshort image to gitter?
Eric Eastwood
@MadLittleMods
@wsdjeg You can use the markdown syntax to send any image ![](image.png) but it needs to be hosted somewhere first. It is possible to upload an image but it's not a documented part of the API and isn't straightforward if you reverse-engineer the Gitter webapp
Wang Shidong
@wsdjeg
OK thanks
Wang Shidong
@wsdjeg
@MadLittleMods I have read the code of webapp of gitter, but I can not found which file is for sending file to gitter.
Eric Eastwood
@MadLittleMods
@wsdjeg See gitterHQ/webapp#2571
Wang Shidong
@wsdjeg
@MadLittleMods thanks. I will have a try.
Sai
@t2dk49580
Is there an API for uploading files?
Eric Eastwood
@MadLittleMods
@t2dk49580 The messages just above were talking about that 😁. There isn't a documented one and the way the Gitter webapp does it is not straight forward. There are some hints in gitterHQ/webapp#2571