Configure custom actions
Learn how to configure an action for Journey Orchestration and how to use it in a journey.
Transcript
In this video, we will show you how to configure an action for Journey Orchestration. Actions in Journey Orchestration are the touchpoints to which you deliver personalized, real time experiences to individuals. These can include traditional messaging channels such as push notifications, email or SMS or any other means of digital engagement that you use in your business. Any service from any provider that can be called through a rest API with a JSON format at payload and be configured as an action in Journey Orchestration. In this video, you will learn how to configure an action that calls an API for a messaging channel or other service and how to use the action you’ve configured to engage with individuals in a journey. To configure an action in Journey Orchestration, you’ll need to know three things for the service you want to configure. The URL for the API call, the authentication model used by the API and the username and password, API key or token used to authenticate with a service and the JSON payload that should be provided with the API request, if any. To demonstrate, we’ll show you how to configure an SMS messaging action using a service called Textbelt which offers a straightforward API for delivering SMS messages.
In the Actions tab of the Journey Orchestration interface, I’ll click Add to create a new action and I’ll give it a name and a description. Next I’ll add the URL. By default, Journey Orchestration adds a header with content type as Application JSON. The Textbelt API doesn’t require any other header fields but you can add any other header fields here that you need. Next, you can configure whatever authentication is required for the API you’re configuring. Here you’ll see options for various authentication patterns including basic authentication to provide a username and password, an API key that’s passed as either a query parameter or a header field, custom authentication which allows you to configure authentication based on JSON web tokens or no authentication.
The Textbelt API that we’re configuring here uses an API key but it’s included as part of the payload rather than in a header field. So we’ll just use No Authentication here. Finally, we’ll configure the payload for the API request. The Textbelt API has a very simple payload with just three parameters for the mobile number you’re sending to, the message text and the API key. I’ve been using Postman to test out the API so I’ll just copy and paste the payload from there. You can often copy and paste it directly from the API documentation for whichever service you’re configuring. When you paste in the payload, you’ll see that the Journey Orchestration UI parses the payload and identifies the parameters that are included. You can adjust the data type if needed. And for each of the parameters, you can specify whether it should be variable or constant. If you specify the parameter as a constant, then the API request for this action will always include the value that you enter here. In this case, we want the API key to be a constant so that this action always uses our key value for the Textbelt service. If you make the parameter a variable, then you’ll have the opportunity to map a value that will be inserted dynamically at run time. We’ll do that for the phone number and the message and instead of a specific value, you’ll enter a friendly label for each parameter here.
Once you’ve configured the payload fields, click Save and then save the overall action configuration. Now that we’ve set up our SMS action, we’ll briefly demonstrate how you can use this action in a journey. I’ll go to the Journey’s tab and create a new journey which I’ll call SMS test.
I’ll keep it really simple here and start the journey with a generic test event that I’ve created.
Then, if you look on the left rail under Actions, you’ll see the Textbelt SMS action we’ve just created. I’ll drag that to the Canvas as the next step in the journey and you’ll see a configuration pane pop up on the right. You can add a label and description if you like to describe how you’re using this action in the journey. You’ll see the URL and Authentication details that we specified when creating the action and down towards the bottom is where you can configure values for the phone number and the message which were the two payload fields that we specified as variable when creating the action. For phone number, I’ll map it to the mobile number from the individual’s real time customer profile on the platform. Alternatively, depending on the use case, you could map to a value from the context data of the event that started the journey or to a value from many other data source that you configured for Journey Orchestration. For message, rather than mapping a value, I’ll just hardcode the message to say “Hello from Journey Orchestration.” And finally, you have the option to add an alternative path in the journey in case the API request for the action results in a time out or error response from the Textbelt server. And when I’m done, I’ll click Okay. To see it in action, I can activate this journey in test mode and send an instance at this test event for a test profile I’ve created for myself. And you can see that I received the text message from this journey as expected. In summary, you’ve learned how to configure an action for Journey Orchestration by specifying the API endpoint for whichever service you want to call, configuring authentication for this service and configuring the payload parameters for the API call. We’ve also demonstrated how you can use an action in a journey and map values for the action parameters. -
For more information, see the Actions section of the product documentation
recommendation-more-help
f620e463-d1bd-494c-b200-8abc8052e166