Using Google APIv3 I wish to synchronize my PHP webapp calendar with Google Calendar by creating a notification channel using a webhook on my server. As per the documentation of Google I did the necessary preparations (defining and validating webhook, creating the notification channel) in order to receive status update information from the Calendar using the watch method.
My issue is that I cannot figure out what to do with the incoming information - as per my understanding and as stated in these docs, my webhook should be notified not only about the fact of change, but it should get the actual change as well so I can avoid unnecessary processing. Unfortunately, the know-how on receiving these notification are quite vague and I cannot find where to look for the nature of change made to the Calendar resource.
Am I missing something? Do I have to get the resource using the identifier returned to the webhook and "manually" check differences or there is some technique I can use to update (or even more preferred patch, but I also do not understand how to do that in PHP) the changed Calendar resource on my webapp side? Is PHP even a suitable language to implement this?
Related
I`m working on application which prviding clients to use calendar and creating some events there (I mean calendar in my app). Some of clients are have more than 1000 events in calendar and I want to start using Google Calendar . But I cant find any way to send multiple events in Google Calendar by 1 request.
Question: Is it possible to send few events in 1 request by using php-sdk, which google provides or by any other way such a http request?
Upd: I saw batch requests in google calendar docs, but Im not sure that its working now and how do I need to use it
Thanks!
The method you would be using is events.insert this method Creates an event as in singular there is no way to send a request that would send more than one.
You could use batching but all batching really is is sending X number of event.inserts in a single batch request. Its not going to save you on quota the quota cost will be the same the only thing it will save you on is on the number of HTTP calls you are making.
Global HTTP Batch Endpoints (www.googleapis.com/batch) will cease to work on August 12, 2020 as announced on the Google Developers blog. For instructions on transitioning services to use API-specific HTTP Batch Endpoints (www.googleapis.com/batch/api/version), refer to the blog post.
The above statment does not mean that batching doesnt work. It just means that the old batching endpoint which worled for every API no longer works now you need to send batching requests to each api
www.googleapis.com/batch/drive/v3
www.googleapis.com/batch/calendar/v3
you used to be able to send all batching requests no matter what api you were working with to
www.googleapis.com/batch
That no longer works.
I'm trying to work with the slack Event Subscription app_mention, but I'm having some issues.
My backend is PHP, and I'm using this class.
Basically, what's happening is, if I have my bot user in multiple channels and someone mentions the bot, it will only reply in a single channel.
For example;
I have the bot user in 2 channels
bot-testing
development
If I # mention the bot in the development channel, it will send it's reply in the bot-testing channel.
My code used to send the message:
$client->to('#' . $event['channel'])->send("Hi. I'm currently under development.");
and my $event variable looks like this:
{"type":"app_mention","text":"<#UFT4EG0Q7> test","user":"UAKTRFH41","ts":"1548783398.055200","channel":"GAMED4PK5","event_ts":"1548783398.055200"}
but decoded obviously.
Why is my bot not replying in the correct channel?
So based on my reading of the PHP client you're using, that's designed for use with Incoming Webhooks.
Incoming Webhooks have a 1:1 relationship with a conversation/channel, so you can't define the destination for your message in the payload you send to the API.
If you want to do that, you could try using one of the other PHP SDKs built by the community.
I need to push offline transactions to Google Analytics.
I am thinking of creating a php script that queries the ecommerce database looking at transactions made in the last hour created from the backend. Having identified these transactions (and line items/SKU's).
How do I use PHP to push data to Google Analytics?
You need to go though the measurement protocol. There is no client library to help you do this in PHP you will have to code it yourself. That being said its not that hard its just a normal HTTP Post or HTTP Get request. The trick is building up your requests correctly.
A couple of quick tips.
Qt stands for que time and will allow you to set the time that the hit arrived on your server. Note it must not be greater than four hours ago.
While you are testing this you can use the debug endpoint to validate your hits. The hits wont be sent to Google but it will tell you if they are valid or not.
Measurement Protocols as #DaImTo mentioned is the answer. make a try here replacing the UA Id -
https://ga-dev-tools.appspot.com/hit-builder/?v=1&tid=UA-XXXXX-Y&cid=555&t=transaction&ti=12345&ta=westernWear&tr=50.00&ts=32.00&tt=12.00&cu=EUR
You can use DIv tool to validate all your post requests.
(dont forget to enable - ecommerce from view settings in GA when testing on new account)
I am interested in writing some basic php to interface with the Poloniex push api.
Their website provides the following info:
https://poloniex.com/support/api/
A php wrapper can be found here:
http://pastebin.com/iuezwGRZ
From what i can determine there are three APIs being push, public and trading. The public and trading APIs provide functions that can be passed parameters etc. The push api stumps me totally as i cannot determine how it works.
The first link above states the API pushes live data and different feeds can be subscribed to.
My questions are:
A) How can php receive a live stream of data?
B) How do i subscribe to a feed?
I may have misunderstood the oush api and my apologies in advance if this is the case.
Edit1:
I believe i need a WAMP client to connect to a WAMP router such as Minion.
https://github.com/Vinelab/minion
Edit2:
Node.js example
http://pastebin.com/dMX7mZE0
The push API is based on Websocket protocol.
Initially you need first to make a connection to the websocket server,
after that you need to register to a data stream (price update stream for example), after that as soon as the server make an update to something (a price ), all connected clients who where previously registred to it will synchronously received the updated price
Finally you got the last price without the need of doublecheck at regular interval if the price has changed
I am integrating the Twitch user account API into my platform and had a look through the API to see if there was a callback section of some sort to send an update to my server when a user starts streaming, but I can't seem to find any reference for one.
Is there currently any services that offer this sort of thing? If not, what would be the best way of running regular checks on all of my users in my Database to see when they are streaming, of course doing this alone would kill the server with database queries, so I'm stuck as to where to go now.
What I am looking to do is receive a callback and then create a post in a social feed that the user has started streaming.
Based on the discussions at the links below, the API doesn't support webhooks and won't anytime soon. Instead, they expect you to use polling. Basically you would set up a worker process that makes requests periodically, such as every five minutes, then creates appropriate social feed posts, etc. You can batch them together if you have a bunch of channels to check (exaple from from the github issue):
https://api.twitch.tv/kraken/streams?channel=riotgames,dota2ti,machinima,esltv_hearthstone
https://github.com/justintv/Twitch-API/issues/211
https://discuss.dev.twitch.tv/t/notifications-using-twitch-api-and-php/1009