Why aren’t my timestamps displayed in users local timezone - slack-api

The following JSON is sent, as the “attachments” argument, in a call to the chat.postMessage API method. The message is posted to an individual user (not a shared channel) and per documentation I was expecting the timestamps to be displayed in the target user’s local timezone. Instead they are always displayed in UTC, so am I doing something wrong?
[
{
"mrkdwn_in": [
"text"
],
"title": "Important alert",
"footer": "MyCodeThing",
"fallback": "Important alert summary",
"text": "A thing with a date just happened <!date^1475148495^{date_short_pretty} at {time}|Sep 29 at 09:28 PM UTC>\n\nUsers Name from *Company & Associates*",
"fields": [
{
"short": false,
"title": "",
"value": ""
},
{
"short": false,
"title": "Device",
"value": "Using Chrome on Other."
}
],
"footer_icon": "https://anysite.domain.com/static/img/image_only_16.png",
"color": "#f54b0a"
}
]

It looks to me as though it completely ignores the timezone in the preferences, and it shows the time in the current timezone for the PC it is running on. Which, in my case, is UTC. I can change the timezone preference in slack to whatever I want, but it comes up UTC on the computer where I have this problem.
I can use the same account, open the same chat history on another PC, and it shows it in the correct time according to that PC's OS.
This is in the app, not the browser version. I don't know the behavior of the browser version.

Related

Microsoft Teams App localisation does not work anymore

We are trying to build a multilingual chatbot which supports English (en-us) as well as German (de-de). We had been using it on Microsoft Teams without any problems until around mid-June 2020. Thereafter, we noticed that the localization didn't work properly anymore. We also noticed that this was around the same time that Teams introduced manifest version 1.7. The following occurrence is observed:
If the Teams admin uploads the app while their MS Teams client language is en-us, all custom applications ignore the 'de-de' localization info, and all information, as well as commands, are displayed in English only, even if the client language for the users is German.
The exact opposite will happen if the language of the admin was de-de when they uploaded the application. All information from the bot will be in German, whereas the default language (English) will be ignored.
As a sample, I am sharing this screenshot.
Here, you can see that although the client language is German, the suggestion commands appear in English. In fact, the bot name and description are also in English. In fact, we observed that the same behaviour is also exhibited for the official manifest template from Microsoft.
Here are our manifest files:
manifest.json
{
"$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.7/MicrosoftTeams.schema.json",
"manifestVersion": "1.7",
"version": "1.0.0",
"id": "00000000-0000-0000-0000-00000000000",
"packageName": "com.sample.sample.sample.dev.bot3",
"developer": {
"name": "Sample Inc.",
"websiteUrl": "https:/sample.z6.web.core.windows.net",
"privacyUrl": "https://sample.z6.web.core.windows.net/privacy.html",
"termsOfUseUrl": "https://sample.z6.web.core.windows.net/tou.html"
},
"localizationInfo": {
"defaultLanguageTag": "en-us",
"additionalLanguages": [
{
"languageTag": "de-de",
"file": "de-de.json"
}
]
},
"icons": {
"color": "color.png",
"outline": "outline.png"
},
"name": {
"short": "Manifest Test EN",
"full": "Manifest Test EN Bot"
},
"description": {
"short": "Manifest Test EN",
"full": "Manifest Test EN Bot"
},
"accentColor": "#40497E",
"bots": [
{
"botId": "00000000-0000-0000-0000-00000000000",
"scopes": [
"personal"
],
"supportsFiles": true,
"isNotificationOnly": false,
"commandLists": [
{
"scopes": [
"personal"
],
"commands": [
{
"title": "Personal Command 1",
"description": "Description of Personal Command 1"
},
{
"title": "Personal Command N",
"description": "Description of Personal Command N"
}
]
}
]
}
],
"staticTabs": [
],
"permissions": [
"identity",
"messageTeamMembers"
],
"validDomains": [
"sample.z6.web.core.windows.net",
"token.botframework.com"
]
}
Localization file de-de.json
{
"$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.7/MicrosoftTeams.Localization.schema.json",
"name.short": "Manifest Test DE",
"name.full": "Manifest Test DE Bot",
"description.short": "Manifest Test DE",
"description.full": "Manifest Test DE Bot",
"bots[0].commandLists[0].commands[0].title": "Persönlicher Befehl 1",
"bots[0].commandLists[0].commands[0].description": "Beschreibung des persönlichen Befehls 1",
"bots[0].commandLists[0].commands[1].title": "Beschreibung des persönlichen Befehls N",
"bots[0].commandLists[0].commands[1].description": "Das ist DE1"
}
We are experiencing the same issue here only we have been able to determine that the language the app is shown to the user is the language the app is installed with.
So in your case the app was propably installed when your Teams language was set to German, if you would now switch to another language the app would still be in German. We have tried this for multiple apps, multiple users and multiple tenants. The language used is always the one from the client the app is installed from, not the language the current user is using.
So for example when a App is installed with a client that is for example in German, the app will be configured in German for this user and all other users of the tenant the app is installed for. If the user that installed the app switched language (fe: English) to another supported language the language stays in German (even when the client is restarted). The same goes for other users, if a user at the moment of installation for example was using the application in English then the app will also be in German for that user and not English since it was installed by a user who had German as it's default language.
Could you please try updating the version to 1.2 in the manifest?
here is the result after updating the version

