NLP timezone issue - node.js

Currently i am using Bot Framework with Node for my chat bot and i am using API AI as my Natural Language Processing.
My question is, let say the user replied with "yesterday" or "today" or "tomorrow" and it is base on the server time. Now, it will go wrong if a person in Australia says today at 6 AM in the morning and their time which is in GMT will still be previous day and this gives a wrong date.
May i have suggestion on how do i solve this timezone issue?

Each API.AI agent has a default time zone setting which can be altered in your agents settings (documentation here) which will be used to determine the meaning of user's date/time queries like "tomorrow" and "yesterday" and "3pm":
If you're using API.AI's /query API you can send the timezone parameter in the request JSON to indicate what timezone the user you are sending the request on behalf of is in.

Related

How to use Power Virtual Agents and Power Automate to let a Bot write in a user's outlook-calendar

I have created an bot for microsoft teams with power virtual agents. This bot works fine and people can talk with it in ms teams and give the bot some information about dates. For example you could tell the bot a start-date and an end-date for days you aren't able to work.
With the authentification in teams the bot also knows the username and the id of the person, who is talking with it.
Now I like to create an automated flow, which the bot should trigger with the infos like username, userid, startdate and enddate, which should do the following steps:
open/find the specific user's calendar in outlook/teams (I'm pretty sure both use the same calendar)
create for each day in the range of startdate and enddate a (full-day) entry, which says "unavailable"
for each conflict with another meeting in entries of Step 2. cancel the meeting (for the user with username)
post a summary in a specific ms teams channel
I got Step 4 already working fine.
Step 2, I think I've figured out aswell, but with regard to my following problem at Step 1:
There is the template flow: Get calendar, which returns (all?) available calendars. And there is another flow template for creating entries in a specific calendar(Step 2 with option full-day entry), which needs the calendar ID to work.
My big problem is, how am I supposed to get the calendar ID of a specific user?
Is there a way to get the specific calendarID for a username or a userid?
And then what can I do about Step 3?
Thank you a lot for your help.
greets Vulnin
Using Graph API you can get User Calendar ID GET https://graph.microsoft.com/v1.0/{id | userPrincipalName}/calendar
Parse JSON in use is when you take the raw JSON output data from Power Automate and transform it into values. The output of GET command in http returns raw JSON so, you have to parse JSON to use values.
For point 3 Only the organizer can cancel the meeting. Please refer to this document.
You can decline a meeting using Graph API request with POST https://graph.microsoft.com/v1.0/users/{id | userPrincipalName}/events/{id}/decline request.

Why is the timezone of Connect/webhook dates not UTC?

When processing webhook posts, I see the dates are all in my (Eastern US) timezone. This is reported correctly if I apply the option to include Time Zone Information.
I can work with this, but I have a few questions:
why not send in UTC, which is used consistently -- I believe -- throughout the API? (At least, the REST API)
Is Time Zone Information working correctly? I ask because this report says it doesn't support fractional info, such as India's UTC+5.5 correctly.)
What Time Zone is used in the webhook posts? I have changed both my personal preference and my account setting to Katmandu, but I still Eastern. (Thus, I cannot test #2 myself.)
Thank you
1.) Most datetimes coming back from API are UTC, however SOAP and Connect messages follow a hidden account setting. You will need to ask support to change it. It's called "Time Zone used for Connect and SOAP".
2.) Fractional datetimes should work fine
3.) Webhook and SOAP currently use the same time zone as mentioned above. Your UI preferences (account settings and personal preferences) that you see are aimed at UI users. Since you are an API integrator, they follow a different setting.

Respond with User timezone/locale from a webhook request

When I receive a user request I would like to respond with a date with the user timezone. Actually, I can only respond with server TZ
Unfortunately, DialogFlow doesn’t make it easy by simply telling g you what timezone the user is coming from. The best you can do is ask the user for their timezone and then save that to do date/time adjustments in future responses.
This can be optimized a bit for users accessing your agent through Google Assistant by using the new permissions API. See https://chatbotsmagazine.com/personalize-google-assistant-skill-with-user-data-328f5e0860a0
If your user responds to your agent with the parameter of #sys.date-time type, you will receive in your fulfillment the value in ISO-8601 format like "2019-12-17T22:00:00+02:00". The last 6 characters represent a timezone offset. You can use it and calculate the target local time of your users.

How to run a script every Monday morning on my express.js website (or any other specific time)?

I'd like to be able to run 'node sendSomeEmails.js' once every Monday morning.
So far, the easiest way I've found to do it, is actually stick a reminder in my calendar and spin up a terminal and do it myself : (
I'm building an automated email series using Mandrill. Users will subscribe on my website (built on node.js with express), get the first email right away, and then every Monday morning after that I'd like to send the next email in the series. I'll maintain how far along each subscribers is in my database, but I don't know the best way to trigger the Monday morning sends.
I'm running my site on IBM Bluemix, by the way. Maybe there's an easy way to do this with AWS... Although, nothing's ever been easy for me on AWS.
I haven't tried this but it looks possible based on there API.
Mandrill supports message scheduling. It also supports webhooks, you should schedule an email, and setup a webhook. Then when the message is sent it will trigger the webhook to schedule the next email.
https://mandrill.zendesk.com/hc/en-us/articles/205582667-Can-I-schedule-a-message-to-send-at-a-specific-time-
https://mandrillapp.com/api/docs/webhooks.JSON.html

Incorrect time in envelope summary

On the development server I have an account configured to use the EST/EDT timezone for the API calls.
It seems that with this configuration, the API calls return a date with an incorrect time.
For example, I have created an envelope at 12:46 GMT but the API to get the envelope summary is returning the following date:
2015-06-10T15:46:25.8165848Z
If I am not wrong, the time is incorrect because Z is the timezone for UTC and so I was expecting 12:46:25.8165848Z.
Setting the timezone for the API calls to pacific time, the date returned is correct:
2015-06-10T12:46:25.8165848Z
Am I using the API correctly?
For example the API call:
GET https://demo.docusign.net/restapi/v2/accounts/917973/envelopes/b7c31971-53e1-417e-b132-e27514befdcf/audit_events HTTP/1.1
returns an incorrect time for the audit events when the user is configured with a timezone that is not "pacific time".
DocuSign support confirmed what #luis-scott wrote. For now it is not known when the bug will be fixed.

Resources