1. Create a bot scenario
Install or update the Arga CLI to version0.1.24 or later, then sign in. Save the following as scenario.json, then import the Scenario:
scenario.json
<scenario-id> with the ID returned by the import. Wait until the run is ready. Copy the Microsoft base_url from the run’s status; the examples use its public drop-in URL.
The fixed IDs and password above are synthetic test data. The Graph permission is granted inside the twin only. See the Microsoft reference for other seed fields.
2. Configure Python
Use Python 3.12 or later. These examples target Teams SDK2.2.1.
base_url. Keep these environment variables set in each terminal used below. The SDK uses this public API URL; the inspector uses a separate authenticated URL.
Read the run status:
/ui/bots?token=<proxy_token> to twins.microsoft.admin_url, using the proxy_token from the same status response. For example, replace both placeholders in https://<admin-host>/ui/bots?token=<proxy_token>. Treat the token and this URL as credentials. The browser exchanges the token for a session cookie.
Do not use the public base_url for the inspector: it blocks the control requests that the UI needs.
3. Echo messages and approve a card
Save this complete example assocket_bot.py. Socket Mode connects outward to the twin, so you do not need to expose a local callback server.
socket_bot.py
- Open the authenticated inspector described above and select Example bot · personal-example.
- Send
Hello Teamsas Ada Lovelace. The bot repliesEcho: Hello Teamswith an approval card. - Click Approve. The card changes to Approved.
- Check Delivery history for successful acknowledgments. Click Refresh if the reply has not appeared yet.
4. Exercise calling controls
Save this ascalling.py beside socket_bot.py. It reuses the token helper, requests a separate Graph token, and creates a synthetic call to the seeded user.
calling.py
200 for the three controls, and 204 for hangup. Call state is visible in the inspector under Sockets and calls.
This example checks call state and controls without delivering callbacks. Its .invalid callback URL is a placeholder. To test calling notifications, use a reachable HTTPS receiver, validate the twin’s signed JWTs, and deliver the queued call events. Socket Mode activity delivery and Graph calling notifications use separate transports.

