My Firebase database is structured to successfully save data from HTTP POST requests, as confirmed by sending test requests directly from my Angular development app:
CreatePost(){
let body = {
"host_id" : 1,
"uuid" : 1,
"id" : 1,
"status" : "ENDED"
}
this.http.post( this.url, body )
Firebase database update result:
-zoom
-L1dZbBWMTIr7ojjodzg
host_id: 1
id: 1
status: "ENDED"
uuid: 1
However, with the same database URL used as WebHook endpoint for a 3rd party service (Zoom conferencing), the database is not updating in response to WebHook triggering events, such as starting a meeting.
The Zoom WebHook POST is being sent correctly, as confirmed by a test to RequestBin:
FORM/POST PARAMETERS
host_id: w_1a9RDvTKqiG_BBdV7kuw
status: STARTED
id: 3544245503
uuid: oJ+nrTm7Rwq1NYlpML7W/Q==
Raw Body:
id=3544245503&uuid=X%2F1R2AC1QS%2Btjuhxc0Kt%2Bw%3D%3D&
host_id=w_1a9RDvTKqiG_BBdV7kuw&status=STARTED
Has anyone had experience with using Firebase for their WebHook endpoint? Does the WebHook POST need to be configured in a particular way for Firebase?
To POST (or PUT) data to the Firebase Database in a REST request, the body of your request must contain the JSON object to be written. From the Firebase documentation:
curl -X POST -d '{
"author": "alanisawesome",
"title": "The Turing Machine"
}' 'https://docs-examples.firebaseio.com/rest/saving-data/fireblog/posts.json'
Your code is posting the form fields in the body as url-encoded, which is simply a different format. See this answer for a comparison of the same data in both formats: https://stackoverflow.com/a/9880122.
If Zoom doesn't have support for posting the form fields as JSON, you could consider creating a Cloud Function to do the conversion.
Related
I created an app on Azure and want to use it to subscribe to business emails of certain users. However, I cannot get it to work and I'm wondering if it is even possible this way. The code is as follows:
url = 'https://graph.microsoft.com/beta/subscriptions'
payload = {
'changeType': 'updated',
'notificationUrl': 'http://<server_ip>/webhook',
'resource': "users/<my_user>#<my_domain>/mailFolders('inbox')/messages",
'expirationDateTime': '2022-07-23T11:52:20',
}
headers = {
'Authorization': f'Bearer {access_token}',
'Content-Type': 'application/json'
}
response = requests.post(url, headers=headers, data=json.dumps(payload))
print(response.status_code)
print(response.reason)
print(response.text)
400
Bad Request
{"error":{"code":"InvalidRequest","message":"Could not process subscription creation
payload. Are all property names spelled and camelCased properly? Also are the
dateTimeOffest properties in a valid internet Date and Time format?","innerError":
{"date":"2022-07-22T09:12:11","request-id":"317989f4-c921-44ce-a701-
c57a660aad3b","client-request-id":"317989f4-c921-44ce-a701-c57a660aad3b"}}}
I also want to subsribe to changes to our drive, for this I substitute the resource for f'drives/{drive_id}/root'. This gives the same error messsage.
I have read all the relevant docs and feel this this should be the correct approach, but the error message is not useful to me for find the issue.
I am following this sample (https://developer.paypal.com/docs/checkout/reference/server-integration/set-up-transaction/#on-the-server) to get PayPal working on the server.
I have finished creating the order, but it doesn't capture the order at the same time. Is it possible to create and capture the order at the same time?
var request = new OrdersCreateRequest();
request.Prefer("return=representation");
request.RequestBody(BuildRequestBody());
var response = await PayPalClient.client().Execute(request); //this will only create the order. How to capture it at the same time?
When I tried to capture the order:
//continue from above
var result = response.Result<Order>();
var requestCapture = new OrdersCaptureRequest(result.Id);
requestCapture.Prefer("return=representation");
requestCapture.RequestBody(new OrderActionRequest());
response = await PayPalClient.Client().Execute(requestCapture);
I get the error:
"name":"UNPROCESSABLE_ENTITY",
"details": [{
"issue":"ORDER_NOT_APPROVED",
"description":"Payer has not yet approved the Order for payment. Please redirect the payer to the 'rel':'approve' url returned as part of the HATEOAS links within the Create Order call or provide a valid payment_source in the request."
}],
"message": "The requested action could not be performed, semantically incorrect, or failed business validation.",
"links": [{
"href": "https://developer.paypal.com/docs/api/orders/v2/#error-ORDER_NOT_APPROVED",
"rel": "information_link",
"method": "GET"
}]
My question is, is it possible to create order, authorize and capture at the same time?
Thanks
Before using OrdersCaptureRequest, you have to redirect to [rel] => approve link from the response of OrdersCreateRequest:
$client = PayPalClient::client();
$response = $client->execute($request);
$res_links = $response->result->links;
$approve_index = array_search('approve',array_column($res_links,'rel'));
redirect($res_links[$approve_index]->href,'location',302);`
And then use OrdersCaptureRequest.
I don't think there's a way to create, authorize and capture order at the same time in PayPal, even in sandbox environment. You'll have to follow each step separately.
And about the ORDER_NOT_APPROVED error, you can either get the order approved by the user as #raj-kamal said, or you can make a Paypal-Auth-Assertion and send it in the headers. This header is an API client-provided JSON Web Token (JWT) assertion that identifies the merchant.
Reference: https://developer.paypal.com/docs/api/reference/api-requests/#paypal-auth-assertion
NOTE:
To use this header, you must get consent to act on behalf of a merchant.
I am trying to send over a Post request to sendgrid to generate an API key for a subuser.
This is what my code currently looks like
body = JSON.parse('{
"name":"My API Key",
"scopes": [
"mail.send",
"alerts.create",
"alerts.read"
]
}')
header = {'On-Behalf-Of' => 'my#email.com'}
sg = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY'])
response = sg.client.api_keys.post(request_body: body, request_header: header)
This code generates the API but on the main account instead of the Subuser account. The header is what drives where the API key is generated and I can seem to find any sources online that how the correct syntax for sending over the header to sendgrid.
If you could please help I would really appreciate it. Thanks!
I recently had to do this. You need to set the On-Behalf-Of headers when you instantiate the client not when you make the request:
```
#send_grid = API.new(api_key: #api_key, request_headers: {
'On-Behalf-Of' => #username
})
```
Then when you make a request with #send_grid it will send on behalf of the subuser -- and the API key will not show up in the list of api keys on the parent account
If I understand correct, you want to send email "From" another user. On Behalf of is non standard way of doing things.
For eg. https://sendgrid.com/docs/Classroom/Troubleshooting/Authentication/my_emails_are_displaying_as_on_behalf_of_or_via_in_some_mail_clients.html
You may want to try setting from instead of on-behalf-of
"from": {
"email": "from_address#example.com"
},
Refer to: https://sendgrid.com/docs/API_Reference/Web_API_v3/Mail/index.html
I'm using the google gmail api in swift. All is working well, it's compiling etc.
I'm now trying forward an email, the only way I see this possible so far is by using a thread id.
So I'm using the API tester found here to send tests. Will will focus on this. It can be found here1
So I've input this, the "raw" is Base64 URL encoded string.
{
"raw": "VG86ICBlbWFpbFRvU2VuZFRvQGdtYWlsLmNvbSAKU3ViamVjdDogIFRoZSBzdWJqZWN0IHRlc3QKSW4tUmVwbHktVG86ICBteUVtYWlsQGdtYWlsLmNvbQpUaHJlYWRJZDogIDE1YjkwYWU2MzczNDQ0MTIKClNvbWUgQ29vbCB0aGluZyBpIHdhbnQgdG8gcmVwbHkgdG8geW91ciBjb252by4u",
"threadId": "15b90ae637344412"
}
The "raw" in plain text is
To: emailToSendTo#gmail.com
Subject: The subject test
In-Reply-To: myEmail#gmail.com
ThreadId: 15b90ae637344412
Some Cool thing i want to reply to your convo..
when I execute it I get this back
{
"id": "15b944f6540396df",
"threadId": "15b90ae637344412",
"labelIds": [
"SENT"
]
}
But when I check both email account, from and to. None of them say the previous messages but are in the same "thread" or convo.
If anyone can help it would be much appreciated I've spent all day on this issue and half of yesterday and did TONS of research on it.
as stated here I should I'm adding the threaded and In-Reply-To in the right way I believe
The ID of the thread the message belongs to. To add a message or draft to a thread, the following criteria must be met:
The requested threadId must be specified on the Message or Draft.Message you supply with your request.
The References and In-Reply-To headers must be set in compliance with the RFC 2822 standard.
The Subject headers must match.
I am developing an iOS application for a store on BigCommerce.com . I have successfully retrieved the products list from the BigCommerce API and I have also created a new user using the same.
Create User: https://developer.bigcommerce.com/api/stores/v2/customers#create-a-customer
Product List:
https://developer.bigcommerce.com/api/stores/v2/products
But i am unable to understand that how should i login into the BigCommerce Store as a customer to purchase products listed.
Please can anyone help.
You can login by sending a POST to:
/remote.php?w=expressCheckoutLogin
Send fields 'login_email' and 'login_pass' in your POST's body.
Its very hard to finding login api in bigCommerce. this solution is 100% working and tested.
Keep Enjoy
APi URL : https://api.bigcommerce.com/stores/[STORE_HASH]/v2/customers/[CUSTOMER_ID]/validate
Method : POST
Header
X-Auth-Client : Client_id
X-Auth-Token : Access Token
Accept : application/json
Content-Type : application/json
Body
{
"password": "123456"
}
Response
{
"success": true
}