Skip to main content

When to use this

Candidates receive automatic messages from a position: an invitation, one or more reminders, and a confirmation when they finish. Each message is a notification template. Use the API to:
  • See which templates exist and which positions use them.
  • Make a copy of a template and change its text, for example a new version for next year’s campaign.
  • Choose which templates a position sends, and when.
To do the same in the dashboard, see Creating and customizing templates.

How templates and positions fit together

Templates belong to your account, not to a position. A position has a list of notifications, and each one points to a template by ID:
Many positions can use the same template, including archived ones. Editing a template changes the messages of every position that uses it. To change the messages for only some positions, clone the template, edit the clone and assign it to those positions.

Before you start

Send your Hireflix API Key in the X-API-KEY header to https://api.hireflix.com/me. The examples use email templates; for the other channels, use type: "sms" or type: "whatsapp" in queries and type: sms or type: whatsapp in mutations.

Template operations

List every email template and the positions that use it. isDefault: true marks the templates Hireflix created for your account.
To get the full content of every template in one call, for example to back them up or audit their wording, add more fields to each list entry:
  • typeEnum: the channel (email, sms or whatsapp).
  • language: the template’s language code, such as en.
  • template.subject and template.body: the content in Draft.js format. See Template content format.
To see which templates one position sends, and when, set positionId in the Variables panel:

Template content format

A template’s subject and body (and text for SMS and WhatsApp) are raw Draft.js objects:
  • blocks is a list of paragraphs. A block with an empty text is a blank line.
  • Variables such as the candidate’s name or interview link are VARIABLE entities. An entity range (offset, length) covers the braced text in the block, and entityMap holds the variable’s value.
Variables used in the default templates:
Edit, don’t rebuild. Read the template, change the text in place and send the whole object back. Keep the block keys and entityMap as they are.
Keep entity ranges in sync. offset and length count characters in the block’s text. A replacement of the same length, such as 2026 → 2027, needs no other change. Any other edit shifts every range after it in that block, so recalculate those offsets, or the variables end up in the wrong place.

Example: new templates for a new campaign

Goal: give this year’s positions new emails that say “2027”, and leave last year’s positions unchanged.
1

Find the templates in use

Run List templates and read the notifications of one 2027 position to get the IDs of the templates it sends.
2

Clone and edit each template

For each template, run cloneTemplate with a new name, read the clone, change 2026 to 2027 in its subject and body, and save it with updateEmailTemplate.
3

Assign the clones

For each 2027 position, send updatePosition with the full candidateNotifications list, pointing to the new template IDs.
4

Check the result

Read every 2027 position’s notifications again, then run List templates to confirm the 2026 positions still use the original templates. Send yourself a test invite to see the email as candidates will.

Key reminders

  • Templates are shared. Editing one changes every position that uses it, archived ones included.
  • replacePositionNotificationTemplate is account-wide. Use updatePosition to change specific positions.
  • candidateNotifications replaces the whole list. Fetch the current list first and keep each entry’s id.
  • Clone default templates (isDefault: true) instead of editing them, unless you want every position to change.
  • WhatsApp templates can’t be edited through the API. Creating one needs an already-approved Twilio contentSid.

Learn next?

Let’s learn how to invite a candidate.