sendgrid v2.0.0 SendGrid.Contacts.Recipients View Source

Module to interact with modifying contacts.

See SendGrid’s Contact API Docs for more detail.

Link to this section Summary

Functions

Adds a contact to the contacts list available in Marketing Campaigns

Link to this section Functions

Link to this function add(recipient, opts \\ []) View Source
add(SendGrid.Contacts.Recipient.t(), [SendGrid.api_key()]) ::
  {:ok, String.t()} | {:error, [String.t(), ...]}

Adds a contact to the contacts list available in Marketing Campaigns.

When adding a contact, an email address must provided at a minimum. Custom fields that have already been created can added as well.

Options

  • :api_key - API key to use with the request.

Examples

alias SendGrid.Contacts.Recipient

{:ok, recipient_id} = add(Recipient.build("test@example.com", %{"name" => "John Doe"}))

{:ok, recipient_id} = add(Recipient.build("test@example.com"))