Skip to content

Instantly share code, notes, and snippets.

@gje4
Created September 15, 2022 01:05
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gje4/99f79dbc3c75d781f0b0315ed92daea3 to your computer and use it in GitHub Desktop.
Save gje4/99f79dbc3c75d781f0b0315ed92daea3 to your computer and use it in GitHub Desktop.
<script>
// Fetch Order Data
fetch('/api/storefront/order/{{checkout.order.id}}', {
credentials: 'include'
}).then(function (response) {
return response.json();
}).then(function (orderData) {
const orderDate = Date.now();
const requestOptions = {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ customerName: orderData.billingAddress.firstName + ' ' + orderData.billingAddress.lastName ,
mobileNumber: orderData.billingAddress.phone,
orderNumber: orderData.orderId,
orderDate: orderDate })
};
fetch('https://www.workato.com/webhooks/rest/9691b9f9-9c12-42d8-8380-afaabcd7dd2c/mckessonsms', requestOptions)
.then(response => response.json())
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment