Overview

Skill Level: Intermediate

In addition to the standard actions that are provided by Watson Campaign Automation, developers can define custom actions and add these actions to mobile app messages. For example, you can define a custom action that opens a special product detail page for customers with loyalty IDs or opens a customer’s abandoned cart.

Prerequisites

Before you begin, ensure that the following prerequisites are met: 

  • You have an account with Watson Campaign Automation
  • You downloaded the sample app and SDK
  • You properly configured your client app so that it can receive and display mobile app messages

Action plug-in architecture overview

When an action is triggered, the system looks for handlers that match the registered types. Xamarin supports only one integration method, which is that you must register the action handler for the plug-in in the Application subclass creation, as described in step 3. 

For information about custom actions in iOS, see Advanced iOS push actions and iOS Action Categories. For information about custom actions in Android, see Advanced Android push actions and action categories.

 

Step-by-step

  1. Implement a subclass of IBMMobilePush.Forms.PushAction.

    For example:

    public class CustomAction : PushAction {
    } 

  2. Override the required Handle Action: method.

    For example:

    public override void HandleAction (JObject action, JObject payload, string attribution, string mailingId, int id) {
    
  3. Register the custom action class with the action registry at Application subclass creation startup.

    For example:

    SDK.Instance.RegisterAction(“customAction”, new CustomAction());
    
    
    

     

    The sample Xamarin project provides DisplayWeb.forms.cs as an example.

Join The Discussion

Your email address will not be published. Required fields are marked *