Maropost.ContactToken (Peacemaker v3.3.5-rc.7) View Source

Module for managing Contacts in Maropost.

Example

Build a token with default values

ContactToken.build() |> ContactToken.format_request() |> ContactToken.submit_token()

  • NOTE: The above code will NOT work, because the first_name, last_name, and email still must be set on the token before submitting

Can take an %Account{} struct as the first argument

ContactToken.build(account) |> ContactToken.format_request() |> ContactToken.submit_token()

By default, the submit_type is :create. This means that calling submit_token/1 will create a new contact in Maropost. All response payloads are loaded into the :response_payload field, and similarly with the :request_payload field.

Link to this section Summary

Functions

Pushes a new tag to be added to the Maropost Contact

Builds the initial token. Sets the default list_id to the lead_list_id. If given an email, will try to query that email on Maropost and set the :contact_id field on the token if one is found

Formats the request payload when creating a new contact in Maropost

Refreshes the data on maropost_data. Useful after submitting a token to ensure that the :maropost_data key has the most up to date information

Pushes a new tag to be removed from the Maropost Contact

Sets the email on the token

Sets the email on the token

Sets the list_id on the token

Validates then submits the token. Will perform different submit actions base on the submit_type. Default submit_type is :create

Link to this section Types

Specs

t() :: %Maropost.ContactToken{
  add_tags: term(),
  contact_id: term(),
  email: term(),
  first_name: term(),
  has_otms?: term(),
  itm_campaign: term(),
  itm_content: term(),
  itm_medium: term(),
  itm_source: term(),
  itm_term: term(),
  last_name: term(),
  list_id: term(),
  maropost_data: term(),
  optin_tag: term(),
  phone: term(),
  remove_tags: term(),
  request_payload: term(),
  response_payload: term(),
  submit_type: term(),
  subscribe: term(),
  tracking_id: term(),
  utm_campaign: term(),
  utm_content: term(),
  utm_medium: term(),
  utm_source: term(),
  utm_term: term()
}

Link to this section Functions

Link to this function

add_tags(token, add_tags)

View Source

Pushes a new tag to be added to the Maropost Contact

Builds the initial token. Sets the default list_id to the lead_list_id. If given an email, will try to query that email on Maropost and set the :contact_id field on the token if one is found

Link to this function

format_phone(phone_number)

View Source

Formats the request payload when creating a new contact in Maropost

Link to this function

refresh_maropost_data(token)

View Source

Refreshes the data on maropost_data. Useful after submitting a token to ensure that the :maropost_data key has the most up to date information

Link to this function

remove_tags(token, remove_tags)

View Source

Pushes a new tag to be removed from the Maropost Contact

Link to this function

set_contact_id(token, contact_id)

View Source

Specs

set_contact_id(t(), String.t()) :: t()

Sets the email on the token

Specs

set_email(t(), String.t()) :: t()

Sets the email on the token

Link to this function

set_list_id(token, list_id)

View Source

Sets the list_id on the token

Validates then submits the token. Will perform different submit actions base on the submit_type. Default submit_type is :create

:create -> Creates a new Maropost Contact :update -> Update a Maropost Contact to add or remove tags.