Is there a way to do bot internationalization in Slack? - slack-api

I have implemented a custom slash command in Slack. Now I would like it to send different responses depending on user locale. After examining Slack API documentation I could not find any reference to internationalization.

Slack does not store the user locale, but you can get the timezone info of a user with users.list. Since the timezone info usually also includes country and next metro city, you should be able to estimate the user locale.
See here for the documentation of that method.
Update
Since September 2017 Slack has added an optional locale feature to its API. Check out this post for details.

Related

Autosuggest and get timezone in detail

Is there any possibility to get timezone (IANA) in place detail after confirm autosuggest place?
I have a text field with autosuggest api. After user confirms one of the results, there is second request to Here API and I need timezone name in place details.
In my first version I used this endpoints:
autocomplete.geocoder.ls.hereapi.com/6.2/suggest.json
and for second detail request this:
geocoder.ls.hereapi.com/6.2/geocode.json
with locationattributes=adminInfo,timeZone and everything was OK, timezone was in response.
Now I am trying to switch to v7 of Here autosuggest API and I have a problem, I am not able to get timezone in my second (place detail) request (I am using lookup api).
And if I tried to mix versions - take place ID from first request (autosuggest api) and use it for geocode 6.2 - it is not valid.
The timezone option is not supported in Geocode and Search API V7 currently.
We will confirm that we can support the option timezone in the futuer.
For second question please see the part "Follow-up query" in documentation below.
There is lookup rest api v7.
https://developer.here.com/documentation/geocoding-search-api/dev_guide/topics/endpoint-autosuggest-brief.html

Cards and Markup for RentalCarReservation?

I'm looking to add [RentalCarReservation] (https://schema.org/RentalCarReservation) to the consumer-side confirmation emails sent for a large, multinational rental agency but am running into two key questions:
Is there a corresponding Google Now tag that will correctly handle and parse vehicle rentals in particular at this time, or should we use a more generic order markup scheme until such time as there is support for this? It should be noted that none of our competitors seem to be using microdata at all, so there's no industry trend.
As asked earlier on this tag, what is the state of JSON-LD adoption for Google Now tags? By its nature the RentalCarReservation schema requires JSON rather than RDFa or similar.
RentalCarReservation is currently supported by Gmail markup, you can find more info and JSON/microdata examples here:
https://developers.google.com/gmail/markup/reference/rental-car#basic_reservation_confirmation
JSON is supported, as stated in the following link:
https://developers.google.com/gmail/markup/reference/formats/json-ld
In order to be enabled to send RentalCarReservation to your Gmail customers, you will have to register and provide a sample email, more info here:
https://developers.google.com/gmail/markup/registering-with-google?hl=en

Is there any slack API to update profile information?

Hi I would like to update profile information of my slack account using API.
I don't find any API on their documentation. Do they have any API to update profile information?
See the screenshot http://screencast.com/t/f7eoAKT0Yy
Yes, they do.
But it's an undocumented API method. It's called users.profile.set. So far I used it to change first- and last name, but other attributes should work too.
The basic syntax is:
users.profile.set?token=XXX&user=U12345678&profile=NEWPROFILE
NEWPROFILE is a placeholder for the new profile for the user in JSON format, but you only need to specify the attributes you want to change, e.g. profile={"first_name":"John"} will change the first name to John.
Check out my documentation on github for details and other undocumented methods in the Slack API.
Update November 2018
user.profile.set is now an official API method. However, you
need to be on a paid team to use it for other users (not yourself).
Although you can check this answer for a workaround.
users.setPhoto will allow you to change the profile picture. but
only for your own user / token.
No, they don't have any API for this.http://screencast.com/t/dmBImpJfkXu

Using IP.Board XML-RPC API

I write the application on Node.js and I need to get information from the forum, which works on the engine IP.Board. I decided to use XML-RPC API. On this issue there is an article In the administrative tools set support for XML-RPC API on the website of the IPB. I managed to get some information through the API, but I don't know how to authenticate a user.
My actions:
In the administrative tools set support for XML-RPC API
Add user and allow to perform all methods
Copy the key and use in my application
But when it comes to posting on the forum from outside I have trouble . Read the article linked above:
method postTopic
member_field: This should be the field to look up the 'member_key' in
(for instance, 'member_id', 'email', 'members_display_name', etc.)
member_key: The value to search in 'member_field' with in order to find the poster. You may pass member_field as ID and member_key as
1, for instance, to post a topic as member ID 1.
forum_id: The ID of the forum to post the topic in
topic_title: The topic title
post_content: The contents of the first post
Now I need to know the ID of the user on whose behalf to publish a post. How to know this?
I had a similar problem and simple solution is not found. You can write your extension for IPB and implement the necessary APIs themselves. Using IPB XML-RPC API (at the time of publication of the question), you can only yourself to find out the ID of a user and on his behalf to make the publication, publish answers or use other available options. For example, automatically check the availability of offensive language in the message and answer any warning.

Streaming API with languages

Is there anyway i can retrieve only English tweets using the Twitter's Live Straeming API?
It seems like using "sample" or "filter" results around 60-70 percent of non-English tweets.
Thanks
Joel
I haven't found a good solution to this, I've solved this using the following:
1) filter by lang attribute equal to "en".
2) I found that several non-english languages are still in the english labelled tweets. So, I downloaded spanish, dutch, and indonesian word lists, and checked for number of non-english word occurrences in tweets. More than 1, and I discard it as non-english.
3) I think I need to filter for portuguese as well, need to investigate this.
Filtering only English-language messages from the twitter stream is an active research area. You could use an off-the-shelf language identification system to locally process the stream and select only messages in English. One such system is langid.py. Full disclosure, I am the author of langid.py.
Another system I know of is ldig by Nakatani Shuyo. I haven't had a chance to experiment with it yet, but it is made specifically for language identification of Twitter messages.
Twitter will soon be releasing a new (or updated) attribute just for this purpose! See their blog post, Introducing new metadata for Tweets
The new lang attribute specifies the language the Tweet was written in, as identified by Twitter's machine language detection algorithms.
At the time of this writing the lang attribute and language parameter haven't yet appeared, however check the Calendar of API changes to see when they plan on releasing it (currently just specifies "2013").
Update 3/30/2013:
The lang attribute was added to the Streaming API on March 26, 2013. In addition, it was also made available on the REST API on March 6, 2013.
For use in the Twitter Streaming API, language is now a request parameter:
https://dev.twitter.com/docs/streaming-apis/parameters#language
So for English you'd add 'language=en' into your request parameter string.
Twitter just finished it!!
cf calendar API:
https://dev.twitter.com/calendar
March 26, 2013 lang attribute & language parameter appears on streaming Blog post Streaming API.
The twitter API rocks!!

Resources