The YesGraph Developer Hub

Welcome to the YesGraph developer hub. You'll find comprehensive guides and documentation to help you start working with YesGraph as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    

Email Domain Targeting

Get more users with a specific email domain

In many cases, you may want your users to invite people with whom they share an email domain (e.g., users with a shared work email). You can achieve this quickly and easily using either the Superwidget, the Javascript SDK, or the REST API.

Whichever method you choose, you'll be setting value promote_matching_domain to the email domain you're looking for (e.g., "yesgraph.com"). If the user isn't signed in, or for whatever reason you don't know their email address, you can set it to 1, and YesGraph will attempt to automatically detect their email domain.

Two things to note about this feature:

  • YesGraph will not target extremely common domains, like "gmail.com" or "yahoo.com".
  • When possible, always set the target email domain explicitly. That way if the user imports contacts from a different email address, you'll still be suggesting contacts for the domain you care about.

Superwidget

Targeting a specific email domain through the Superwidget is simple!

Once you've configured your app on YesGraph's dashboard, all you need to do is add the parameter data-promote-matching-domain to your code snippet.

If you know the signed-in user's email address, you should pass it explicitly (e.g., promote-matching-domain=yale.edu).

If you don't know the signed-in user's email address, you can set this value to data-promote-matching-domain=true. Then, YesGraph will try to detect the user's email domain automatically.

<script src="https://cdn.yesgraph.com/yesgraph-invites.min.js"></script>
<span id="yesgraph" class="yesgraph-invites" data-app="YOUR_APP_ID"
      data-promote-matching-domain="CURRENT_USER_EMAIL_DOMAIN"></span>

Note that the Superwidget will only show suggestions if matching emails were found. Otherwise, the user will see their address book but no suggested contacts.

Javascript SDK

To target a particular email domain through the Javascript SDK (without the Superwidget UI), add promote_matching_domain to the address book object before using the rankContacts method. See the Javascript example below, or the full documentation on that method.

var addressBook = {
  "source": {
    "name": "Augusta Lovelace"
    "email": "ada@gmail.com"
  },
	"entries": [
    {
      "name": "John Doe",
      "email": "john@gmail.com"
    },
    {
      "name": "Joe Schmoe",
      "emails": ["joe@yesgraph.com"]
    }
  ],
  "promote_matching_domain": "yesgraph.com" // or 1, if you don't know the domain
};

YesGraphAPI.rankContacts(addressBook);

REST API

If you'd like to use the API directly, just add promote_matching_domain to your request whenever you POST to the /address-books endpoint. See the cURL example below, or the full documentation for that endpoint.

curl -X POST \
    -H 'Authorization: Bearer YOUR_SECRET_KEY' \
    -H 'Content-Type: application/json' \
    -d '
{
  "user_id": "1234",
  "source": {
    "name": "Jane Doe",
    "email": "jane@yesgraph.com",
  },
  "entries": [
		{
    	"name": "John Doe",
      "email": "john@gmail.com"
    },
		{
      "name": "Joe Schmoe",
      "emails": ["joe@yesgraph.com"]
    }
  ],
  "promote_matching_domain": "yesgraph.com"  # or 1, if you don't know the domain
}
    ' \
    https://api.yesgraph.com/v0/address-book

That's it! If you have any trouble getting set up, just drop us a line at support@yesgraph.com.

Email Domain Targeting

Get more users with a specific email domain