Messaging API
This guide will help you migrate the Messaging features of your application to API v2.
Overall changes
/messages/*routes are now under/chats/:chat_id/*because some providers guarantee ID uniqueness only per chat and not globally.- The concept of independent "attendees" is not present in v2. Refer to the provider's integration guide to know where to find User IDs if needed.
Methods changes
For each endpoint in the v1 API, here are the corresponding endpoints in the v2 API, along with the necessary modifications to achieve the same results.
Specifying the target accountThe
account_idparam, previously available either in the query params or in the body, is removed from all methods. Theaccount_idmust now be consistently included in the path params.
List all chats
GET /v1/chats
- Use
GET /v2/:account_id/chatsList all Chats orGET /v2/:account_id/inboxes/:inbox_id/chatList inbox Chats if the provider uses inboxes. - Query param
account_typeis removed.- Do multiple calls to get chats of multiple accounts of the same type.
- Query param
unreadis renamed tois_unread. - The response schema has changed (see Chat object changes).
Start a new Chat
POST /v1/chats
- Use
POST /v2/:account_id/chats/sendStart a Chat orPOST /v2/:account_id/inboxes/:inbox_id/chatStart a Chat from Inbox if the provider uses inboxes. - Content-Type header now only accepts
application/json. - Body param
attendees_idsis renamed tousers_idsand its accepts a single user ID as well as an array of user IDs. Read our Integration guides to know how to find user IDs based on the provider. - Body param
attachmentshas changed.- Provide an array of objects with
filename,content_typeanddatain base64 encoding.
- Provide an array of objects with
- Body param
subjectis renamed toname. - Body params
voice_messageandvideo_messageare removed.- Pass the file in
attachmentsand setsend_modetonativeso the file will be rendered as a voice or video message on the provider's application.
- Pass the file in
Provider specifics
- Provider options must now be set under
specifics.- Body param
- For LinkedIn Classic options, use
specifics.linkedin.classic.
- Param
topicis nowcompany_topic.- Param
applicant_idis removed. Use paramsidandmessaging_tokenin objectapplicant. Read our Integration guides to learn more (Start a chat with an applicant).- Param
invitation_idis nowrelation_request_id.- For LinkedIn Recruiter options, use
specifics.linkedin.recruiter.
- Param
signatureis now required.- Param
hiring_project_idis renamed toproject_id.- Param
email_addressis removed. Use paramsend_aswith the value- Param
job_posting_idis removed. Instead, just set the new paramchannel_typetoJOB_POSTING.- Param
scheduled_timeinfollow_upis renamed toscheduled_for.- For LinkedIn Sales Navigator options, use
specifics.linkedin.sales_navigator.
Get Chat
GET /v1/chats/:chat_id
- Use
GET /v2/:account_id/chats/:chat_idGet a Chat. - The response schema has changed (see Chat object changes).
List all messages from a chat
GET /v1/chats/:chat_id/messages
- Use
GET /v2/:account_id/chats/:chat_id/messagesList all Chat Messages - Query param
sender_idis renamed touser_id. Read our Integration guides to know how to find user IDs based on the provider. - The response schema has changed (see Message object changes).
Send a message in a chat
POST /v1/chats/:chat_id/messages
- Use
POST /v2/:account_id/chats/:chat_id/messages/sendSend a Message. - Content-Type header now only accepts
application/json. - Body param
thread_idis removed as no supported provider use threads at the moment. - Body param
attachmentshas changed.- Provide an array of objects with
filename,content_typeanddatain base64 encoding.
- Provide an array of objects with
- Body params
voice_message/video_messageare removed.- Pass the file in
attachmentsand setsend_modetonativeso the file will be rendered as a voice or video message on the provider's application.
- Pass the file in
- Body param
typing_durationis removed.
Perform an action on a given chat
PATCH /v1/chats/:chat_id
- Use
PATCH /v2/:account_id/chats/:chat_idUpdate a Chat - Body param
actionis removed.- Instead of
setReadStatusaction, useread_statusbody param to mark the chat as read or unread. - Instead of
setMuteStatusaction, usemuted_untilbody param to mark the chat as muted or unmuted. - Instead of
addParticipantaction, usePOST /v2/:account_id/chats/:chat_id/participantsAdd a Chat Participant. - The remaining actions have not been reimplemented.
- Instead of
List all attendees from a chat
GET /v1/chats/:chat_id/attendees
This endpoint is removed.
RecommendationHere's how to retrieve participants based on the conversation type :
- Group chat : Use
GET /v2/:account_id/chats/:chat_id/participantsList all Chat Participants.- 1to1 chats : participants are provided within the Chat object.
Synchronize a conversation from its beginning
GET /v1/chats/:chat_id/sync
This endpoint is removed as there is no need for synchronization on individual chats in v2. Read Initial Sync for more informations.
Retrieve a message
GET /v1/messages/:message_id
- Use
GET /v2/:account_id/chats/:chat_id/messages/:message_idGet a Message. - In addition to
message_id,chat_idis now required in path params. - The response schema has changed (see Message object changes).
List all messages
GET /v1/messages
This endpoint is removed.
RecommendationInstead you can use
GET /v2/:account_id/chats/:chat_id/messagesList all Chat Messages to list messages by chat.
Forward a message
POST /v1/messages/:message_id/forward
- Use
POST /v2/:account_id/chats/:chat_id/messages/:message_id/forwardForward a Message. - In addition to
message_id,chat_idis now required in path params.
Retrieve an attachment from a message
GET /v1/messages/:message_id/attachments/:attachment_id
- Use
GET /v2/:account_id/chats/:chat_id/messages/:message_id/attachments/:attachment_idGet a Message Attachment. - In addition to
attachment_idandmessage_id,chat_idis now required in path params.
List all attendees
GET /v1/chat_attendees
This endpoint is removed as the concept of independent "attendees" is not present in v2.
RecommendationHere's how to retrieve participants based on the conversation type :
- Group chat : Use
GET /v2/:account_id/chats/:chat_id/participantsList all Chat Participants.- 1to1 chats : participants are provided within the Chat object.
Retrieve an attendee
GET /v1/chat_attendees/:id
This endpoint is removed as the concept of independent "attendees" is not present in v2.
Download a chat attendee picture
GET /v1/chat_attendees/:id/picture
This endpoint is removed. Use the url given in public_picture_url or private_picture_download_url in User objects to retrieve the picture.
List all 1to1 chats for a given attendee
GET /v1/chat_attendees/:attendee_id/chats
This endpoint is removed as the concept of independent "attendees" is not present in v2.
RecommendationUse
GET /v2/:account_id/users/:user_id/chatsGet a User Chat instead. Path param is now auser_id. Read our Integration guides to know how to find user IDs based on the provider.The response is a ChatLookup object, which is just enough to know the ID of the chat and if there is an history of conversation with the user, but require an additional call to Get a Chat to retrieve the full Chat object.
List all messages for a given attendee
GET /v1/chat_attendees/:sender_id/messages
This endpoint is removed as the concept of independent "attendees" is not present in v2.
RecommendationYou can list all messages from a given participant within a chat by using
GET /v2/:account_id/chats/:chat_id/messagesList all Chat Messages and setting theuser_idfilter.
Add a reaction to a message
POST /v1/messages/:message_id/reaction
- Use
POST /v2/:account_id/chats/:chat_id/messages/:message_id/reactionsAdd a Message Reaction - In addition to
message_id,chat_idis now required in path params.
ChatAttendee object changes
The concept of independent "attendees" is not present in v2. Instead, GroupParticipant or User objects are provided within the chats and messages.
Chat object changes
| v1 field | v2 change |
|---|---|
id | This is now the provider ID. |
provider_id | Renamed to id. |
account_type | Renamed to provider. |
attendee_provider_id | Renamed to user_id. |
timestamp | Renamed to last_message_timestamp. |
archived | Renamed to is_archived. |
pinned | Renamed to is_pinned. |
read_only | Renamed to is_readonly. |
subject | Renamed to description. |
disabledFeatures | Removed, use restrictions. |
organization_id | Removed, check user for provider specific data. |
mailbox_id | Removed, check user for provider specific data. |
folder | Removed, now inferred from the inbox you list chats from if supported by the provider. |
lastMessage | Renamed to last_message. |
Message object changes
| v1 field | v2 change |
|---|---|
id | This is now the provider_id. |
provider_id | Renamed to id. |
text | This is now optional and undefined if the message only contains attachments. |
chat_id | This is now the chat_provider_id. |
chat_provider_id | Renamed to chat_id. |
quoted.provider_id | Renamed to quoted.id. |
seen | Renamed to is_seen. |
hidden | Renamed to is_hidden. |
deleted | Renamed to is_deleted. |
edited | Renamed to is_edited. |
delivered | Renamed to is_delivered. |
behavior | Removed. |
original | Removed. |
sender_attendee_id | Renamed to sender_id. |
reactions | Removed, use reactions_counter for simple reactions informations. Use List all Message's Reactions for details about reactions. |
seen_by | Removed, unsupported for now. |
Updated 24 days ago