firebase::invites

Firebase Invites API.

Summary

Firebase Invites is a cross-platform solution for sending personalized email and SMS invitations, on-boarding users, and measuring the impact of invitations or dynamic links.

Functions

ConvertInvitation(const char *invitation_id)
Future< void >
Mark the invitation as "converted" in some app-specific way.
ConvertInvitationLastResult()
Future< void >
Get the (possibly still pending) results of the most recent ConvertInvitation call.
Fetch()
void
Fetch any pending invites.
Initialize(const App & app)
Initialize the Firebase Invites library.
SendInvite(const Invite & invite)
Start displaying the invitation UI, which will ultimately result in sending zero or more invitations.
SendInviteLastResult()
Get the results of the previous call to SendInvite.
SetListener(Listener *listener)
Set the listener to handle receiving invitations.
Terminate()
void
Terminate the Invites API.

Classes

firebase::invites::Listener

Base class used to receive Invites and Dynamic Links.

Structs

firebase::invites::Invite

Data structure used to construct and send an invite.

firebase::invites::SendInviteResult

Results from calling SendInvite() to send an invitation.

Namespaces

firebase::invites::internal

Functions

ConvertInvitation

Future< void > ConvertInvitation(
  const char *invitation_id
)

Mark the invitation as "converted" in some app-specific way.

Once you have acted on the invite in some application-specific way, you can call this function to tell Firebase that a "conversion" has occurred and the invite has been acted on in some significant way.

You don't need to convert immediately when it received, since a "conversion" can happen far in the future from when the invite was initially received, e.g. if it corresponds to the user setting up an account, making a purchase, etc.

Just save the invitation ID when you initially receive it, and use it later when performing the conversion.

Usage:

auto convert_result =
    ::firebase::invites::ConvertInvitation(my_invitation_id);
// ... later on ...
if (convert_result.Status() == kFutureStatusComplete) {
  if (convert_result.Error() == 0) {
    // successfully marked the invitation as converted!
  }
}

Details
Parameters
invitation_id
The invitation ID to mark as a conversion.
Returns
A future result telling you whether the conversion succeeded.

ConvertInvitationLastResult

Future< void > ConvertInvitationLastResult()

Get the (possibly still pending) results of the most recent ConvertInvitation call.

Details
Returns
The future result from the last call to ConvertInvitation().

Fetch

void Fetch()

Fetch any pending invites.

Each pending invite will trigger a call to the appropriate function on the registered Listener class.

This function is implicitly called on initialization. On iOS this is called automatically when the app gains focus, but on Android this needs to be called manually.

Initialize

InitResult Initialize(
  const App & app
)

Initialize the Firebase Invites library.

You must call this in order to send and receive invites.

Details
Returns
kInitResultSuccess if initialization succeeded, or kInitResultFailedMissingDependency on Android if Google Play services is not available on the current device.

SendInvite

Future< SendInviteResult > SendInvite(
  const Invite & invite
)

Start displaying the invitation UI, which will ultimately result in sending zero or more invitations.

This will take the invitation settings from the given Invite object, and display a UI to the user where they can share a link to the app with their friends.

At a minimum, you will need to have set title_text and message_text or the invitation will not be sent.

Usage:

::firebase::invites::Invite invite;
// ... set fields on invite ...
auto send_result = ::firebase::invites::SendInvite(invite);
// ... later on ...
if (send_result.Status() == kFutureStatusComplete) {
  if (send_result.Error() == 0) {
    if (send_result.Result()->invitation_ids.length() > 0) {
      // Invitations were sent.
    }
    else {
      // User canceled.
    }
  }
}

Details
Parameters
invite
The Invite that contains the settings to send with.
Returns
A future result telling us whether the invitation was sent.

SendInviteLastResult

Future< SendInviteResult > SendInviteLastResult()

Get the results of the previous call to SendInvite.

This will stay available until you call SendInvite again.

Details
Returns
The future result from the most recent call to SendInvite().

SetListener

Listener * SetListener(
  Listener *listener
)

Set the listener to handle receiving invitations.

Details
Parameters
listener
A Listener object.
Returns
The previous Listener.

Terminate

void Terminate()

Terminate the Invites API.

Cleans up resources associated with the API.

Send feedback about...

Need help? Visit our support page.