How to make hubot hear other integration comment on Slack? - hubot

I wrote coffee script like below to integrate mailchimp and other service on Slack using Hubot.
Hubot do hear me and other team member comment, but won't hear mailchimp notification comment.
Anyone know how to solve it?
Thank you.
module.exports = (robot) ->
robot.hear /^(.*)( foo bar)$/i, (msg) ->
#Do something

I understand the reason why Hubot won't work when I read this Japanese Article.
http://qiita.com/Vexus2/items/aaf87212e7239132446b
Summary of this article is as below.
First, Hubot-slack don't support Bot to Bot.
And It will be fixed within this year.
(I saw an article which a Japanese developer asked support desk about this,
and he received reply as above.)
Secondary, If you can't wait that modification,
you should use Hubot-IRC adapter and Slack IRC instead of Hubot-Slack.

You can listen to other bot's messages by using
controller.on('bot_message', function (bot, message) {
console.log('message', message);
var attachment = message.attachments[0];
console.log('attachment', attachment);
});

There's an ugly-ish workaround: SlackBot, Slacks native bot is heard by hubot.
And it's a simple POST request to make it say something to a channel that your hubot can respond to.
E.g.
curl --data "\#hubot asci me OMG from SlackBot" 'https://my.slack.com/services/hooks/slackbot?token=<YOUR_SLACK_TOKEN>&channel=%23channel_that_hubot_is_in'

Related

Solved How to make the telegram bot write to your channel?

upd: 09.11.20 SOlVED I've made the telegram bot that working good in single conversations of a groups. However right now I want it to send messages right in my channel.
When I'm writing script(after i write straigt to the bot to invoke it by command /start)
import telebot
token = '...'
bot = telebot.TeleBot(token)
#bot.message_handler(commands=['start'])
def default_test(message):
answer = 'Привет!'
bot.send_message('#hello_danishere', answer)
bot.polling(none_stop=True, interval=0)
or doing a html query
https://api.telegram.org/bot/sendMessage?chat_id=#hello_danishere&text=123
i'm getting an error.
{"ok":false,"error_code":400,"description":"Bad Request: chat not found"}
I've already done this things that found in internet:
Give the administator permissions to the bot
Used #mychannelname instead of message.chat.id while invoking send_message
Written smthg in channel cause bot can reply only if you already written him.
SOlVED.
The thing is you need to check three things to success:
1.Your channel responding to link t.me/<nameofPUBLICchannel
2.Your bot has administrative permissions
3.You've already posted smtng on your channel
That helped me

Getting started with Sony Audio Control API

Trying to use the new Sony Audio Control API with my STR-DN1080 (firmware M41.R.0377), but having a lot of trouble following the guide on https://developer.sony.com/develop/audio-control-api/. It's certainly pretty looking, but the Tutorials are not very helpful.
So based on that portal, it sounds like I need to discover the receiver's port via SSDP/UPNP. There's not much guidance on how to do this, so I used an Android app "UPNP Browser" and found 3 separate URLs. Within http://str.dn.1080.ip:52323/dmr.xml, I find the base URL:port and available services:
<av:X_ScalarWebAPI_DeviceInfo>
<av:X_ScalarWebAPI_Version>1.0</av:X_ScalarWebAPI_Version>
<av:X_ScalarWebAPI_BaseURL>http://str.dn.1080.ip:10000/sony</av:X_ScalarWebAPI_BaseURL>
<av:X_ScalarWebAPI_ServiceList>
<av:X_ScalarWebAPI_ServiceType>guide</av:X_ScalarWebAPI_ServiceType>
<av:X_ScalarWebAPI_ServiceType>system</av:X_ScalarWebAPI_ServiceType>
<av:X_ScalarWebAPI_ServiceType>audio</av:X_ScalarWebAPI_ServiceType>
<av:X_ScalarWebAPI_ServiceType>avContent</av:X_ScalarWebAPI_ServiceType>
</av:X_ScalarWebAPI_ServiceList>
</av:X_ScalarWebAPI_DeviceInfo>
Then, following the API reference for getSystemInformation (v1.4), I issue a GET to http://str.dn.1080.ip:10000/sony/system/getSystemInformation, but all I get back is {"error":[404,"Not Found"]}
I'm stumped now, and looking for help from Sony Developer Support. What am I missing? Is there something I need to enable on my receiver? Is there a hidden firmware that the Auto Updater won't apply?
Thanks!
For those searching on how to use the Sony API in Windows with curl, and to add onto the accepted answer, you'll need to replace the single quotes with double quotes and then escape the double quotes in the JSON:
curl -i -d "{\"method\": \"getSystemInformation\",\"id\": 1,\"params\":
[],\"version\": \"1.4\"}" http://str.dn.1080.ip:10000/sony/system
For postman, set type to POST, URL to: http://str.dn.1080.ip:10000/sony/system, and specify Body as raw/JSON, and paste the JSON:
{
"method":"getSystemInformation",
"id":1,
"params":[],
"version":"1.4"
}
The Sony Audio Control API is based on POST request.
So you have to use some program that can generate a POST request like curl to send requests
curl -i -d '{"method": "getSystemInformation","id": 1,"params": [],"version": "1.4"}' http://str.dn.1080.ip:10000/sony/system
You can also use programs like postman to send test requests if you want something with a GUI.

