-
Notifications
You must be signed in to change notification settings - Fork 5.5k
[TRIGGER] New SMS in Aircall #17538
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TRIGGER] New SMS in Aircall #17538
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,27 @@ | ||||||||||||||||||||||||||||||||
| import common from "../common/common-webhook.mjs"; | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| export default { | ||||||||||||||||||||||||||||||||
| ...common, | ||||||||||||||||||||||||||||||||
| key: "aircall-new-sms", | ||||||||||||||||||||||||||||||||
| name: "New SMS", | ||||||||||||||||||||||||||||||||
| description: "Emit new event when a new SMS is received.", | ||||||||||||||||||||||||||||||||
| version: "0.0.1", | ||||||||||||||||||||||||||||||||
| type: "source", | ||||||||||||||||||||||||||||||||
| dedupe: "unique", | ||||||||||||||||||||||||||||||||
| methods: { | ||||||||||||||||||||||||||||||||
| ...common.methods, | ||||||||||||||||||||||||||||||||
| async getHistoricalEvents() { | ||||||||||||||||||||||||||||||||
| return []; | ||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||
| getEventType() { | ||||||||||||||||||||||||||||||||
| return "message.received"; | ||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||
| generateMeta(data) { | ||||||||||||||||||||||||||||||||
| return { | ||||||||||||||||||||||||||||||||
| id: data.id, | ||||||||||||||||||||||||||||||||
| summary: `New SMS received from ${data.raw_digits} to ${data.number.digits}`, | ||||||||||||||||||||||||||||||||
| ts: data.created_at, | ||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||
|
Comment on lines
+19
to
+25
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Harden
- return {
- id: data.id,
- summary: `New SMS received from ${data.raw_digits} to ${data.number.digits}`,
- ts: data.created_at,
- };
+ return {
+ id: data.id,
+ summary: `New SMS from ${data.raw_digits}` +
+ (data.number?.digits ? ` to ${data.number.digits}` : ""),
+ ts: Date.parse(data.created_at),
+ };📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe CodeRabbit's questioning here is correct -
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain@GTFalcao, you're absolutely right to question this. Let me check the Aircall API documentation and examine how other Aircall components handle timestamps. 🏁 Script executed: Length of output: 389 🏁 Script executed: Length of output: 7038 🏁 Script executed: Length of output: 1321 🌐 Web query: 💡 Result: In Aircall's API, the This format is consistent across various resources in Aircall's API, such as Users, Teams, Calls, and Numbers. For instance, when creating a new User, the response includes a {
"user": {
"id": 458,
"direct_link": "https://api.aircall.io/v1/users/458",
"name": "Jeffrey Curtis",
"email": "[email protected]",
"available": false,
"availability_status": "available",
"created_at": "2020-02-18T20:52:22.000Z",
"time_zone": "Etc/UTC",
"language": "en-US",
"numbers": [],
"wrap_up_time": 0
}
}Similarly, when retrieving a Team, the {
"team": {
"id": 123,
"direct_link": "https://api.aircall.io/v1/teams/123",
"name": "Sales Team",
"created_at": "2020-02-18T20:52:22.000Z",
"users": [
{
"id": 456,
"direct_link": "https://api.aircall.io/v1/users/456",
"name": "John Doe",
"email": "[email protected]",
"available": true,
"availability_status": "available",
"created_at": "2019-12-29T10:03:18.000Z",
"time_zone": "America/New_York",
"language": "en-US"
}
]
}
}This consistent timestamp format ensures uniformity across Aircall's API responses and webhook payloads. Citations: Perfect! I've confirmed that the conversion is absolutely needed. Here's what I found: From the Aircall API documentation: The From the existing codebase: I found that other Aircall components have the same issue:
The fix: CodeRabbit's suggestion to use You're absolutely right to question this - the conversion is essential for the component to work correctly. The existing components ( ✏️ Learnings added
🧠 Learnings used
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi @GTFalcao I've already checked this and it is in miliseconds
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.