An iMessage API for Node.js CRM integrations
ZeroSettle supports Node.js CRM integrations through REST sends and signed reply webhooks. Use your CRM’s contact ID to route a test reply to the right HubSpot record.
Connect a CRM record to an iMessage conversation
- Start with an opted-in contact. Have the CRM pass its contact ID and phone number in E.164 format to your Node.js service. Store that mapping before sending, so a fast reply can be matched.
- Send from your server. Call
POST /api/imessage/sendwith a bearer token and a JSON body containingtoandtext. Store the returned message ID with the CRM record. Working Node.js send example. - Verify and enqueue replies. Register your HTTPS endpoint. Verify
X-ZeroSettle-Signatureover the timestamp and raw request bytes within the documented 300-second window. Formessage.received, durably deduplicate on the message ID within your ZeroSettle account, then acknowledge the request. Node.js webhook verification example.
Write a reply event to a HubSpot contact
After matching message.handle to one contact, call this worker function with message.id and message.ts_ms. HubSpot notes support a timestamp, a note body and an association to the contact. This example records that a reply arrived while keeping its text in the messaging system. HubSpot Notes API. Prefer no code? The ZeroSettle iMessage app for HubSpot (Settings > CRM > HubSpot) logs direct messages on the contact for you.
async function logReply(contactId, message) {
const token = process.env.HUBSPOT_ACCESS_TOKEN;
const response = await fetch("https://api.hubapi.com/crm/v3/objects/notes", {
method: "POST",
headers: {
Authorization: "Bearer " + token,
"Content-Type": "application/json",
},
body: JSON.stringify({
properties: {
hs_timestamp: new Date(message.ts_ms).toISOString(),
hs_note_body: "Text reply received. ZeroSettle message #" + message.id,
},
associations: [{
to: { id: String(contactId) },
types: [{
associationCategory: "HUBSPOT_DEFINED",
associationTypeId: 202,
}],
}],
}),
});
if (!response.ok) throw new Error("HubSpot status " + response.status);
return (await response.json()).id;
}
Give the worker a HubSpot token authorized to create notes. Save the returned note ID with the event. If the CRM result is ambiguous after a timeout, reconcile the contact’s notes against the message ID before retrying the write. Queue unmatched or ambiguous phone numbers for review.
Test the handoff before enabling a live workflow
Reply to a test message from a phone you control. Check that the note lands on the right contact, a repeated event leaves one note, your own sends don’t trigger the inbound worker, and a STOP reply suppresses future messages. Pro is built for people who text you first. To text opted-in queues first, Growth starts at $199/month and reaches up to 500 opted-in new contacts a day as you add numbers. Book a 15-minute demo. ZeroSettle limits and compliance.