Contact

You can attach email addresses to your wallet address and get email updates when an order's status changes. This is completely optional; but it can keep you updated if your order is paused or cancelled for some reason. The contact sub-property of the sdk has a few functions to manage contacts.

Adding

You can add an email contact using the 'add' function of contact. Here is an example:

await sdk.contact.add("me@buidlhub.com");

This will associate the email address to the wallet attached to the SDK.

Querying

You can get a list of all registered contacts so you can 1) see what's registered with the wallet and 2) toggle the contact on/off.

let contacts = await sdk.contact.getAll();

This will return a set of very simple contact JSON objects:

{
    "id": 1,
    "identifier": "me@buidlhub.com",
    "contact_method": "EMAIL",
    "state": "OFF",
    "active": null,
    "user_id": 1,
    "createdAt": "2021-07-20T17:00:44.653Z",
    "updatedAt": "2021-07-20T22:05:48.919Z"
  }

Here the contact is marked as "OFF" meaning it's been disabled. You use the toggle function to enable/disable a contact.

Toggling

You can toggle the enabled/disabled state of a contact if things get out of control and you want to stop getting notifications. Here is the way to do it:

await sdk.contact.toggle(1);

The "1" is the id of the contact whose state you want to toggle on/off. "On" in this case, means the state of the contact will be set to "null". Note that only the first contact registered will be notified. Future iterations of Dexible will support multiple contact types (Telegram, Discord, etc).

Last updated