• Log in
  • Sign up
  • Contact Us

Get in touch  

Introducing Flows

Create and Extend your own custom data

Create a store

In this episode, Jonathan and Jamie discuss how you can use Moltin Flows to extend your commerce experience.

Jamie: I'm Jamie, Developer Advocate here at Moltin.

Jonathan: Hi, I'm Jonathan, one of the Frontend Engineers here.

Jamie: This week we're gonna be discussing how you can use Flows. Flows is basically just custom data that allows you to extend all of the endpoints and APIs that we have at Moltin to do whatever you like. We'll go into that in a bit more detail about the possibilities, but just, what kind of things can you say now do you think … what comes to mind when you think of Flows, because Flows is one of those topics I think where you mention it to someone and although there are a lot of customers who have Flows today on their plan and they use Flows. It really is powerful, but when you're just kind of looking at the pricing page and you're thinking, "Hmm, should I add Flows?" It's like well-

Jonathan: What is the value?

Jamie: Yeah, what's the value? What can I do? So hopefully in this video we can go over some of the content on the website, the API reference, the documentation, and most importantly some  examples and how you can kind of get up and running in the dashboard that you created?

Jonathan: What's really interesting about Flows is not only does it allow you to extend the existing Moltin schemas, so for example the products, brands, categories, but you can also create your own completely custom schema. For example, if you wanted to build wishlist functionality or related products functionality, you can use Flows to do that. Even a blog. If you want to run a blog through Moltin for whatever reason, that's possible.

Jonathan: What I would say the most common use case is, is people extending their product's object, so adding fields onto a product, whether that be a basic string field. It might be a key value pairing of a material type for a couch for example. Or you might want to store a custom date field on there. So those kind of things.

Jonathan: It's the really basic to the really advanced. I mean you can actually kind of add relationships between objects, that kind of thing. It's really interesting.

Jamie: The one thing that stands out to me here, it says one to one link between resources, so you can make a direct link between products in a custom flow. You could have a wishlist almost. While we don't provide an endpoint for managing wishlists, wishlists are part of the eCommerce experience. People like to add things to a list like they can favorite for later, and with Flows you can associate that product resource, which is the native resource, with this custom resource, and you kind of get that for free with Flows itself. All that configuration is kind of taken care of, and all the business logic, we handle all of that.

Jamie: I really like the relationship side of it. It's massively powerful.

Jonathan: I'm pretty sure there's an example of that, right? The wishlist stuff?

Jamie: Yeah, there is, yeah.

Jonathan: It kind of walks you through how to build the Flows, how to build the fields, how to connect the resources. That's interesting. Check that out. We'll put the link in the notes.

Jamie: Yeah, I think that was made by one of the engineers. Andrew Waters created that.

Jonathan: Shout out.

Jamie: Shout out to Andrew Waters if you're watching. Give us a thumbs up. He created that example because he had seen this kind of request come in time and time again. How do I create wishlists? How do I create this kind of-

Jonathan: Rate a product.

Jamie: Rate a product, like a product, that kind of thing. It's a great example because it covers such a wide range of the API. Just scrolling down on the website, we've got this concept of creating Flows. A flow creating, that's just really creating a new resource. If you think about in a sense of custom data or even tables in a database, you can create a custom table, and then inside of there you can have things like the different columns for the data, then when you insert records again, that's just creating data, creating fields, creating entries.

Jamie: Then we've got extending the data, and I think we've kind of covered that, but ... You mentioned the extended things. On the website here we've got for the size and fit of the products. You can kind of add a bit more.

Jonathan: One interesting use case is product codes. Obviously, the API provides user IDs. They're not much use to humans. You'll find that you have a lot of codes in your product inventory, so you can add a custom field to your product schema which is for that code that pertains to your inventory. That's probably the most common use case that's just come to me there.

Jamie: Good use case.

Jamie: The custom data, or Flows as we call them, are inside of our API reference, some of the advanced sections. Go to docs.moltin.com to get to the page that we're on now.

Jonathan: What are they talking about here when it says core versus a non-core flow?

Jamie: A core resource is just something that we provide out of the box like the cart's endpoint, the product's endpoint, the order's endpoint, all of that, that we kind of give and sell through our API. Non-core is something that you create yourself. If it was a blog like you mentioned, you may have a flow called blog. That's not a core resource. That's something that you've created. That's your own custom table, or resource. There is a list of core resources you can extend, and those are obviously also on our documentation as well.

Jonathan: It's pretty much every endpoint, right?

Jamie: Yeah, pretty much every endpoint, barring a few that you can add Flows to and extend. But yeah, it's pretty simple to pretty much get started I think.

Jamie: Let's dive into the dashboard. I have two Flows already set up, one for products which extends products, and one which extends orders. Now the important thing to remember when you are extending a resource is the slug must match the plural name of the resource you're extending, so that would be products, orders, carts, cart items.

Jonathan: So not product. Products. If you created a product flow, then you will have completely custom-

Jamie: Flow.

Jonathan: Flow, yeah.

Jamie: The product flow here, this is the flow data, and then on the right here we've got these individual fields. We've got things like volume, ingredients and a short order ID.

Jamie: Now let's have a look at what an actual flow may look like on that resource. Here we've got products, so let's jump over to our catalog and have a look at what that may look like on a product. If we dive into a product, and then we scroll down into product details here, we've got these custom fields. We've got things like the short order ID, which doesn't belong to this product, but this is what we can kind of update and be something else. We've got the volume, and we've got the types of ingredients that are required for this particular product.

Jamie: These are the flow fields for this specific custom resource right here, that we can edit, which is cool. Like this is not data that Moltin cares about. It's just provided the functionality for me to add additional fields to my product. And if this was a Boolean, you could go do that as well.

Jamie: We're able to add Flows and custom data to all of that, and edit that within the dashboard, which is really cool. We also have some documentation inside of our developer portal, developers.moltin.com, where we have some information about how you can extend and create new resources. We've got this creating a blog example as well, which you mentioned. We've got that. And then there's kind of this tutorial, we'll walk you through how to create a new custom flow and add those entries and create fields and all of that as well. Of course, we've we've got that wishlist example that we discussed earlier on.

Jamie: Flows is ... It is really powerful. The term Flows to me, it doesn't immediately strike out that it's custom data. We do associate Flows with other words like content, data, custom data, schema, content APIs. So whenever you kind of see that kind of thing going on that people talk about who may use Moltin, all it really means is it's a flow. It is custom data. What you wanna call that and how you wanna kind of mention that when you are in discussions with us, that's really entirely up to you what you kind of call this. Every developer will have their own terminology for what this is. I personally see it as a schema, like a custom schema, but Flows is the name of our ... The product name I guess. The endpoints Flows, documentations around Flows ... All Flows really is, is custom data, so don't be alarmed by that word Flows.

Jonathan: What's really cool in Flows is like you saw that we can update a field in the dashboard, or what you can actually do is like ... We talked about it last week with our events and integrations and webhooks. We can actually trigger updates via a webhook. For example, coming back to what we talked about last week with Twilio SMS on an order shipment for example. Order's been shipped, we wanna send a Twilio SMS via a serverless function. Let's do that. On the success of that Twilio SMS being sent to the phone number, which again is a custom field, we can then update the order to say that the SMS has been sent via a Boolean custom field, so you can-

Jamie: That's really cool.

Jonathan: All of this ties in nicely together, and there's some really good examples that we've got that we can show. Jamie's showing some of these now. Integrations and Flows play really nicely to each other. They complement each other. It's really powerful as a developer, but as well you can use it ... The non-technical people in your company can use this as well.

Jamie: That's really cool. One of the examples that we've got in the integrations examples that we put on GitHub is this ability to create a short order ID. Every time a product's created, or sorry, every time an order's created, we can then immediately fire off a webhook, which will just create a short ID, and then once that short ID has been generated here, we can then send a request back to Moltin to update the order with that short order ID. Moltin's not had any involvement other than sending a webhook with the data, and then something else has happened, so magic's happened somewhere else, and it's pushed that data back to Moltin, and because of that, the API that we have, people are kind of able to extend and do all of that, and then-

Jonathan: With the other services that they're already using elsewhere.

Jamie: This could be that Twilio example where it sets a Boolean of SMS sent, and that happens on some service type code that's going on on AWS Lambda, on Zeit Now, on Netlify Functions. Anywhere you can run some service code, you can just update back and update custom flow data, which is, I think, amazing.

Jonathan: The beauty of an API.

Jamie: Flows, what's it gonna cost me? What is it going to cost me? We've got different tiers of pricing, but if you're in a store that is taking revenue up to $100, you can use our platform for free. But if you wish to use Flows-

Jonathan: $10.

Jamie: It's gonna cost $10.

Jonathan: A month.

Jamie: A month. You can't even get a database for $10 a month. So it's pretty cool. Is there a limit to how much you can use?

Jonathan: Nope. It's all-

Jamie:  All in.

Jonathan: All the usage is purely based on the ... Obviously there's fair usage. See terms and conditions. But the billing is purely based on all the revenue generated, so if you kind of up the order revenue, you'll see the cost of Flows will increase.

Jamie: I've got a really successful store. There's a custom option. I'm not that successful just yet, but if I am making up to half a million dollars, Flows is gonna cost me $550 a month, which ain't too bad if my store's making half a million dollars a month. I would be happy to contribute that back to Moltin. Obviously it's gonna cost me some money as well to use Moltin, but we do have a custom option as well for anyone that exceeds those amounts.

Jamie: The pricing for Flows varies there as well. I think you get a good deal with Flows. It's a really powerful API that you can use. Obviously you can extend Moltin as well.

Jamie: What would you like to see from Flows? Is there anything that you've seen? I'm putting you on the spot, but is there anything that you can imagine Flows enabling or ... One thing that comes to mind is social logins. Someone could login as a customer to Moltin via Facebook, Twitter, GitHub, and that data for the user, like if you're using Auth Zero you could keep the ID on a flow, so you could enable social logins on your website fairly simply. That's one idea I don't think we've got an example for but-

Jonathan: One thing that we've both come across is extending Flows to more services, particularly integrations. Some of the stuff we've done, we've found we'd love to be able to add a custom field to an integration, and it's just not possible right now. So personally I'd like to see that. I can't remember the actual use case off the top of my head right now, but it was around basically kind of potentially API keys for integrations.

Jamie: Yeah, so if you were creating an integration with a third party service-

Jonathan: Yeah, you could store that API key for that service on the integration. Awesome.

Jamie: Cool. Wow, it's been a good week. See you guys next week. We will be talking about something completely different. Please let us know in the comments if you've got any suggestions on what we should talk about, and if you've got any comments on this video, the previous videos, or you wanna see more about Flows, we can do that. So let us know in the comments. Subscribe to this video, to the channel. Click the bell icon, you'll get notifications, so your phone will buzz when you get a new video. This happened last week to you, right?

Jonathan: Yeah.

Jamie: And that, obviously, expands as the price gets-

Jonathan: Yeah.

Jamie: Where posted a video ... I didn't even know it was published to YouTube, and he was like, "Oh, it's buzzed on my phone." So if you want that buzz action, then hit that bell, subscribe and you'll get-

Jonathan: Who doesn't?

Jamie: You'll get me and you every week-

Jonathan: In your inbox.

Jamie: In your inbox.

Jamie: That is cool. Thank you everyone.

Jonathan: Peace.

 Jamie: Hi everyone, welcome back to another episode of yet ... There isn't a name.

Jonathan: Hey everybody, welcome back. I'm Jonathan. This is a write-off.

Jamie: That's not going in the outtakes this week.