DocsSocial EventsAPI Reference

Social Events API Reference

Complete API documentation for the Social Events feature across all supported engines.


Overview

All SDKs communicate with the Shard Launcher via HTTP POST to trigger social events. The API is consistent across engines with language-appropriate naming conventions.

Endpoint

POST http://localhost:9876/api/social/trigger

Payload

{
  "eventId": "myGame_boss_defeated",
  "timestamp": "2024-01-15T10:30:00.000Z"
}

Trigger Event

Trigger a social event to notify the Shard Launcher.

# Godot 4.x
ShardSDK.social.trigger_event("myGame_boss_defeated")
ParameterTypeDescription
event_idStringUnique identifier for the social event

This method is fire-and-forget. It sends the event and returns immediately without waiting for confirmation.


Configuration

All SDKs support the same configuration options:

SettingDefaultDescription
launcher_urlhttp://localhost:9876Shard Launcher URL
enable_socialtrueEnable/disable social events

Configure in Project Settings under shard_sdk/:

# Or programmatically
ShardSDK.launcher_url = "http://localhost:9876"
ShardSDK.enable_social = true

Error Handling

All SDKs use fire-and-forget HTTP requests with silent failure:

  • If the Shard Launcher is not running, calls silently fail
  • No exceptions are thrown to your game code
  • Network timeouts are handled automatically (5 second timeout)

Your game continues running normally even if the launcher is unavailable.


Event ID Format

Event IDs are generated by the ShardKit CLI and follow this format:

{camelCaseGameName}_{8hexChars}

Examples:

  • myGame_e5f6g7h8
  • superAdventure_a1b2c3d4
  • dungeonCrawler_f9e8d7c6

Usage Examples

Basic Event Triggering

func _on_boss_defeated():
    ShardSDK.social.trigger_event("myGame_boss_defeated")
 
func _on_achievement_unlocked(achievement_name: String):
    var event_id = "myGame_achievement_" + achievement_name.to_lower()
    ShardSDK.social.trigger_event(event_id)

Common Event Types

// Boss encounters
"myGame_boss_defeated"
"myGame_boss_first_try"
 
// Exploration
"myGame_secret_found"
"myGame_area_complete"
 
// Achievements
"myGame_speedrun_complete"
"myGame_no_damage_run"

Engine-Specific Documentation

For detailed setup instructions, see your engine’s documentation: