I want send multiple notifications with one HTTP request to Firebase using REST API
Documentation says - "You should combine requests and send"
https://firebase.google.com/docs/cloud-messaging/send-message#send-messages-to-multiple-devices
curl command for send is
curl *** -H 'Content-Type: multipart/mixed; boundary="subrequest_boundary"' https://fcm.googleapis.com/batch
I found that https://fcm.googleapis.com/batch url is no longer supported https://developers.googleblog.com/2018/03/discontinuing-support-for-json-rpc-and.html
What right url for send multiple notifications to FCM?
There is a new API for sending messages through Firebase Cloud Messaging, called the versioned API. It lives on /v1/projects/<your-project-id>/messages:send and is fully documented in the Firebase documentation on sending requests.
In this new, versioned API sending multiple messages through the regular end point by sending a multi-part request to it. This process is fully documented in the section on sending a batch of messages and is also wrapped by most of the Admin SDKs that are available.
Related
Is it possible to use a private video link from a cloud provider storage or from Slack (using user token) and upload them to cloudflare steam the same as this sample public link?
Based on Cloudflare documentation, (but this is for a public link)
If you have videos stored in a cloud storage bucket, you can simply pass a HTTP link for the file. Stream will fetch the file and make it available for streaming.
By using webhooks you can receive a notification when the video is ready to be played or if it errors.
Step 1: Make an API call with the link
Make a HTTP request to the Stream API with the URL of the video.
curl -X POST -d '{"url":"https://storage.googleapis.com/zaid-test/Watermarks%20Demo/cf-ad-original.mp4","meta":{"name":"My First Stream Video"}}'
\ -H "Authorization: Bearer <API_TOKEN>"
\ https://api.cloudflare.com/client/v4/accounts/<ACCOUNT_ID>/stream/copy
Ah, seems public is the only way.
Here it said the server must be publicly routable and support HTTP HEAD requests and HTTP GET range requests. The server should respond to HTTP HEAD requests with a content-range header that includes the size of the file.
"https://example.com/myvideo.mp4"
Cloudflare API only accepts a URL for source, and there is no way as far as I see in the linked documentation to send token and access a private file.
Solution is to have a server you own, download from source and upload it to Cloudflare using their file upload API which reads from local directory.
So the answer is no, you can not directly download from a private server and upload to cloudflare. :/
I am trying to test Amazon Connect Rest API in Postman. The API name is GetMetricData. In Postman, I have provided all the required information that is mentioned in the documentation. I have provided the JSON body, URL, and Header, although API is responding 200 OK status but in the response, it is throwing the following errors that you can see in the following screenshots.
I have set AWS signature with proper credentials such as access key and secret key
In the second error it is suggesting me to enable Javascript in the browser which is already enabled in my browser.
Can someone please help me here, I don't know where I am doing wrong. As I am totally new in this field, any help would be appreciated.
Thanks
You are submitting the POST request to the UI distribution endpoint for your Amazon Connect instance, not an API endpoint. You are getting HTML and javascript response body back from the UI distribution because this is meant to be consumed by a browser.
Your API request should be sent to a URL that looks like https://connect.us-west-2.amazonaws.com/metrics/historical/<instanceId>. In this example, my Amazon Connect instance is located in the us-west-2 region so I'm using the connect.us-west-2.amazonaws.com endpoint. You can find all available Amazon Connect API endpoints in the documentation here
I have an endpoint on API Gateway that I want to make it work with requests from Strip.com only. I have tried adding stripe.com on Access-Contril-Allo-Origin* as it shown below but does not seem to be working at all.
How do I set CORS on API Gateway?
CORS only applies to requests made from a browser. It doesn't apply if you're trying to protect, for example, a webhook URL that you want Stripe to send data to. The typical approaches here are either to include a shared secret in your webhook URL, or to configure a username & password, both of which Stripe support. Examples:
https://yourdomain.com/admin/webhook/6f637faa33a2116f410cfb12af2028a85d22fcf5
https://user:pass#yourdomain.com/admin/webhook/
The other protection here is that you can verify any event received by sending an API request to Stripe to retrieve that event:
https://stripe.com/docs/webhooks#verifying-events
I think you need to have the schema on the header, like, https://stripe.com as Access-Control-Allow-Origin
I am developing an application server to send GCM messages. My application server is sending post requests to GCM connection servers with HTTP protocol. The average response time of a request is acceptable (around 100 milliseconds), but sometimes I'm getting responses with times greater than 1 second. More occasionally I've got some response times of 2, 4 seconds or even more.
I'm using this library gcm-server to send my requests to GCM servers. I believe it's owned by Google.
In order to despite the problem, I've made some analysis in the gcm-server library code but can't found any clue or answer. Ultimately, I decide to send some curl's with valid posts to GCM server. The results are the same. I'm sure this is not the expected behavior, maybe I'm doing something wrong, but can't find or understand what it is.
Below is the script I'm running to test this. I'm sending 1000 post requests to GCM, without any definition of Keep-Alive (by default cURL uses Keep-Alive enabled).
#!/bin/bash
for i in {1..1000}; do
curl -s -w "%{http_code} - %{time_total}\n" -o /dev/null -X POST -H "Content-Type: application/json" -H "Authorization: key={putHereOneGCMValidToken}}" -H "Cache-Control: no-cache" -d '{
"collapse_key": "92667ba1-c8e9-4018-bf14-156417065641",
"delay_while_idle": false,
"data": {
"field1": "value1",
"field2": "value2"
},
"time_to_live": 0,
"registration_ids": [
"REGISTRATION_ID_1",
"REGISTRATION_ID_2",
"BAD_REGISTRATION_ID"
]
}' "https://gcm-http.googleapis.com/gcm/send";
sleep 0.2;
done
Reference:
GCM http server documentation
You are queuing your server with too many Downstream Messaging. Try sending with a lower test numbers. If you are testing or sending to multiple devices or users try Device Group Messaging or Send Messages to Topics.
Device Group Messaging
With device group messaging, app servers can send a single message to multiple instances of an app running on devices belonging to a group.
Send Messages to Topics
GCM topic messaging allows your app server to send a message to multiple devices that have opted in to a particular topic.
Also, you must consider external factor like intermittent internet connection for the delay of receiving the message. Lastly you might want to check this related SO question that experience High Server CPU after sending GCM.
Hope this helps!
I'm using a SaaS for my AWS instance monitoring and Mandrill for email sending/campaigns.
I had created a simple chart with Zapier but I'd rather like to host it myself. So my question is:
How can I receive a webhook signal from Mandrill and then send it to Datadog from my server? Then again I guess hosting this script right on the same server I'm monitoring would be a terrible idea...
Basically I don't know how to "receive the webhook" so I can report it back to my Datadog service agent so it gets updated on their website.
I get how to actually report the data to Datadog as explained here http://docs.datadoghq.com/api/ but I just don't have a clue how to host a listener for web hooks?
Programming language isn't important, I don't have a preference for that case.
Here you can find how to add a new webhook to your mandrill account: https://mandrillapp.com/api/docs/webhooks.php.html#method=add
tha main thing here is this:
$url = 'http://example/webhook-url';
this is your webhook URL what will process the data sent by mandrill and forward the information to Datadog.
and this is a description about what mandrill will send to your webhook URL: http://help.mandrill.com/entries/21738186-Introduction-to-Webhooks
a listener for webhooks is nothing else then a website/app which triggers an action if a request comes in. Usually you keep it secret or secure it with (http basic) authentication. E.g. create a website called http://yourdomain.com/hooklistener.php. You can then call it with HTTP POST or GET and pass some data like hooklistener.php?event=triggerDataDog or with POST and send data along with the body. You then run a script or anything you want to process that event.
A "listener" is just any URL that you host where you can receive data that is posted to it. Keep in mind, since you mentioned Zapier, you can set up a trigger that receives the webhook data - in this case the listener URL is provided by Zapier, and you can then send that data into any application (or even post to another webhook). Using Zapier is nice because it doesn't require you to write the listener code that receives the hook data and does something with it.