« Back to guides

How to set up a push action

Push actions are a quick way of sending updates to customers, or keeping other services up-to-date with data changes in Custobar.

This guide helps you understand how to set up a push action from scratch, so that it is ready for users to start sending push campaign actions. In this guide, you will be defining a form for defining push action’s content and an outgoing data targets for it.

Defining the outgoing data target

The first step in creating a push action is to define the target for push messages. Custobar provides a flexible way of defining one or more target services, where the message are sent.

Follow these steps to set up a target service

  1. The target services are defined in the integration settings, start by navigating to Settings > Integrations.
  2. Create a custom integration by clicking Add integration on Custom list item.
  3. Give an identifiable name and description for the integration, and click Create.
  4. From the integration detail page, click Add to open a dialog for defining a new outgoing data target, i.e. target service for the push actions.

Configuring the data target

Image of Add data target modal in Integration settings

To configure the target service for push actions, create a data target for Messages.

Fill out in minimum the name, description and request URL address. The name and description should be recognisable by the marketing managers, who daily create the push actions, so that they know which target service to send the message.

If you’d like to call multiple remote services at once, e.g. your CRM and a web app, you may define multiple target services. Upon calling the data target, Custobar will call each of the defined target services.

You may define custom headers, for example an authentication token to be used with your endpoint, the format, batch size and the wrapper document, should the items be grouped into batches.

After you’re configured the data target the way your service has been set up, click Create to finish adding the data target.

Next, you’ll be adding a push action form, which will help non-technical users in creating push messages, instead of writing raw JSON code.

Creating the push action form

The purpose of push action forms are to allow users to create push action content, without knowing how to write JSON documents.

The push action forms consist of a user fillable form, the default JSON document and a selection of applicable data targets, like the one created in the previous step. You may have multiple forms connected to multiple allowed endpoints.

Follow these steps to set up a push action form

  1. The push action forms are defined in the push action forms settings, start by navigating to Settings > Push action forms.
  2. To begin, click Add from the bottom of the list.

Configuring the form, step 1

Image of push action form in settings

To configure the push action form, start by giving it an applicable name and description, so that users creating push action forms recognise the form its purpose. Check any outgoing data targets that are suitable for this form. The user will be presented with a choice of target services based on this list.

The message is the JSON document that is sent to the customer, modified by the push action form created in the next step. The message can contain placeholders using a double dash expression, for example --date--. Add any keys here you’d like to have as default values or as static values. For example, to create a customer service ticket, you might want to define the following kind of JSON document.

{
  "date": "--date--",
  "recipient": "--customer_id--",
  "message": {
    "type": "Feature request",
    "subject": "Hello, world!",
    "body": "How is it going",
  }
}

In the example, the date and _customerid strings are replaced by their actual values, whereas next we make the subject and the body properties of a message editable by our user. The type is a static value, which cannot be edited and is always sent as-is.

Configuring the form, step 2

To configure the form to allow editing of the JSON document defined in the previous step, follow these steps

  1. Start by dragging two Form rows onto the canvas from the bottom part of the dialog.
  2. Drag a Text line into the first box outlined by the grey dashed line and then drag a Text area into the second box outlined by the second grey dashed line.
  3. Update names of each rows, by clicking the pencil icon and updating the Label field. Close the sub dialog.
  4. Next, lets bind the two text input fields onto the JSON document. Click the pencil icon of the first field. From the subdialog which appears, enter the JSON key path for the field being updated. For the first field, it is “message.subject” and the second “message.body”, as shown below for the second example.
  5. Finally, to save the form you’ve now created, by clicking Save.

Image of push action form layout modal in settings

Conclusion

All done! You’ve now set up your first push message and target service, to which the messages are to be sent.

The next step is to create an actual push action. To do that go to the Campaigns section, click Create action and choose “Push” as the action type. When completing the form, you’ll be redirected to the push content editor, where you can pick the form and the target service, that you created in this tutorial.