Skype sdk error "Configuration service is unreachable"

Iam using skype js sdk
first : iam searching for any cdn that hold skypebootstap.js and i didn't find a one
second : when i try to sign in using code below
Skype.initialize({ apiKey: config.apiKey }, function (api) {
config.application = new api.application();
signIn();
}, function (err) {
console.log(err);
});
i got error with code 1 and message Configuration service is unreachable
what can cause this error ?
you can check every thing related here SkypeSDk
and the only provider for this file is swx.cdn.skype.com has turn them off.
Check your internet connection if it allow to connect Skype services.
I know very little about Skype developer but I think I can answer your question. I think the reason that you are having trouble is because you typed "Skypebootstap" when I think you meant "Skypebootstrap". I would like to remind you I don't know very much about Skype developer. If this is not the whole code which, I personally, don't think it is take 30 seconds took look through and find a "function" or whatever you call them on Skype that is misnamed "Skypebootstap" and change it to "Skypebootstrap" without the "" and add the .js.
Have a happy day :)
PS. I hope it worked

How to receive & process data when I subscribe to youtube api v3 push notification?

According to this https://developers.google.com/youtube/v3/guides/push_notifications
I can subscribe to a youtube channel & receive push notification for any new video.
My callback server is a php script which interprets POST/GET data:
<?php
if (isset($_GET['hub_challenge'])) {
print $_GET['hub_challenge'];
}
else {
$xml=file_get_contents("php://input");
file_put_contents('endpoint.txt',$xml);
}
?>
But $xml is empty. In the docs it says:
The YouTube Data API (v3) supports push notifications via
PubSubHubbub, a server-to-server publish/subscribe protocol for
Web-accessible resources. Notifications are pushed out to subscribers
via HTTP webhooks, which is much more efficient than polling-based
solutions.
But it does not specify how does it send the data....whether in POST body or in somewhere else.
So How do I get the atom feed in my script?
EDIT: I should probably ask a new question for this...but anyway....I tried this channel (https://www.youtube.com/channel/UCATp8LNTjzjNlLxdArp0Myg); but when I try to subscribe it says "restricted topic" (I did not provide token as it is a public channel). Same for any other channel ID. Is something wrong with my callback server? I also tried runscope url as a callback server for testing. But it did not help.
Others are having similar problems. Here is the issue log:
https://code.google.com/p/gdata-issues/issues/detail?id=7138
and related StackOverflow question:
Youtube API - Subscribing to Push Notifications
Unfortunately, no one seem to provide a solution although you can follow the issue and track any progress.
Yes it send data on the POST body . If you are using Express Nodejs add app.use(bodyParser.xml()) middleware to parse xml data

What is the URL to make a Google Voice call using the direct access number?

I am trying to write a Google Voice app and was wondering if anyone knew the url and post parameters to make a call using the direct access number instead of the ring-back.
For example, to call 1-800-555-0111, enter
https://voice.google.com/u/0/calls?a=nc,%2B18005550111
I did not test it, but check this api: http://code.google.com/p/google-voice-java/
Specially, the voice.java at line 711, which is the method:
public String call(String originNumber, String destinationNumber,
String phoneType) throws IOException {
In line 737 they use:
URL callURL = new URL("https://www.google.com/voice/call/connect/");
and the full comments for the methods say:
// POST /voice/call/connect/
// outgoingNumber=[number to call]
// &forwardingNumber=[forwarding number]
// &subscriberNumber=undefined
// &phoneType=[phone type from google]
// &remember=0
// &_rnr_se=[pull from page]
I hope this helps.
I don't think there is an official API, but this site seems to have made some progress with the URLs you are after: http://posttopic.com/topic/google-voice-add-on-development , and there is an unofficial API here: http://sourceforge.net/projects/gvoicedotnet/
Google Voice does not expose an API to the service however, there are many 3rd party libraries that mock an API by screen scraping via Google Voice's HTML website. I better solution though is to use the google voice service via SIP. Search for "google voice sip asterisk" and you will find out about this. Basically if you install this software called asterisk it can make calls via google voice.
See this article for a start:
http://eggie5.com/10-installing-asterisk-on-osx

Resources