'Create Firebase dynamic link inside onCreate of firestore using Firebase Cloud functions

I was wondering to create a dynamic short link when the item is created on firestore. I want to create a dynamic link when onCreate method of firestore cloud function has been called. How can we call the REST api inside onCreate of firestore cloud functions?

https://firebase.google.com/docs/dynamic-links/rest

Overall goal is when ShortLink created then update a field in the firestore. I want to generate dynamic link on server side.

PS- I already integrated creation of dynamic link on Client side, but it takes little time.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source