Calendar usage limits exceeded adding attendee to an event - event-handling

I'm testing Google Calendar API with service account and JWT authentication server to server.
All runs fine except when I try to create an event inside a calendar I receive the error
"code": 403,
"message": "Calendar usage limits exceeded."
The problem appears only when I add an attendee to the event.
If I try to create the same event in the same calendar without any attendee, al works fine.
I receive the same error if I try to add the attendee in a second moment after event creation.
So, at this time, I cannot invite any person to any event programmatically.
For me this is a very big problem.
Can you help me?
Thanks!
EDIT:
I'm using ApiRest with ServiceAccount and JWT token.
This is a sample running fine:
POST https://www.googleapis.com/calendar/v3/calendars/{{calendarId}}/events?access_token={{access_token}}
{
"end": {
"dateTime": "2020-01-17T14:50:05Z"
},
"start": {
"dateTime": "2020-01-17T13:50:05Z"
},
"summary": "prova",
}
while this one returns error
POST https://www.googleapis.com/calendar/v3/calendars/{{calendarId}}/events?access_token={{access_token}}
{
"end": {
"dateTime": "2020-01-17T14:50:05Z"
},
"start": {
"dateTime": "2020-01-17T13:50:05Z"
},
"attendees":[{"email":"xxxxxxxxxxxxx#gmail.com"}],
"summary": "prova",
}
returns
{
"error": {
"errors": [
{
"domain": "usageLimits",
"reason": "quotaExceeded",
"message": "Calendar usage limits exceeded."
}
],
"code": 403,
"message": "Calendar usage limits exceeded."
}
}
There is no difference between POST and PUT method that implements respectively event creation and event update.
When I add any attendee, the result is always error.

Searching about your issue I found out it's been a well-known problem for a while and it's been reported on Issue Tracker in these threads:
Service account is unable to invite calendar groups to calendar events
Unable to set reminders via API request
Can't send notification through service account calendar

Related

Purchase event has been uploaded via Offline Conversions API, but the Event Set does not show any data

I followed the guide here: https://developers.facebook.com/docs/marketing-api/offline-conversions
Unlike "regular" Event Sets, which includes a "Test Events" tab in its dashboard, offline event sets don't seem to have this feature. You must either upload a CSV or call the API.
However, the offline event set shows no data coming from the API at all; the history tab only shows the CSV uploads, which were "last received 10 days ago". It doesn't even include the test upload I made today.
Is this a bug? How long should I wait for the data to appear in the events manager for my offline event?
Sample call
POST https://graph.facebook.com/v15.0/<offline_event_set_id>/events?access_token=<system_user_access_token>
{
"upload_tag": "store_data",
"data": [
{
"match_keys": {
"em": "<hashed>",
"ph": "<hashed>"
},
"currency": "PHP",
"value": 100,
"event_id": "test",
"event_name": "Purchase",
"event_time": "1669633380",
"custom_data": {
"event_source": "in_store"
},
"action_source": "physical_store",
"order_id": "test",
"data_processing_options": []
}
]
}
The response is as follows:
{"id":"<offline_event_set_id>","num_processed_entries":1}
Which seems to indicate that the event was uploaded successfully. But that event never shows up in the Overview tab of that offline event set.
Would appreciate any insights/guides elsewhere/answers, I've spent a few days on this with no success.
The "error": I was encoding the event_time as a string, whereas Facebook expects this value to be an integer. After updating my POST body to correct that, the events started showing up within minutes in the Overview tab.
{
"upload_tag": "store_data",
"data": [
{
"match_keys": {
"em": "<hashed>",
"ph": "<hashed>"
},
"currency": "PHP",
"value": 100,
"event_id": "test",
"event_name": "Purchase",
"event_time": 1669633380, // <-- The only change was removing the quotes
"custom_data": {
"event_source": "in_store"
},
"action_source": "physical_store",
"order_id": "test",
"data_processing_options": []
}
]
}
I really wish Facebook had returned some kind of error or warning, but at least I found the issue. Be careful with your data types, people!

Facebook webhook, how to get conversation id from mid id

Hello everyone i'm building a chat bot, i'm having a problem that is, when a user sends a message to my app, i don't get the conversation id like "t_31231231231231", instead I get "mid", I don't know how to get the conversation from "mid", i tried to find the document but maybe I haven't found it yet. :(
{
"object": "page",
"entry": [
{
"id": "553014938133297",
"time": 1567149324484,
"messaging": [
{
"sender": {
"id": "2112675102192095"
},
"recipient": {
"id": "553014938133297"
},
"timestamp": 1567149323879,
"message": {
"mid": "n89QDNpjbh7UUZjDj7mkfk-Mqd_vry00MlXChtxjo-ZLokFwJAtZ6udnPZibQjzAZpuqsN64UVjTly5cTCEKTQ",
"text": "dasddsad",
"nlp": {
"entities": {},
"detected_locales": [
{
"locale": "vi_VN",
"confidence": 0.8299
}
]
}
}
}
]
}
]
}
This might not be the ideal solution, but can serve as an improvisation. Since, you have the message_id you can fetch message to determine who the participants are, then you can match them with the participants in the conversations.participants.
What I did was to fetch all the conversations with their participants field.
i.e
curl -i -X GET \
"https://graph.facebook.com/v8.0/me/conversations?fields=participants&access_token=your-access-token-goes-here"
Which returns
{"data"=>
[{"participants"=>
{"data"=>
[{"name"=>"Masroor Hussain",
"email"=>"3275685679217538#facebook.com",
"id"=>"4275685679217538"},
{"name"=>"Testpage",
"email"=>"115083020351552#facebook.com",
"id"=>"115083020351552"}]},
"id"=>"t_781422919067688"}],
"paging"=>
{"cursors"=>
{"before"=>
"QVFIUlRKd1RBYmtvVXlicm95QUNZAbjVKUW5LbU5lYzhQM24ycmY1aTBXM1NTbnRSLURhc2xnSlBnOWE3OTJ4ZAy1KbS1LLVhUUEdqYmM0MmVzZAXZAZAX2xRdzJCbXpJSEowMmxzUHc0NlBXQ0FTVEdRSEZAZASmI2SGxsNlNOdC1XOWNSZADl0",
"after"=>
"QVFIUkdEUjNPek5jbE9RNUhzZAXpJTm9hWERvQVdGYVV5cHlfcDl6cEJyZAG5NaGpjR1NkUHI4R0JDd1VkWEU0RUh2ZADFOQUVzN0RwQ2tyYmpXcThEV0hjUDM2QXAxbFRLWDVzUGoyNmFjbkcyUzl3X0Myc1AtanRYUndjMDBSdVZAJZAnI0"
}
}
}
In the participants.data one participant is the page and the other is page_scoped_user. You can parse the response to match your participants and get the conversation id e.g here the conversation id would be "t_781422919067688"
A little late here but I had the same problem and actually found the solution in the Instagram API documentation. I tried it in the facebook graph api and it worked perfectly.
In the webhook event, you have the message ID and the sender ID. Using the sender ID, you can make a call to the Graph API (yes, still an additional API call) using the following endpoint:
/{page_id}/conversations?access_token={access_token}&user_id={user_id}
this will return only the conversation between your page and the specified user.

Google Classroom Rest API Patching 'text' in announcement does not work

When we try to patch 'text' in a Google Classroom announcement using REST API we get an error. If we remove 'text' from the updateMask, it works. Others have also reported this, but there is no answer. Here are the details:
Request URL: https://classroom.googleapis.com/v1/courses/xxxxxxx2746/announcements/xxxxxxx8639?updateMask=text,state
Request Method: PATCH
Payload:
{text: "Live Session at 1/31/2019", state: "PUBLISHED"}
Response:
Status Code: 400
Remote Address: 172.217.15.106:443
{
"error": {
"code": 400,
"message": "updateMask: Non-supported update mask fields specified",
"status": "INVALID_ARGUMENT",
"details": [
{
"#type": "type.googleapis.com/google.rpc.BadRequest",
"fieldViolations": [
{
"field": "updateMask",
"description": "Non-supported update mask fields specified"
}
]
}
]
}
}
Unfortunately, this is a bug in the Classroom API right now. The best workaround right now is to delete and re-create the post with the announcements.delete and announcements.create endpoints. You can keep track of the progress of the bug here.

