Functions

Documentation

Functions

Functions are single methods written in any programming language that are fully managed serverless functions.

Create

Creating your own functions is intuitive and powerful. Choose Storyscript for workflow and procedural functions. Choose another language for low and high-level logic and algorithms.

Storyscript Functions

Storyscript functions are useful for common procedures that you want to reuse in your application or share between other applications by submitting Storyscript functions to the Asyncy Hub.

Create your first Storyscript function

function spam_me text:string
    twitter tweet status:'@me {text}'
    twilio sms text:text to:'+310601010101'
    gmail send to:'me@gmail.com' subject:'Read me' body:text

Now, we can call our function like this:

spam_me('doorbell rang!')

GPPL Functions

Coming soon

Looking forward to this feature? Click here to share your feedback.

Creating a function in a GPPL (like Python, Node, Go, Ruby, etc.) is very simple in Asyncy. These functions, like Storyscript functions, can be used anywhere in your Storyscript and shared to other applications when submitted to the Asyncy Hub.

Creating your first function

Let's use Python for this very simple example.

def main(principle: float, time: int, rate: float):
    return (principle * time * rate) / 100

🐍 Sssssweeet! We have a function, we called it main (common Python practice) and saved it to calc_interest.py in the root of your git repository.

Now, let's add it to our repository of functions in your asyncy.yml manifest.

functions:
    interest: ./calc_interest_rate.py
#   ^^ function name followed by it's location in your git repository

👍 Let's call our shinny new function in Storyscript.

result = interest(principle:4000, time:120, rate:.03)

Nice work! You just created a serverless function and called it in our Storyscript. 👏

Discover

Much like a traditional library of software, the Asyncy Hub is your registry of services and functions to share between applications and developers.

Using functions

Sharing and reusing functions is also easy. Discover functions in the Asyncy Hub and follow the directions in the Hub to use public or your private collection of functions cross application.

Submitting functions

Head over to Asyncy Hub to publish your functions privately or publicly.

Deploy

Zero-devops deployments with Asyncy.

Asyncy abstracts away the unnecessary complexities in orchestrating, communicating and managing functions, including:

  1. Deployment
  2. Version management
  3. AB Testing
  4. Scaling
  5. Monitoring
  6. Health Checks
  7. Protocols
  8. Error handling
  9. Retry-logic
  10. Fail-over

✨🍰✨ All the above are no longer the responsibility of the developer.

Simply deploy your Storyscript application and Asyncy takes care of the rest.

Time to write your story.