Skip to content

feat(agentphone): add AgentPhone integration#4278

Merged
waleedlatif1 merged 6 commits intostagingfrom
waleedlatif1/add-agentphone
Apr 23, 2026
Merged

feat(agentphone): add AgentPhone integration#4278
waleedlatif1 merged 6 commits intostagingfrom
waleedlatif1/add-agentphone

Conversation

@waleedlatif1
Copy link
Copy Markdown
Collaborator

Summary

  • Add AgentPhone integration with 22 tools covering calls, conversations, messages, contacts, phone numbers, and usage
  • Wire up block, icon, registries, and docs

Type of Change

  • New feature

Testing

Tested manually

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 23, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview, Comment Apr 23, 2026 10:18pm

Request Review

@gitguardian
Copy link
Copy Markdown

gitguardian Bot commented Apr 23, 2026

️✅ There are no secrets present in this pull request anymore.

If these secrets were true positive and are still valid, we highly recommend you to revoke them.
While these secrets were previously flagged, we no longer have a reference to the
specific commits where they were detected. Once a secret has been leaked into a git
repository, you should consider it compromised, even if it was deleted immediately.
Find here more information about risks.


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@cursor
Copy link
Copy Markdown

cursor Bot commented Apr 23, 2026

PR Summary

Medium Risk
Medium risk because it introduces a new external API integration with 22 new tool endpoints and a new block wiring into core registries; failures could surface as runtime/tool invocation errors rather than compile-time issues.

Overview
Adds a new AgentPhone integration across Sim and Docs, enabling workflows to provision numbers, send SMS/iMessage (including tapback reactions), place outbound voice calls, manage conversations/contacts, and fetch usage stats.

This wires a new agentphone block into the Sim block registry and landing-page integration catalog, adds an AgentPhoneIcon and icon mappings, and registers 22 new agentphone_* tools that call api.agentphone.to with request/response transforms and input coercion/validation (notably numeric pagination fields and JSON metadata parsing). Docs are extended with a new tools/agentphone.mdx page and added to meta.json.

Reviewed by Cursor Bugbot for commit 0252f2d. Configure here.

Comment thread apps/sim/tools/agentphone/send_message.ts
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 23, 2026

Greptile Summary

This PR adds a full AgentPhone integration with 22 tools covering phone number provisioning, outbound calls, SMS/iMessage messaging, conversations, contacts, and usage stats. The block, tool registry, icon, and docs are all wired up correctly, and previous review concerns (NaN guard, invalid JSON metadata, empty-string PATCH body) have been addressed.

  • send_message.ts sends agent_id, to_number, media_url, and number_id (snake_case) in the request body, while every other POST in this integration uses camelCase (agentId, toNumber). The response is also mapped from snake_case (data.from_number, data.to_number). The same pattern appears in react_to_message.ts (data.reaction_type, data.message_id). If the API uses uniform camelCase, these calls will fail silently. Please verify the API contract for both endpoints.

Confidence Score: 4/5

Safe to merge after verifying the API field casing for the send_message and react_to_message endpoints.

All previous P0/P1 concerns (NaN forwarding, invalid JSON metadata, empty-string PATCH body) are resolved. One new P1 remains: the send_message request body and the react_to_message response mapping both use snake_case while the rest of the integration uses camelCase, which would cause silent failures if the API uses a uniform convention.

apps/sim/tools/agentphone/send_message.ts and apps/sim/tools/agentphone/react_to_message.ts — field casing in request body and response mapping needs verification against the AgentPhone API spec.

Important Files Changed

Filename Overview
apps/sim/tools/agentphone/send_message.ts Request body uses snake_case keys (agent_id, to_number, media_url, number_id) and response reads snake_case fields (from_number, to_number), inconsistent with every other tool in this PR which uses camelCase throughout.
apps/sim/tools/agentphone/react_to_message.ts Response fields read as reaction_type and message_id (snake_case) — may be correct if this endpoint returns snake_case, but warrants verification against the API spec alongside send_message.ts.
apps/sim/blocks/blocks/agentphone.ts Main block config for all 22 operations; fixes for NaN guard, JSON metadata validation, and empty-string PATCH body are present from prior review rounds.
apps/sim/tools/agentphone/update_contact.ts PATCH body now uses truthy guards for all fields, preventing empty strings from clearing contact data (fix from prior review).
apps/sim/tools/agentphone/update_conversation.ts Metadata validation moved to block-level params (throws on invalid JSON); tool body correctly handles null to clear metadata.
apps/sim/tools/agentphone/types.ts 450-line type file covering all 22 tools; well-structured with appropriate use of nullability and interface extension.
apps/sim/tools/registry.ts All 22 AgentPhone tools registered correctly in alphabetical order, consistent with the surrounding registry entries.

Comments Outside Diff (1)

  1. apps/sim/tools/agentphone/send_message.ts, line 1334-1341 (link)

    P1 Snake_case request body inconsistent with every other tool in this PR

    Every other POST in this integration uses camelCase body fields (e.g. create_call.ts sends agentId / toNumber), but send_message.ts sends agent_id, to_number, media_url, and number_id. If the AgentPhone API follows a uniform camelCase convention for all endpoints, these snake_case keys will be silently ignored and the API will reject or misprocess the request. The response mapping also reads data.from_number / data.to_number (snake_case), which would always fall back to '' if the API returns fromNumber / toNumber.

    The same pattern appears in react_to_message.ts, where the response fields are read as data.reaction_type and data.message_id. Please verify the API contract for these two endpoints and align the casing accordingly.

Reviews (4): Last reviewed commit: "lint" | Re-trigger Greptile

Comment thread apps/sim/blocks/blocks/agentphone.ts
Comment thread apps/sim/blocks/blocks/agentphone.ts
@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@cursor review

Comment thread apps/sim/tools/agentphone/react_to_message.ts
Comment thread apps/sim/tools/agentphone/get_conversation.ts
@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@cursor review

Comment thread apps/sim/blocks/blocks/agentphone.ts
Comment thread apps/docs/components/icons.tsx
Comment thread apps/sim/blocks/blocks/agentphone.ts
@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@cursor review

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 0252f2d. Configure here.

@waleedlatif1 waleedlatif1 merged commit cdde8cb into staging Apr 23, 2026
14 checks passed
@waleedlatif1 waleedlatif1 deleted the waleedlatif1/add-agentphone branch April 23, 2026 22:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant