Skip to content

Contacts

A contact represents the person you're sending notifications to. Contacts are created automatically the first time you send to a new recipient.

Creating contacts

You don't need a signup flow. When you send to a recipient that doesn't exist yet, Sendivent creates a contact. Sending again to the same identifier updates stored fields.

bash
curl -X POST "https://api.sendivent.com/v1/send/welcome" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "to": "user@example.com" }'

The to field

You can send using either a string identifier or a full object.

String formats (common)

  • Email: "user@example.com"
  • Phone (E.164): "+46701234567"
  • Your ID: "user_12345" (if you've previously set it)

Object format (for enrichment)

json
{
  "to": {
    "id": "user_12345",
    "email": "alice@example.com",
    "name": "Alice Johnson",
    "plan": "premium",
    "account_credits": 1000
  }
}

Stored as:

json
{
  "externalId": "user_12345",
  "email": "alice@example.com",
  "name": "Alice Johnson",
  "firstName": "Alice",
  "lastName": "Johnson",
  "avatar": "https://www.gravatar.com/avatar/...",
  "meta": {
    "plan": "premium",
    "accountCredits": 1000
  }
}

Notes:

  • id is stored as externalId (your ID, from Sendivent's perspective)
  • Unknown fields go to meta with camelCase conversion
  • name is auto-split into firstName and lastName
  • avatar uses Gravatar fallback when not explicitly set (requires email)
  • Both camelCase and snake_case work (e.g. firstName or first_name)

Using contact data in templates

  • Standard fields: {{contact.email}}, {{contact.name}}
  • Name parts: {{contact.firstName}}, {{contact.lastName}}
  • Avatar: {{contact.avatar}} (auto-generated from Gravatar if not set)
  • Your ID: {{contact.externalId}}
  • Sendivent's ID: {{contact.id}}
  • Metadata: {{contact.meta.plan}}, {{contact.meta.accountCredits}}

Linking to your users

Pass id with your user ID. Sendivent stores it as externalId and uses it to recognize returning users:

bash
curl -X POST "https://api.sendivent.com/v1/send/reminder" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "to": "user_12345" }'

Common pitfalls

  • Phone format — SMS requires E.164 format (e.g. +4670…)
  • Blank variables — ensure you send the fields your template uses (name, meta.*, etc.)

See also

Released under the MIT License.