How to properly create groups using Microsoft Graph?

The request to
POST v1.0/groups
with the body:
{
"description": "hello",
"displayName": "group_for_restore",
"groupTypes": [
"Unified"
],
"mailEnabled": true,
"mailNickname": "group_for_restore",
"securityEnabled": false,
"visibility": "Public"
}
returns the id of the created group. But on the web interface this group does not appear.
That is why the request to
POST v1.0/planner/plans
with the body:
{
"owner": "{group-id}", // from the request above
"title": "group_for_restore"
}
returns such JSON:
{
"error": {
"code": "",
"message": "You do not have the required permissions to access this item, or the item may not exist.",
"innerError": {
"request-id": "d6d74776-e4cc-4cb2-bf87-20e3510b6f8c",
"date": "2018-03-27T14:39:00"
}
}
} (status code 403)
So it seems to me that it failed to create whole group (with all necessary content). I was trying to wait (2-5 min ... when the group will appear on the web interface), after that I could easily create a plan.
How can I properly guess the time when a group will be created or which request should be sent to check that it has been created successfully?
You shouldn't "guess", instead use periodic polling.
After creating the group, try polling groups/{id}/drive in 2-5 minute intervals. Once the Drive is available the Group has been provisioned.

Error "Empty speech response"

I tried to connect DialogFlow and Actions on Google, so I created some intents, connected the services, added explicit and implicit invocations etc, but when I try the bot in the simulator https://console.actions.google.com/project/[projectId]/simulator/ it always gives me the error:
"Failed to parse Dialogflow response into AppResponse, exception
thrown with message: Empty speech response"
even tough inputType was "KEYBOARD".
What I tried so far:
I did set "Response from this tab will be sent to the Google Assistant integration" in Dialog Flow (do you have to set it for every single intent?), but I don't see any extra setting for speech.
I disabled the second language, first I had also intents in German
I also turned off the Fullfillment Webhook (implemented in API v1 and then also v2) with no change
I only found this user with the same problem https://productforums.google.com/forum/#!topic/dialogflow/xYjKlz31yW0;context-place=topicsearchin/dialogflow/Empty$20speech$20response but no resolution.
the fulfillment checkbox is checked at the intents
The bot works fine when I use it through "Try it now" on the very right in Dialog Flow or in the Web Demo https://bot.dialogflow.com/994dda8b-4849-4a8a-ab24-c0cd03b5f420
Unfortunately the docs don't say anything about this error. Any ideas?
Here a screenshot of the error on the Actions integration:
This is the full debug output:
{
"agentToAssistantDebug": {
"agentToAssistantJson": {
"message": "Failed to parse Dialogflow response into AppResponse, exception thrown with message: Empty speech response",
"apiResponse": {
"id": "c12e1389-e887-49d4-b399-a332188ca946",
"timestamp": "2018-01-27T03:55:30.931Z",
"lang": "en-us",
"result": {},
"status": {
"code": 200,
"errorType": "success"
},
"sessionId": "1517025330705"
}
}
},
"assistantToAgentDebug": {
"assistantToAgentJson": {
"user": {
"userId": "USER_ID",
"locale": "en-US",
"lastSeen": "2018-01-27T03:55:03Z"
},
"conversation": {
"conversationId": "1517025330705",
"type": "NEW"
},
"inputs": [
{
"intent": "actions.intent.MAIN",
"rawInputs": [
{
"inputType": "KEYBOARD",
"query": "Talk to Mica, the Hipster Cat Bot"
}
]
}
],
"surface": {
"capabilities": [
{
"name": "actions.capability.MEDIA_RESPONSE_AUDIO"
},
{
"name": "actions.capability.WEB_BROWSER"
},
{
"name": "actions.capability.AUDIO_OUTPUT"
},
{
"name": "actions.capability.SCREEN_OUTPUT"
}
]
},
"isInSandbox": true,
"availableSurfaces": [
{
"capabilities": [
{
"name": "actions.capability.AUDIO_OUTPUT"
},
{
"name": "actions.capability.SCREEN_OUTPUT"
}
]
}
]
},
"curlCommand": "curl -v 'https://api.api.ai/api/integrations/google?token=TOKEN' -H 'Content-Type: application/json;charset=UTF-8' -H 'Google-Actions-API-Version: 2' -H 'Authorization: AUTH_TOKEN' -A 'Mozilla/5.0 (compatible; Google-Cloud-Functions/2.1; +http://www.google.com/bot.html)' -X POST -d '{\"user\":{\"userId\":\"USER_ID\",\"locale\":\"en-US\",\"lastSeen\":\"2018-01-27T03:55:03Z\"},\"conversation\":{\"conversationId\":\"1517025330705\",\"type\":\"NEW\"},\"inputs\":[{\"intent\":\"actions.intent.MAIN\",\"rawInputs\":[{\"inputType\":\"KEYBOARD\",\"query\":\"Talk to Mica, the Hipster Cat Bot\"}]}],\"surface\":{\"capabilities\":[{\"name\":\"actions.capability.MEDIA_RESPONSE_AUDIO\"},{\"name\":\"actions.capability.WEB_BROWSER\"},{\"name\":\"actions.capability.AUDIO_OUTPUT\"},{\"name\":\"actions.capability.SCREEN_OUTPUT\"}]},\"isInSandbox\":true,\"availableSurfaces\":[{\"capabilities\":[{\"name\":\"actions.capability.AUDIO_OUTPUT\"},{\"name\":\"actions.capability.SCREEN_OUTPUT\"}]}]}'"
},
"sharedDebugInfo": [
{
"name": "ResponseValidation",
"subDebugEntry": [
{
"debugInfo": "API Version 2: Failed to parse JSON response string with 'INVALID_ARGUMENT' error: \": Cannot find field.\".",
"name": "UnparseableJsonResponse"
}
]
}
]
}
Also "debugInfo" sounds like an internal problem:
"API Version 2: Failed to parse JSON response string with
'INVALID_ARGUMENT' error: \": Cannot find field.\"."
Here a screenshot of the welcome intent:
ps.
It took me AGES to figure out, what
"Query pattern is missing for custom intent"
means - so I just document it here: In Dialog Flow - Intent - "User says" you have to DOUBLE CLICK on a word in the text input field when you want to set it as query parameter - which seems to be required for Actions on Google.
This happened to me. If this happens for an Intent you just added in the Dialogflow console and you are using Webhook fulfillment for the action, check the intent's fulfillment settings and ensure that the Webhook fulfillment slider is on. Evidently new intents don't automatically get webhook fulfillment: you have to opt each one in piecemeal (or at least, that was my experience).
I experienced this situation too.
My problem was that I used a SimpleResponse in my fulfillment index.js without referencing to it. So the solution for me was to add SimpleResponse like this in index.js:
const {dialogflow, SimpleResponse} = require('actions-on-google');
So, always check if you aren't using any dependencies without including it in your js-file.
Probably not the most common cause of the problem, but it can be.
I got this when running through the codelabs tutorial (https://codelabs.developers.google.com/codelabs/actions-1/index.html#4) and didn't name my intent the same name as it is referenced in the webhook script:
I came across this error when trying to develop my own WebHook. I first verified that my code was called by looking into the Nginx log, after which I knew there was a problem in my JSON output because I based my output on outdated examples.
The (up-to-date) documentation for both V1 and V2 of the API can be found here:
https://dialogflow.com/docs/fulfillment/how-it-works
This example response for v2 of the dialogflow webhook API helped me to resolve this error:
{
"payload": {
"google": {
"expectUserResponse": true,
"richResponse": {
"items": [
{
"simpleResponse": {
"textToSpeech": "this is a simple response"
}
}
]
}
}
}
}
Source: https://github.com/dialogflow/fulfillment-webhook-json/blob/master/responses/v2/ActionsOnGoogle/RichResponses/SimpleResponse.json
You can find more examples in the official github repository linked above.
Another possibility is if you have a text response (even an empty one) like so:
Then you need to click the trash can next to the response to clear it out to use the webhook.
The Actions on Google support helped me fix this problem:
I needed to add a text as Default Response to the intent used for Explicit Invocation.