rest/api/2/issue/<issue-id>/transitions returns empty array

I've created an issue that follows this workflow:
When I call rest/api/2/issue/<issue-id>/transitions after creating an issue (which is in OPEN status now) it returns the following JSON:
{
"expand": "transitions",
"transitions": [
{
"id": "4",
"name": "Start Progress",
"to": {
"self": "URL",
"description": "This issue is being actively worked on at the moment by the assignee.",
"iconUrl": "URL",
"name": "In Progress",
"id": "3",
"statusCategory": {
"self": "URL",
"id": 4,
"key": "indeterminate",
"colorName": "yellow",
"name": "In Progress"
}
},
"fields": {}
}
]
}
When I make the same call after I change the issue status to "IN PROGRESS" I get back
{
"expand": "transitions",
"transitions": []
}
My questions are:
In the first response shown above, I expected the transitions to "CLOSED" and "RESOLVED" along with the one to "IN PROGRESS". But I only get back the one leading to "IN PROGRESS". Why?
I expected the second response to contain the transitions to "CLOSED", "RESOLVED" and "OPEN", but it returns an empty array. Why?
Please explain the responses from this API
What call should I make to get the next possible transitions?
This is probably a permission issue. The API only shows the transitions that are available to the current user, thus if you are not allowed to execute the CLOSE or RESOLVE transitions due to conditions in the project workflow, they will not appear in the JSON object.
See getTransitions from the JIRA REST API :
Get a list of the transitions possible for this issue by the current user, along with fields that are required and their types.
In order to get the transitions, you can either log in with an account that has the required permissions (check the corresponding workflow) or modify the conditions of the transition in this workflow.

Ruby on rails: Substring with quotes search inside JSON object

