Send HTTP POST request to Segment.io from GCP - google-cloud-platform

I am trying to send HTTPS Post Request from GCP to Segment.io
I want to create a service that will read data from BigQuery table and then send calls directly to Segment.io API (link) from where I'll redirect the data to other destinations, but on the GCP site I'm struggling to find the most optimal way to do it. Cloud Run seems like a good option but I'm wondering if there might be an easier way?

The recommended products to be used for this task can be either Cloud Run or Cloud Functions.
You can either use the Client Libraries or API in order to extract the data from the BigQuery table and use any HTTP request library of your favorite programming language to issue the POST request to the Segment.io API.

Related

How to use the TranscribeStreamingClient in the browser with credentials

I want to be able to offer a RT transcription in my browser app using AWS transcribe. I see there is the TranscribeStreamingClient which can have credentials for AWS which are optional - I assume these credentials are required for access to the s3 bucket?
What I want to know is how to setup auth in my app so that I can make sure my users dont go overboard with the amount of minutes they transcribed?
For example:
I would be expecting to generate a pre-signed url that expires in X seconds/minutes on my Backend that I can pass to the web client which it then uses to handle the rest of the communication (similar like S3).
However I don't see such an option and the only solution that I keep circling back to is that I would need to be feeding the audio packets from to my backend which then handles all the auth and just forwards it to the service via the streaming client there. This would be okay but the documentation says that the TranscribeStreamingClient should be compatible for browser integrations. What am I missing?

Get sales orders from Amazon MWS scratchpad via API

My mission is to get Amazon sales orders out for a given time period and post these into a SAP ECC back end via SAP PI. I've managed to get the MWS scratchpad working and am a bit stuck as to how i would put the data from the scratch pad into postman or SOAPUI.
I don't know the endpoint for Amazon MWS to find the API or WSDL structure - where to send the call. How can I find out?
how do i know what information to pass into what areas of the SOAPUI or postman tools?
How do i get the WSDL for the MWS response call so i can export it and import that structure into sap to save me building a massive response structure?
This is my mws scratchpad:
Everything you need is right here: Orders API
It tells you your endpoint, your operations, and your request and response parameters. What language do you use? If you use PHP, C#, or Java, there are client libraries that do all this for you, just plug in your account info.
For the ListOrders operation specifically, it's right here - ListOrders.
The response format is explained here.
You also need to calculate a signature, something that scratchpad and the MWS client libraries will do for you. Not sure how you can do that from Postman.
thanks for your assistance again . The scratchapd works a dream. Yes, i am not sure how postman will do this either. I am calling from SAP PI, presumably some code will have to be written in java to handle the calculation of the signature and timestamp - i get the current error when posting in postman:

Amazon sns : Create platform end point through HTTP calls

I am trying to implement push notifications for mobile application using AWS SNS.
Our application does not support any of the methods(node js, python etc) mentioned in AWS website to access AWS SDK. So I need to call Amazon SNS api with HTTP calls directly instead of other methods.
Is there any way to do it?
Thank you
Of course, the HTTP API is well documented. I use the HTTP API to send notifications. Getting the HTTP headers just right can be a bit frustrating at first, but the responses from the endpoint often give you pretty good hints. Sadly there aren't a lot of easy to follow code examples so it might take some time to get it just right.
Here's a link to the API:
http://docs.aws.amazon.com/sns/latest/api/Welcome.html
Some good info here:
http://docs.aws.amazon.com/sns/latest/api/CommonParameters.html
How to sign an HTTP API request:
http://docs.aws.amazon.com/general/latest/gr/signature-version-4.html

FireBase connect to server (Not NodeJS)

So I've seen this answer Using NodeJs with Firebase - Security that talks about syncing NodeJS with the Firebase data structure.
I don't use NodeJS (being a Railo/Coldfusion developer) and was wondering if something like this is possible outside of NodeJS? Through java or maybe just using REST endpoints. Or do I have to use the original solution in the above link of separately updating the data in my webserver.
Another way of wording it is; can I make a round trip from firebase to an HTTP server that isn't nodeJS?
EDIT: To clarify, exactly what I wanted to do was have a email webservice post to the REST API of Firebase, then firebase post that to an URL on my external railo server as my users need to know when the email arrives but the server just needs to make sure it stores it.
As I understand it my best bet is to get the email webservice to post to the URL on my railo server which then posts to the REST API on firebase.
Yes you can.
Firebase does not have a Coldfusion client library, so you need to use the REST APIs. You can use the REST API to read / write Firebase data from your server code.
The one thing you'll be missing is the notifications when data changes. With the node.js client, you can subscribe for updates to data but there's no way to do that from a REST API.
So if you need to know when Firebase data changes, and you're using REST, you'll have to poll the data periodically.
(Note: This is mostly copied #Michael's answer in the comments)

Salesforce: SOAP Login from Salesforce TO Salesforce

I implemented a batch job which makes a webservice call within the same salesforce instance, which then is supposed to send emails with a pdf attachment,
since you cannot send pdf attachments directly from a batch job. My webservice call looks like this:
public static void callOut(List ids){
InvoiceAttachmentConnector.InvoiceAttachmentService ws = new InvoiceAttachmentConnector.InvoiceAttachmentService();
ws.SessionHeader = new InvoiceAttachmentConnector.SessionHeader_element();
ws.SessionHeader.sessionId = UserInfo.getSessionId();
ws.handleInvoicePdfAttachment(ids);
}
However in batch jobs UserInfo.getSessionId() returns null, therefore i get a INVALID_SESSION_ID exception.
How can i log in to get a SessionId? So far I found no solution to login from salesforce to salesforce. If u can help I would appreciate it! Thanks!
You cannot get a session Id like this in batch apex as it runs under the system context and so has no specific user info for retrieval.
UPDATE:
You have the following options:
Try running the web services wsdl from your Salesforce org through the wsdl to apex generator in your org to generate some classes that may allow you to login. You are only allowed one web service request per execute call.
You could create a sites page that you make a HTTP get request to in your batch apex. This needs to retrieve the Ids of the items you want to send the PDFs for and a particular user to run as for you to use the System.runAs(user) method. You could pass these parameters in the HTTPRequest header or in a custom setting.
Note that neither of these solutions are ideal, you may want to reconsider why you are using Batch apex first of all and see whether you could reimplement it in a different way.