Docs/Merchants/Integrations & API
Sendlane
Connect Sendlane and Toki sends every loyalty event to it as a custom event, through an integration named Toki that Toki creates in your Sendlane account. Each event also adds the member to a Sendlane list you choose and refreshes their loyalty data as custom fields on their contact. You then build Sendlane automations on those events and use the custom fields in segments and messages.
What you need from Sendlane
Toki asks for two things.
| Field in Toki | What it is | Where to find it |
|---|---|---|
| API Key | Your Sendlane API v2 token. It lets Toki read from and write to your Sendlane account, so treat it like a password. | In Sendlane, open Settings, then API. In the Sendlane API V2 section, click Create Access Token, name the token, click Create, and copy it. |
| List Id | The number that identifies the Sendlane list Toki adds your members to. Pick the list where you want your loyalty members to land, for example one you create just for them. | On the Lists page in Sendlane: copy the number in the ID column for your list. |
What Toki does with the key
Toki uses the key for everything below.
| In Sendlane | Toki uses the key to |
|---|---|
| Lists | Check the key when you save, and add members to your list. |
| Contacts | Find a member's contact by email, add them to the list, and update their custom fields. |
| Custom fields | See which custom fields exist and create the toki_ fields that do not exist yet. |
| Custom integrations and their events | Create the Toki integration and register every Toki event on it. |
| Event tracking | Send each event to the member's contact. |
Connect Sendlane
- In the Toki app, open Integrations.
- On the Sendlane row, click Install.
- On the Install Sendlane page, paste your API Key and enter the List Id.
- Click Save in the bar at the top of the page.
Toki checks the key as you save by asking Sendlane for your lists. If Sendlane does not accept the key, "Invalid API Key" appears under the field: copy the whole key from Sendlane again and save.
Right after the first successful save, Toki sets up your Sendlane account:
- It creates a custom integration named Toki, with the list you entered as its default list.
- It registers every Toki event name on that integration as a custom event, so Sendlane already knows every event when you build your first automation, before any customer has done anything.
- It reuses the custom fields already in your account that have the name of a Toki property, such as
toki_point_balance.
This setup runs once, and Toki needs the List Id to run it. If you saved without a List Id, click Manage on the Sendlane row, add it, and save; Toki then completes the setup.
In Sendlane, Toki appears on the custom integration page. Click its Events icon to see every Toki event; the Events page shows example data for an event once one has arrived.
The install, manage, and uninstall flow is the same for every integration; see Integrations and your API key.
Change or disconnect
To change the key or the list, click Manage on the Sendlane row, edit the Manage Sendlane page, and click Save. Toki checks a new key the same way as at install. A new List Id takes effect right away: from then on, members are added to the new list. Members already on the old list stay there.
To disconnect, click Uninstall on the row and confirm. Toki deletes the key it stored and stops sending events. The toki_ custom fields and the contacts already added to your list stay in your Sendlane account. To connect Sendlane again later, chat with us and we'll set it up with you.
What Toki sends to Sendlane
Each time something happens to a member in Toki, such as earning points, reaching a tier, or redeeming a reward, Toki does three things in Sendlane:
- It sends the event to the contact with the member's email address, as a custom event of the Toki integration. The event carries its own details, for example the tier name on Toki Membership Unlocked.
- It adds the member to the list from your List Id, with the first and last name Toki has for them.
- It updates the member's loyalty data on the contact as custom fields: points balance, tier, referral link, wallet pass links, and more. Toki sends them with every event, not just the ones that changed.
The complete list of events, their details, and the properties is in Email and SMS events.
Toki sends events for customers who have an email address in Toki and are members of the store. Suspended members get no events while the suspension lasts.
Adding a member who is already on the list doesn't start your list automations again.
Event names in Sendlane
Every event keeps its Toki name, with the "Toki" prefix: Points Earned in a Toki campaign or workflow is the custom event Toki Points Earned in Sendlane, Membership Unlocked is Toki Membership Unlocked, and so on. Nothing is renamed. Because Toki registers the whole catalog, Sendlane's event list also shows the few events that Toki keeps for its own automations; the reference marks which ones those are.
How properties look in Sendlane
- Each property becomes a custom field on the contact, named exactly like the property:
toki_point_balance,toki_tier_name,toki_referral_link, and so on. Toki creates a field the first time it needs it. - Every value arrives as text, including numbers and yes/no values.
toki_point_balanceholds a number written as text, such as150, andtoki_wallet_downloadedholdstrueorfalse. - Properties that exist once per store credit or once per referral reward, such as
toki_point_balance_followed by the store credit ID, each get their own custom field.
Features that send to Sendlane
Every reward works the same with or without Sendlane: you set it up in Toki, and Sendlane receives the events and properties it produces. A few features are worth knowing about:
- Gift card delivery set to External sends the gift card events to Sendlane, so you can deliver the card from a Sendlane automation; see Gift card delivery.
- The Send Custom External Event workflow action can send an event you name to Sendlane; see Workflow actions.
- Survey, quiz, and poll answers reach Sendlane as custom fields named after the activity's Alias; see Creating rewards.
- Customers' wallet pass download links reach Sendlane as
toki_apple_download_linkandtoki_google_download_link; see Wallet passes.
Typical setups built on Toki events
You build the automations and segments in Sendlane; Toki supplies the events and custom fields. The event's own details travel with the event, and the custom fields sit on the contact. These are the combinations merchants use most:
| You want to… | Start from this Sendlane event | Useful data |
|---|---|---|
| Welcome new members | Toki Account Created | Custom fields toki_referral_link and toki_point_balance |
| Congratulate a customer on a new tier | Toki Membership Unlocked | Event detail toki_tier_name; custom field toki_tier_rewards |
| Win back a customer who dropped out of a tier | Toki Membership Lost | Event detail toki_tier_name |
| Confirm points as they come in | Toki Points Earned | Event details amount (points just earned), toki_point_balance, and toki_points_earned (lifetime total) |
| Deliver a discount code a customer earned | Toki Reward Created | Event details toki_code, toki_type, and toki_value |
| Thank a customer whose friend placed an order | Toki Referred a Friend | Event details toki_referee_email and toki_order_amount |
| Remind customers about wishlisted products | Toki Wishlist Item Added | Event details toki_product_id, toki_variant_id, and toki_label |
| Ask for a review | Toki Request Review | Event detail submit_url |
| Nudge members toward the next tier | Any event, or a segment on the custom fields | Custom fields toki_nt_name, toki_loyalty_nt_points, and toki_nt_spend_left |
| Add wallet pass links to any email | Any | Custom fields toki_apple_download_link and toki_google_download_link |
Use Toki Account Created for welcome automations: it fires when the customer's loyalty account is created, so the automation runs for new members only.
Start a Sendlane automation from a Toki event
- In Sendlane, create an automation and choose the custom event trigger on the custom integration tab.
- Under Store, select the Toki integration. Under Event, select the Toki event, such as Toki Membership Unlocked.
- Under Limit Per Contact, choose how often the same contact can start the automation: No Limit, Do not trigger when already in automation, Once Per Day, or One Time Only. Events such as Toki Points Earned can arrive many times for one member.
- To show event details in an email, add a text box that contains
{% set data = trigger.getCustomEventData() %}. Then write{{-data.toki_tier_name-}}where the detail should appear, with the detail's name afterdata.. The first line is visible only to you in Sendlane's email builder, not to the people who get the email.
To show one of Toki's custom fields in an email or a text, write
{{ contact.custom('toki_point_balance') }} with the field's name in the
quotes.
Troubleshooting
The key is not accepted when you save. "Invalid API Key" under the field means Sendlane did not accept the key: copy it again from Sendlane and paste the whole key. "API Key is required" means the field is empty. If the check could not reach Sendlane, save again in a moment.
Events are not showing up in Sendlane. Open Integrations and check that the Sendlane row shows Installed; Toki only sends events to connected tools. Click Manage and check that List Id is filled in: Toki needs the list to finish its setup in Sendlane and sends nothing until that is done. The member needs an email address in Toki, must be a member of the store, and must not be suspended.
A member is not on the list, or their toki_ fields are empty. Members reach the list and get their custom fields with their first event after you connect, so a member who has not triggered any event yet is not there. To see exactly what Toki holds for a member, use the "Check a member's current values" steps in Email and SMS events.