FLOIP / flow-spec

7 stars 6 forks source link

New Block Types: Core\SetContactProperty and Core\SetGroupMembership #46

Closed markboots closed 3 years ago

markboots commented 3 years ago

Rationale:

Setting properties on contacts, and adding/removing contacts from groups, are key operations for all vendors that have flows that interact with Contacts. There is no way to specify this using combos of existing blocks, so this requires new functionality. It may be valuable to standardize this across vendors, instead of having a number of independent vendor-specific blocks to do this within their own platforms.

Key Operations:

  1. Set a contact property (key, value from expression)
  2. Set the membership of a contact within a group (add, remove).

Proposed config parameters: SetContactProperty:

config {
   property_key: string,
   property_value: expression
}

The property_key is a string and is not further restricted by the spec. For complete block interoperability across vendors, vendors would need to agree on the format and identity of property_key. (e.g. property_key could be "gender" , or it could be a uuid referenced to an external taxonomy service.)

Proposed config parameters: SetGroupMembership:

config {
   group_key: string,
   group_name?: string,
   is_member: expression  (Values: 0 to remove, truthy to add, and null to not change the existing membership)
}

The group_key is a string and is not further restricted by the spec. For complete block interoperability across vendors, vendors would need to agree on the format and identity of group_key. The group_name is provided as a human-readable label in addition to the group_key, in cases where the group_name needs to be displayed to the Contact.

Note: In the course of developing the open-source Flow Runner and Flow Builder implementations, the initial dev team proposed a list of cleanups and clarifications to the spec. This is one of a set of changes proposed to improve consistency, usability, and functionality of the spec based on the first complete build-outs.

markboots commented 3 years ago

@bzabos @seifertk, I ran into an interesting question when writing the spec for the Set Contact Property block:

Since all blocks have the standard ability to set contact properties via:

config {
   ...,
   set_contact_property: {
      property_key: <string>
      property_value: <Expression>
   }
}

Should the config for the SetContactProperty block be consistent (as immediately above), embedded within the set_contact_property object?

Or should it be like this:

config {
   property_key: string,
   property_value: expression
}

If like this, and it also obeys "standard" block rules of being able to set a contact property like all blocks do... Does that mean it can actually set 2 contact properties in one block? ie:

config {
   property_key: "gender",
   property_value: "female",
   set_contact_property: {
      property_key: "age",
      property_value: "35"
   }
}

What choice did we implement in the Flow Runner?