Skip to content

Actions

Create Action

To create an action use CreateBuilder method:

1
var action = GetSocialAction.CreateBuilder("my-custom-action").build();

Add action data using AddActionData(string key, string val) or AddActionData(Dictionary<string, string> map) - second one will add all the keys and values from parameter map. For the default GetSocial actions use one of GetSocialActionKeys constants to guarantee the default behavior. Also you can pass any custom data you want and handle it on the receiver side.

You can send any of predefined actions that will be handled by the SDK, for example to open Activity Feed with id “funny-stories” use:

1
2
3
var action = ActGetSocialActionion.CreateBuilder(GetSocialActionType.OpenActivity)
        .addActionData(GetSocialActionKeys.OpenActivity.FeedName, "funny-stories")
        .build();

Currently you can attach actions to notifications or activity posts.

Handle Actions

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
public bool HandleAction(GetSocialAction action)
{
    switch (action.Type)
    {
        case GetSocialActionType.OpenProfile:
            ShowNewFriend(action.Data[GetSocialActionKeys.OpenProfile.UserId]);
            return true;
        case "try-campaign-mode":
            StartCampaignMode();
            return true;
        default:
            return false;
    }
}

To handle custom actions use:

Tip

If you are not using GetSocial UI, we recommend to handle action by yourself - better user experience would be to react to actions.

GetSocial Actions

GetSocial SDK provides a list of predefined actions and ProcessAction(...) method to process them. We use it internally in GetSocial UI. For you it may be helpful when building your custom UI.

1
GetSocial.ProcessAction(GetSocialAction action);

Handled by GetSocial Core

  • GetSocialActionType.OpenUrl: Will open a system web browser with provided URL. Required parameters:
    • GetSocialActionKeys.OpenUrl.Url - URL to open.
  • GetSocialActionType.AddFriends: Add user the the list of friends on Social Graph. Parameters:
    • GetSocialActionKeys.AddFriend.UserId - GetSocial user ID.
  • GetSocialActionType.ClaimPromoCode: Claim a promo code. You can get the information about claiming via Webhook. We recommend you to override default behavior and call GetSocial.claimPromoCode to have a feedback about success inside the app.
    • GetSocialActionKeys.ClaimPromoCode.PromoCode - promo code to claim.

Handled by GetSocial UI

  • GetSocialActionType.OpenInvites: Will open Smart Invites view. Has no required parameters.
  • GetSocialActionType.OpenActivity: Will open Activity Feed. To open Activity Feed list provide following parameter:

    • GetSocialActionKeys.OpenActivity.FeedName - Feed to Open. Use ActivitiesQuery.GlobalFeed to open global feed.

    To open Activity Feed post itself and optionally scroll to the certain comment provide following parameters:
    - GetSocialActionKeys.OpenActivity.ActivityId - Activity Feed post ID.
    - GetSocialActionKeys.OpenActivity.CommentId - Comment under that activity. Optional.

Not Handled

The following action is not handled by GetSocial:

  • GetSocialActionType.OpenProfile. Required parameters:
    • GetSocialActionKeys.OpenProfile.UserId - GetSocial user ID whose profile should be opened.

Give us your feedback! Was this article helpful?

😀 🙁