Sendio.Contacts (sendio v1.1.0)

Manage contacts in Sendio.

Note: Contact endpoints support lookup by email OR id (e.g., contact_id can be "user@example.com" or "ct_123").

Summary

Functions

Link to this function

add_to_segment(client \\ Sendio.client(), contact_id, segment_id)

Adds a contact to a segment.

Link to this function

create(client \\ Sendio.client(), opts)

Creates a new contact.

Options

  • :email - The contact's email address (required)
  • :first_name - The contact's first name
  • :last_name - The contact's last name
  • :unsubscribed - Whether the contact is unsubscribed
  • :properties - Object of custom property key-value pairs
  • :segments - Array of segment IDs to add contact to
  • :topics - Array of topic subscriptions with :id and :subscription (opt_in/opt_out)
Link to this function

get(client \\ Sendio.client(), contact_id)

Gets a contact by ID or email.

The contact_id can be a contact ID (e.g., "ct_123") or an email address.

Link to this function

list(client_or_opts \\ [])

Lists all contacts.

Options

  • :segment_id - Filter contacts by segment ID
Link to this function

list(client, opts)

Link to this function

list_segments(client \\ Sendio.client(), contact_id)

Lists all segments for a contact.

Link to this function

list_topics(client \\ Sendio.client(), contact_id)

Lists all topic subscriptions for a contact.

Link to this function

remove(client \\ Sendio.client(), contact_id)

Removes a contact.

Link to this function

remove_from_segment(client \\ Sendio.client(), contact_id, segment_id)

@spec remove_from_segment(Sendio.Client.t(), String.t(), String.t()) ::
  Sendio.Client.response(Sendio.Empty.t())

Removes a contact from a segment.

Link to this function

update(client \\ Sendio.client(), contact_id, opts)

Updates a contact.

Options

  • :first_name - The contact's first name
  • :last_name - The contact's last name
  • :unsubscribed - Whether the contact is unsubscribed
  • :properties - Object of custom property key-value pairs
Link to this function

update_topics(client \\ Sendio.client(), contact_id, topics)

Updates topic subscriptions for a contact.

Takes a list of maps with :id (topic ID) and :subscription ("opt_in" or "opt_out").

Example

Sendio.Contacts.update_topics(contact_id, [
  %{id: "topic_123", subscription: "opt_in"},
  %{id: "topic_456", subscription: "opt_out"}
])