{"id":13764511,"url":"https://github.com/webex/spark-windows-sdk","last_synced_at":"2025-12-20T06:30:15.767Z","repository":{"id":75823317,"uuid":"116932911","full_name":"webex/spark-windows-sdk","owner":"webex","description":"Integrate Webex Teams into your Windows application quickly.","archived":false,"fork":false,"pushed_at":"2018-08-03T06:57:01.000Z","size":2761,"stargazers_count":2,"open_issues_count":3,"forks_count":1,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-02-06T07:47:16.582Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://webex.github.io/spark-windows-sdk/","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/webex.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2018-01-10T08:52:37.000Z","updated_at":"2024-05-24T08:33:47.000Z","dependencies_parsed_at":"2023-03-11T20:31:41.559Z","dependency_job_id":null,"html_url":"https://github.com/webex/spark-windows-sdk","commit_stats":null,"previous_names":["ciscospark/spark-windows-sdk"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webex%2Fspark-windows-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webex%2Fspark-windows-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webex%2Fspark-windows-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webex%2Fspark-windows-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/webex","download_url":"https://codeload.github.com/webex/spark-windows-sdk/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239699582,"owners_count":19682574,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T16:00:21.896Z","updated_at":"2025-12-20T06:30:15.707Z","avatar_url":"https://github.com/webex.png","language":"C#","readme":"# Cisco Spark Windows SDK\n[![NuGet version (Cisco.Spark.WindowsSDK)](https://img.shields.io/nuget/v/Cisco.Spark.WindowsSDK.svg?style=flat-square)](https://www.nuget.org/packages/Cisco.Spark.WindowsSDK/)\n[![Build status](https://ci.appveyor.com/api/projects/status/6xy34x521d0vn7mt/branch/master?svg=true)](https://ci.appveyor.com/project/ciscospark/spark-windows-sdk/branch/master)\n[![LICENSE](https://img.shields.io/github/license/ciscospark/spark-windows-sdk.svg)](https://github.com/ciscospark/spark-windows-sdk/blob/master/LICENSE)\n\n\u003e The Cisco Spark™ Windows SDK\n \nThe Cisco Spark Windows SDK makes it easy to integrate secure and convenient Cisco Spark calling and messaging features in your Windows applications.\n\nThis SDK is built with **Vistual Studio 2017** and requires:\n\n- .NET Framework 4.5.2 or higher version\n- Win8 or Win10\n\n## Table of Contents\n- [Install](#install)\n- [Usage](#usage)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\nIn your Windows application for example WPF project, here are steps to integrate the Cisco Spark Windows SDK into your project:\n\n1. Right click your project, and select \"Manage NuGet Packages...\"  \n2. Search \"Cisco.Spark.WindowsSDK\" in the Browse tag  \n3. Install the lastest stable version\n\n## Usage\nTo use the SDK, you will need Cisco Spark integration credentials. If you do not already have a Cisco Spark account, visit the [Cisco Spark for Developers portal](https://developer.ciscospark.com/) to create your account and [register an integration](https://developer.ciscospark.com/authentication.html#registering-your-integration). Your app will need to authenticate users via an [OAuth](https://oauth.net/) grant flow for existing Cisco Spark users or a [JSON Web Token](https://jwt.io/) for guest users without a Cisco Spark account.\n\nSee the [Windows SDK area](https://developer.ciscospark.com/sdk-for-windows.html) of the Cisco Spark for Developers site for more information about this SDK.\n\n### Examples\nHere are some examples of how to use the Windows SDK in your application. More details can be found under [Windows SDK Demo app](https://github.com/ciscospark/spark-windows-sdk-example).\n\n1. Create a new *Spark* instance using Spark ID authentication ([OAuth](https://oauth.net/)-based):  \n\n    ``` c# \n    string clientId = \"your client id\";  \n    string clientSecret = \"your client secret\";\n    string redirectUri = \"KitchenSink://response/\";\n    string scope = \"spark:all\";\n    var auth = new OAuthAuthenticator(clientId, clientSecret, scope, redirectUri);\n    // authCode(64 bits) can be extracted from url by loading auth.authorizationUrl with a WebBrowser\n    var spark = new SPARK(auth);\n    auth?.Authorize(authCode, result =\u003e\n    {\n        if (result.Success)\n        {\n            System.Console.WriteLine(\"authorize success!\");\n        }\n        else\n        {\n            System.Console.WriteLine(\"authorize failed!\");\n        }\n    });\n    ```\n\n2. Create a new *Spark* instance using Guest ID authentication ([JWT](https://jwt.io/)-based):  \n\n    ```c#\n    var auth = new JWTAuthenticator();\n    var spark = new SPARK(auth);\n    auth?.AuthorizeWith(jwt, result =\u003e\n    {\n        if (result.Success)\n        {\n            System.Console.WriteLine(\"authorize success!\");\n        }\n        else\n        {\n            System.Console.WriteLine(\"authorize failed!\");\n        }\n    });\n    \n    ```\n\n3. Register the device to make or receive calls:  \n \n    ``` c#\n    spark?.Phone.Register(result =\u003e\n    {\n        if (result.Success == true)\n        {\n            System.Console.WriteLine(\"spark cloud connected\");\n        }\n        else\n        {\n            System.Console.WriteLine(\"spark cloud connect failed\");\n        }\n    });\n    ```\n    \n4. Make an outgoing call:  \n\n    ```c#\n    // dial\n    // calleeAddress can be email address, person ID, or a room ID\n    spark?.Phone.Dial(calleeAddress, MediaOption.AudioVideoShare(curCallView.LocalViewHandle, curCallView.RemoteViewHandle, curCallView.RemoteShareViewHandle), result =\u003e\n    {\n        if (result.Success)\n        {\n            currentCall = result.Data;\n            RegisterCallEvent();\n        }\n        else\n        {\n            System.Console.WriteLine($\"Error: {result.Error?.errorCode.ToString()} {result.Error?.reason}\");\n        }\n    });\n    \n    // register call event handlers\n    void RegisterCallEvent()\n    {\n        currentCall.onRinging += CurrentCall_onRinging;\n        currentCall.onConnected += CurrentCall_onConnected;\n        currentCall.onDisconnected += CurrentCall_onDisconnected;\n        currentCall.onMediaChanged += CurrentCall_onMediaChanged;\n        currentCall.onCapabilitiesChanged += CurrentCall_onCapabilitiesChanged;\n        currentCall.onCallMembershipChanged += CurrentCall_onCallMembershipChanged;    \n    }\n    \n    // when video window such as local/remote/sharing window is resized or hided, call corresponding updateView with the windows handle\n    currentCall.UpdateLocalView(curCallView.LocalViewHandle);\n    ```\n\n5. Answer incoming call:\n\n    ```c#\n    // register incoming call event\n    spark?.Phone.OnIncoming += Phone_onIncoming;\n    \n    // get call object\n    void Phone_onIncoming(SparkSDK.Call obj)\n    {\n        currentCall = obj;\n    }\n    \n    // register call event handler and answer the call\n    RegisterCallEvent();\n    \n    // answer current call  \n    currentCall?.Answer(MediaOption.audioVideo(curCallView.LocalViewHandle, curCallView.RemoteViewHandle), result =\u003e\n    {\n        if (!result.Success)\n        {\n            System.Console.WriteLine($\"Error: {result.Error?.errorCode.ToString()} {result.Error?.reason}\");\n        }\n    });\n    \n    ```\n\n6. Start a screen share\n    ```c#\n    // Fetch all shareable desktop sources\n    this.currentCall.FetchShareSources(ShareSourceType.Desktop, result =\u003e\n    {\n        if (result.IsSuccess)\n        {\n            List\u003cShareSource\u003e ShareSourceList = result.Data;\n        }\n    });\n    \n    // Fetch all shareable application sources\n    this.currentCall.FetchShareSources(ShareSourceType.Application, result =\u003e\n    {\n        if (result.IsSuccess)\n        {\n            List\u003cShareSource\u003e ShareSourceList = result.Data;\n        }\n    });\n    \n    // Start share a selected share source.\n    this.currentCall.StartShare(sourceId, r =\u003e\n    {\n        if (r.IsSuccess)\n        {\n            System.Console.WriteLine(\"Start share success.\");\n        }\n        else\n        {\n            System.Console.WriteLine($\"Start share failed! Error: {r.Error?.ErrorCode.ToString()} {r.Error?.Reason}\");\n        }\n    });\n    ```\n\n7. Receive a screen share\n    ```c#\n    // set share view handle when invoke dial method.\n    spark?.Phone.Dial(calleeAddress, MediaOption.AudioVideoShare(curCallView.LocalViewHandle, curCallView.RemoteViewHandle, curCallView.RemoteShareViewHandle), result =\u003e\n    {});\n    \n    // or set set share view handle when receive RemoteSendingShareEvent\n    currentCall.OnMediaChanged += CurrentCall_onMediaChanged;\n    private void CurrentCall_onMediaChanged(MediaChangedEvent mediaChgEvent)\n    {\n        if (mediaChgEvent is RemoteSendingShareEvent)\n        {\n            var remoteSendingShareEvent = mediaChgEvent as RemoteSendingShareEvent;\n            if (remoteSendingShareEvent.IsSending)\n            {\n                currentCall.SetRemoteShareView(curCallView.RemoteShareViewHandle);\n            }\n        }\n    }\n    ```\n\n8. Create a new Cisco Spark space, add a user to the space:\n\n    ```c#\n    // Create a Cisco Spark room:\n    SparkSDK.Room room = null;\n    spark?.Rooms.Create(\"hello world\", null, rsp =\u003e\n    {\n        if (rsp.Success){\n            room = rsp.Data;\n            System.Console.WriteLine(\"create space successfully\");\n        }\n    });\n    \n    // Add a user to the room\n    spark?.Memberships.CreateByPersonEmail(room?.Id, \"email address\", false, rsp =\u003e\n    {\n        if (rsp.Success)\n        {\n            System.Console.WriteLine(\"add user successfully\");\n        }\n    });\n    \n    // send message to the room\n    spark?.Messages.PostToRoom(room?.Id, \"hello\", null, rsp =\u003e\n    {\n        if(rsp.Success)\n        {\n            System.Console.WriteLine(\"post message successfully\");\n        }\n    });\n    \n    ```\n9. Post a message\n    ```c#\n    // Post a message to a person by email or person ID.\n    spark?.Messages.PostToPerson(toPerson, text, files, r =\u003e\n    {\n        if (r.IsSuccess)\n        {\n            Message message = r.Data;\n            System.Console.WriteLine($\"{message.PersonEmail} {message.Created}\");\n            System.Console.WriteLine($\"{message.Text}\");\n        }\n        else\n        {\n            System.Console.WriteLine($\"send the message failed. {r.Error.ErrorCode} {r.Error.Reason}\");\n        }\n    });\n    \n    // Post a message to a room by roomId.\n    spark?.Messages.PostToRoom(roomId, text, mentions, files, r =\u003e\n    {\n        if (r.IsSuccess)\n        {\n            Message message = r.Data;\n            System.Console.WriteLine($\"{message.PersonEmail} {message.Created}\");\n            System.Console.WriteLine($\"{message.Text}\");\n        }\n        else\n        {\n            System.Console.WriteLine($\"send the message failed. {r.Error.ErrorCode} {r.Error.Reason}\");\n        }\n    });\n    ```\n    \n10. Mention \n    ```c#\n    // Mention list\n    List\u003cMention\u003e Mentions = new List\u003cMention\u003e();\n    \n    // Mention All\n    Mentions.Add(new MentionAll());\n    spark?.Messages.PostToRoom(roomId, text, Mentions, files, r =\u003e\n    {\n        if (r.IsSuccess)\n        {\n            Message message = r.Data;\n            System.Console.WriteLine($\"{message.PersonEmail} {message.Created}\");\n            System.Console.WriteLine($\"{message.Text}\");\n        }\n        else\n        {\n            System.Console.WriteLine($\"send the message failed. {r.Error.ErrorCode} {r.Error.Reason}\");\n        }\n    });\n    \n    // Mention one person\n    Mentions.Add(new MentionPerson(personId));\n    spark?.Messages.PostToRoom(roomId, text, Mentions, files, r =\u003e\n    {\n        if (r.IsSuccess)\n        {\n            Message message = r.Data;\n            System.Console.WriteLine($\"{message.PersonEmail} {message.Created}\");\n            System.Console.WriteLine($\"{message.Text}\");\n        }\n        else\n        {\n            System.Console.WriteLine($\"send the message failed. {r.Error.ErrorCode} {r.Error.Reason}\");\n        }\n    });\n    \n    // Receive a Mention: See receive a message.\n    \n    ```\n11. Receive a message \n    ```c#\n    spark?.Messages.OnEvent += OnMessageEvent;\n    private void OnMessageEvent(MessageEvent e)\n    {\n        if (e is MessageArrived)\n        {\n            System.Console.WriteLine(\"received a message.\");\n            var messageArrived = e as MessageArrived;\n            var msgInfo = messageArrived?.Message;\n            if (msgInfo != null)\n            {\n                // self is mentioned\n                if (msgInfo.IsSelfMentioned)\n                {\n                    System.Console.WriteLine($\"{msgInfo.PersonEmail} mentioned you.\");\n                }\n\n                // message text\n                System.Console.WriteLine($\"{msgInfo.PersonEmail} {msgInfo.Created}\");\n                System.Console.WriteLine($\"{msgInfo.Text}\");\n\n                // received attached files.\n                if (msgInfo.Files != null \u0026\u0026 msgInfo.Files.Count \u003e 0)\n                {\n                    foreach (var file in msgInfo.Files)\n                    {\n                        // download thumbnail if exist.\n                        if (file.RemoteThumbnail != null)\n                        {\n                            spark?.Messages.DownloadThumbnail(file, to, r =\u003e\n                            {\n                                if (r.IsSuccess)\n                                {\n                                    // callback download path.\n                                    ThumbnailPath = r.Data;\n                                }\n                            });\n                        }\n                        // download file\n                        spark?.Messages.DownloadFile(file, downloadPath, r =\u003e\n                        {\n                            if (r.IsSuccess)\n                            {\n                                System.Console.WriteLine($\"downloading {r.Data}%\");\n                            }\n                            else\n                            {\n                                System.Console.WriteLine($\"download failed {r.Data}\");\n                            }\n                        });\n                    }\n                }\n            }\n        }\n    }\n    ```\n\n## Contribute\n\nPull requests welcome. To suggest changes to the SDK, please fork this repository and submit a pull request with your changes. Your request will be reviewed by one of the project maintainers.\n\n## License\n\n\u0026copy; 2016-2018 Cisco Systems, Inc. and/or its affiliates. All Rights Reserved.\n\nSee [LICENSE](https://github.com/ciscospark/spark-windows-sdk/blob/master/LICENSE) for details.\n","funding_links":[],"categories":["Client SDKs"],"sub_categories":["Advanced APIs"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebex%2Fspark-windows-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwebex%2Fspark-windows-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebex%2Fspark-windows-sdk/lists"}