I have retrieved a json object using typhoeus gem.
url = 'www.example.com' <br>
request = ::Typhoeus::Request.get(url,userpwd: username + ":" + pass)<br>
content = JSON.parse(request.body)
I would like to count the occurence of "Priority":"high" including the quotes inside the json response. How do I go about doing this?
Edit:
"priority":"high" is a key value pair. It is deeply nested inside the json tree.(Don't how deeply it is nested). All I need is count of occurence of "priority":"high"
Any and all suggestion is welcome.
Sample data:
"tickets": [{
"url": "https://.zendesk.com/api/v2/tickets/xxxx.json",
"id": xxxxx,
"external_id": null,
"via": {
"channel": "email",
"source": {
"from": {
"address": "#compli.com",
"name": ""
},
"to": {
"name": "organization Global Support",
"address": "support#organization.zendesk.com"
},
"rel": null
}
},
"created_at": "2016-08-04T16:23:13Z",
"updated_at": "2016-08-08T20:26:01Z",
"type": "problem",
"subject": "Problems with abc Connect",
"raw_subject": "Problems with abc Connect",
"description": "Hi – our Tenet ID is 5675.\n\n \n\nThe abc report is not providing the full data when I run the billing preview. I am running it using Chrome. Attached are snapshots of what I’m doing plus the report generated.\n\n \n\nA perfect example of the problem is shown at the bottom of the report generated. Garber Automotive Group, account number A00000490 does not display the data for all of their products. Their data is shown on rows 5658 thru 5712 on the excel file BillingPreviewResult_201620 report run 08.04.16.\n\n \n\nHowever the EXACT same report (all the parameters are the same) run on 07/01/16 included all of Garber’s information. The excel file abc report run 07.01.16 10.13 AM has the data for Garber on rows 6099 – 6182.\n\n \n\nThe report is cutting off a lot of data for some reason. As you can see by comparing the amount of data between the two excel reports there are much fewer lines on the report run on today as opposed to the one run on 07/01, 6182 rows vs 5712 rows.\n\n \n\nThis is a business critical report for us. It is used for cash forecasting, monthly financial reporting, rolling budgeting and ad hoc reporting.\n\n \n\nWe need this problem identified and fixed immediately. It is already causing a problem with finalizing our July results.\n\n \n\nLet me know if you have any questions or need any additional data.\n\n \n\n \n\nRegards,\n\n \n\n \n\n \n\n| Controller\ndesk: 503.963-4239 | fax: 503.294.1200 | \n\nCompli - Cool, Calm and Compliant. TM\n\nVisit() to learn more.\n\n \n\nFollow us on LinkedIn () and Twitter",
"priority": "normal",
"status": "open",
"recipient": "support#organization.zendesk.com",
"requester_id": 1336424406,
"submitter_id": 1336424406,
"assignee_id": null,
"organization_id": 224504969,
"group_id": 21606503,
"collaborator_ids": [560973773, 786229209, 421597631, 539566717, 707192615, 1336424406, 31365392, 719608577, 1817633993],
"forum_topic_id": null,
"problem_id": null,
"has_incidents": false,
"due_at": null,
"tags": ["1_price", "best_practice_advise", "engage_global_services__email_", "escalate", "hard", "internal_escalation", "p0", "yes_escalated", "xxxxx", "zhub"],
"custom_fields": [{
"id": 22024091,
"value": "p0"
}, {
"id": 24212576,
"value": "best_practice_advise"
}, {
"id": 22035048,
"value": "xxx and so on.....

Getting the Highway name - Skobbler

I need to get the highway name on which the user is currently navigating.
That can be done in navigation mode, getting it from
-(void)routingService:(SKRoutingService *)routingService didChangeCurrentStreetName:(NSString *)currentStreetName streetType:(SKStreetType)streetType countryCode:(NSString *)countryCode
So, when I was testing my app yesterday, I was on the highway, and yes, Skobbler did recognised that I am on one, and yes, I got the Highway name back.
It was "Brooklyn-Queens Expressway".
But, Brooklyn-Queens Expressway is actually name of the I-278 Interstate highway, and all the functions I would later have to use, need to get Highway name in that format I-nnn
Here is the map photo of what I mean
So, Is there a way to get streetName in that I-nnn format, when the streetType is recognised as an interstate highway?
Or is there any Open Streetmap database we could consult? I wasn't able to find anything on OSM Wiki.
Don't know about the Skobbler SDK, but if online query is available and you have the approximate geographical area and the name of the motorway, you may use the Overpass API (http://wiki.openstreetmap.org/wiki/Overpass_API) to query the openstreetmap database for the highway reference.
For example, the following query (for a particular bbox which contains a small section of the highway):
[out:json]
[timeout:25]
;
(
way
["highway"="motorway"]
["name"="Brooklyn-Queens Expressway"]
(40.73483602685421,-73.91463160514832,40.73785205632046,-73.9096748828888);
);
out body qt;
returns (with some key-value pairs omitted for simplicity):
{
"version": 0.6,
"generator": "Overpass API",
"osm3s": {
"timestamp_osm_base": "2015-09-18T20:21:02Z",
"copyright": "The data included in this document is from www.openstreetmap.org. The data is made available under ODbL."
},
"elements": [
{
"type": "way",
"id": 46723482,
"nodes": [
488264429,
488264444,
488264461,
488264512,
488264530,
488264541,
597315979
],
"tags": {
"bicycle": "no",
"bridge": "yes",
"foot": "no",
"hgv": "designated",
"highway": "motorway",
"horse": "no",
"lanes": "3",
"layer": "1",
"name": "Brooklyn-Queens Expressway",
"oneway": "yes",
"ref": "I 278",
"sidewalk": "none",
}
},
{
"type": "way",
"id": 46724225,
"nodes": [
597315978,
488242888,
488248526,
488248544,
488248607
],
"tags": {
"bicycle": "no",
"bridge": "yes",
"foot": "no",
"hgv": "designated",
"highway": "motorway",
"horse": "no",
"lanes": "3",
"layer": "1",
"name": "Brooklyn-Queens Expressway",
"oneway": "yes",
"ref": "I 278",
"sidewalk": "none",
}
}
]
}
Which are 2 sections of the road in the osm database. In the US the "ref" tag for interstates is in the form "I XXX" (See http://wiki.openstreetmap.org/wiki/Interstate_Highways and note the format for co-location). You can retrieve the interstate name accordingly.
You can try the above query in overpass-turbo (a UI for the service) at http://overpass-turbo.eu/s/bxi (Press RUN and the DATA tab for the returned data, and pan the map for query in another bbox).
The "ref" information is not exposed in the SDK (will put this on the TODO list).
A workaround would be to look in the text advices (when using TTS) as this information is there (if you look at the $ref parameter, that contains the information you are looking for).
For more details regarding the text advices structure, see this blog article.

Facebook graph API: Event timezone, time

I am currently having a problem with getting the correct time for an event via Facebook's graph API. There are some events showing the correct time and some are not. Even if I am calculating the timezone wrongly, it just doesn't make sense to me.
For example I have the following three events: "Brunch", "Champions league finale" and "Pfingst-Tanz". That's what the graph API gives back:
{
"data": [
{
"name": "Pfingst-Tanz",
"start_time": "2012-05-27T10:00:00",
"end_time": "2012-05-27T14:00:00",
"timezone": "Europe/Berlin",
"location": "...",
"id": "..."
},
{
"name": "Championsleague Finale",
"start_time": "2012-05-19T11:45:00",
"end_time": "2012-05-19T14:45:00",
"timezone": "Europe/Berlin",
"location": "...",
"id": "..."
},
{
"name": "Muttertagsbrunch",
"start_time": "2012-05-13T10:00:00",
"end_time": "2012-05-13T14:00:00",
"location": "...",
"id": "..."
}
],
"paging": { … }
}
On the Facebook page it shows:
Pfingst-Tanz 19:00 (07:00 pm)
Champions league finale 20:45 (8:45 pm)
Brunch 10:00 (10:00 am)
Which results in:
Pfingst-Tanz: Facebook page correct, API incorrect or TZ incorrect in my app
(Champions league finale: don't know, never mind)
Brunch: Facebook page and API correct and same
This just does not correspond to each other. From what I understand it has to be either all wrong or none wrong, but not just 1/3 or 2/3 events. Does anyone have an idea, or am I just too blind to see something?
Your "Brunch" event doesn't include a time zone, so it can't be adjusted to the user's local time zone, which is what I assume Facebook is doing.
It's not immediately clear to me whether the start_time and end_time values are meant to represent the local start/end times (in the given time zone) or the UTC start/end times, but that should be easy enough to work out based on the data (and documentation, hopefully). I suspect it's the UTC start/end when there's a time zone specified, but the local start/end otherwise.

Resources