Trigger campaigns using APIs
Last update: November 7, 2024
CREATED FOR:
- Experienced
- User
- Developer
Learn how to create a campaign and trigger it from an external system based on user interactions, using the Interactive Message Execution REST API.
Transcript
In this video, you will learn how to create and then trigger a campaign in Adobe Journey Optimizer from an external system using the interactive message execution REST API. Just like scheduled campaigns, API-triggered campaigns bring a simple and fast way to craft a communication to an audience and send it out for ad hoc use cases. This feature allows you to create the campaign from the AJO interface and then invoke it from an external system-based user trigger via REST API. Unlike profile-enabled events, which are used in Journeys, the contextual data passed in REST APIs is used for one-off communication and not stored against the profile. Good use cases are fire-and-forget transactional and operational use cases where an individual user sent a message with or without additional context data. Examples could be password reset, emails or messages, OTP information, thank you messages, welcome messages. API-triggered campaigns can also be used for audience-based marketing messages. Think of a game night, for example, where you would like to send the final score to the fans. You could set up one campaign and potentially use it for all games during the season if you pass the teams and the scores via the API. So before we get started, there are two prerequisites. For the authoring side, you need to have the campaign manage permissions. To execute the API-triggered campaign, you need to have a developer permission and you should have a developer project on the Adobe IO console. Now let’s start with the transactional API-triggered message. The use case I will cover here is the reset password use case. So let’s get started. In Journey Optimizer, under Journey Management Campaigns, we’re going to create a new campaign. And on the Create Campaigns screen under the Properties, this is where you decide what type of campaign you’re going to create. So scheduled or in our case, API-triggered. And for API-triggered, you have two categories available, transactional and marketing. We’re creating the transactional message today, so I’m going to leave it on transactional. Select Email. Don’t forget to select your surface. And now we can create. Okay, I’ll give the campaign a name. I’ll leave the description empty and then here you can see in the audience section, I cannot select an audience as the profile that will be targeted will be set via the API call. I’ll change the identity type to email. Now this little checkbox here is important. In some cases, you may need to send transactional messages to profiles that do not exist in the system. For example, if an unknown user tries to reset a password on your website. When you have the Create New Profiles checked, if the profile does not exist, Journey Optimizer automatically creates it when executing the campaign to allow sending the message to this profile. If this option is disabled, unknown profiles will be rejected for any sending and the API call will fail. Unknown profiles are created in the AJO Interactive Messaging Profile dataset. Within the respective namespace, email, phone or ECID, depending on the output channel. In our case, it would be the email address as we are sending an email. The rest of the campaign setup is the same as with scheduled campaigns. So let’s go into editing the content. Let me put a subject line in. Let’s go into the email body. I’ve pre-prepared a template that we can use. You can apply any personalization as with the scheduled messages. Everything is available. However, there is one small difference. You can pass over information that you want to display in your message within the payload. And in order to display this contextual information, I need to go into the personalization field. And in our case, I would like to hand over the password reset URL. Now in order to get the API context, I actually need to type into the field context. And I need this context information in the payload of my API and we’ll see it later. And then in this case, I want to hand over the URL. So I’ll call it context URL. And now we have the context URL here. I can simulate the content. The only thing is in the simulation, the context URL will not be populated because that comes via the API. But the rest of the personalization will. Okay, I should save. And then let’s go back. Okay. Okay. Okay, so now we can click on review to activate. Looks like everything is fine. Oh, I have one small alert. I forgot to or haven’t added an opt out link, but that is absolutely okay for our purposes right now. So everything’s fine. The properties, audience, actions, schedule. Now down here, the curl request. This is important. I need this information for my API. Before we dive into the API, let me activate my campaign. Now while we wait for the activation to go through, let’s take a closer look at the data that is required to trigger the API call. I will use Postman to manually trigger an API call. So let me open Postman and the campaign’s curl request side by side and walk you through the details. Normally, you would copy the curl request by clicking on this little icon here and import it into your API platform. It has most of the data you need, but let’s break it down a bit. So the post URL that you need to connect with the API can be found here. Then, the header information. I’ve already pre-populated it in Postman. You will need to retrieve the API key from the Adobe IO developer console. The IMS-ORG ID is already populated in the curl request, just like the sandbox name and the request ID, as well as the campaign ID, which are both used in the body. Coming to the body data. Here you see the mandatory fields that are pre-populated from the campaign. The type, AEP, the namespace that we set, email, and the channel data. For the email channel is email, for SMS the phone number, and for push the ECID. The user ID is required, and here you see the context data. In our case, we added the URL. So I made sure to populate the URL field so that we could use the URL in our email communication. Okay, let’s trigger an API call and see what happens. And here’s my inbox, and you can see I’ve received my message and the personalization fields have been populated. The first name from the profile that is linked to the user ID, and the URL from the payload. Now let’s take a look at the reports. For this I go into the campaign, into reports, and I’m going to look at the past 24 hours, and I can see that there was a delivery in the past 24 hours to one profile. And if I look at the email data, I can see that the email was sent and delivered. If I had added tracking information, I could also see the click-through rate, etc. Now you know how to trigger a campaign through an API. Thank you for watching!
Previous pageCreate a web campaign
Next pageCreate content experiments for email campaigns
Journey Optimizer
- Journey Optimizer Tutorials
- Use Cases
- Use Case Playbooks
- Introduction to Journey Optimizer
- Campaigns
- Journeys
- Journey Designer - Overview
- Discover the new Journey Designer
- Introduction to building a journey
- Use case - Transactional journey
- Use case - Business event
- Use case - Read audience
- Use case - Audience qualification
- Create a test profile
- Publish a journey
- Update content in a live journey
- Copy a journey to another sandbox
- Trigger daily journey runs after batch segmentation
- Troubleshoot inbound actions in journeys
- Conflict management
- Profiles, audiences, and subscriptions
- Channels
- Content Management
- Personalize content
- Personalization editor - Overview
- Profile and audience membership-based personalization
- Add offers as personalization
- Use contextual event information for personalization
- Use helper functions for personalization
- Use and manage saved expressions in the personalization library
- Create dynamic content with the condition rule builder
- Personalization editor playground
- Decision Capabilities
- Data Management
- Report and monitor
- Configuration
- Access Control
- Data Governance and Privacy
- Exercises and challenges
- Experience League Live show recordings
- Summit Labs