Developers' Blog

Automation 101: Part 1 — What are my options?

post-thumb

So, you want to build a business process or a slick user experience in Skedulo, and you know you need automation to achieve this. You’re probably asking yourself, what are my options when it comes to automation on the Skedulo Pulse Platform?

Well, you’ve come to the right place. That is exactly the question I intend to answer in this post! Skedulo provides you with three options when it comes to automation: webhooks, triggered actions, and connected functions.

Each of these target different use cases, and some can be used together to achieve your desired result, or used for other purposes such as integration. (Stay tuned for our series on integration!)

Let’s take a quick look at each of them now, and then in the next posts in the series, we’ll cover each in more detail.

Webhooks

Webhooks are the simplest method of automation. They allow you to make a callout when a record changes, or when Skedulo receives a SMS.

This callout can either be to a Connected Function (more on these soon!) or to an external service. You can choose which record changes to listen for, and what record data is sent to the callout endpoint.

To create a webhook, we make a request to the webhooks API with a webhook definition. This definition contains the following items:

  • The type of webhook, either ‘graphql’ (for record changes) or ‘inbound_sms’

  • The URL to make a callout to (e.g, your connected function or external service)

  • For record change webhooks: – A GraphQL query – Optionally, for record change webhooks you can also choose if they run on INSERT, UPDATE or DELETE.

For record change webhooks, we use the GraphQL query to define what is listened for (e.g the JobStatus field changed to ‘Dispatched’) as well as the fields to be sent to the callout URL (e.g, UID, Status, StartDate, etc).

For inbound SMS webhooks, Skedulo will send the content of the message, the from and to phone numbers, and the date and time it happened to the specified callout URL.

Skedulo also supports the concept of deferred and scheduled webhooks, which means that we can run a webhook after a given time, or by using a cron expression.

A deferred webhook can be run either at a static interval, for example 10s after a record has changed, or it can be offset from a field on the object it is triggered from.

We will cover webhooks in detail in the next post in this series, but for now you can check out the documentation here.

Triggered Actions

Next up is triggered actions. These are a lot like webhooks but they have some unique benefits (and limitations).

A triggered action can listen for record changes in much the same way that webhook can, although the definition is a little different, and it will send these record changes off to either a connected function or an external web service.

Due to the way triggered actions work, they can retrieve data from Skedulo after the trigger (for example a record changing) has been fired, which may be beneficial in certain use cases.

Unlike webhooks, triggered actions do not have the ability to be scheduled or deferred.

However, triggered actions have the ability to send SMS messages based on a record change. Rather than the ‘call_url’ action, which behaves in the same way as a webhook, we can use the ‘send_sms’ action. For example, we could use this to notify a customer that their Job has been dispatched and someone is on their way.

We’ll be covering triggered actions in detail in a future post, along with when to use them in comparison with webhooks. If you can’t wait, you can check out the developer documentation here.

Connected Functions

Finally, this brings us to connected functions. These are serverless functions that you can write to provide custom APIs within your Skedulo tenant. These APIs can be used to build automations in conjunction with webhooks and triggered actions, build backends for web extensions, or as part of an integration with other systems.

While webhooks and triggered actions contain very little logic, a connected function can contain as much or as little logic as needed to get the job done.

For example, you could build a connected function that is triggered from a webhook or triggered action in order to update another record in Skedulo, send a message to a user or customer, or push data into an external system.

These functions are written in TypeScript and are deployed to Skedulo by using the Skedulo SDK. Connected functions are very powerful and will be covered in more detail in a future post in this series.

In the meantime, you can take a look at the documentation on connected functions.

Conclusion

Now that you’ve got an idea of what your options are when it comes to automation on the Skedulo Pulse platform, stay tuned for the rest of the series, starting with part two where we will be taking a deeper look into webhooks!

As always, we’d love to hear about what you’re building so please reach out to us on Twitter @SkeduloDevs or LinkedIn!

References

comments powered by Disqus