Send Messages
Learn how to send messages with postpress.
Feature available for: LinkedIn, WhatsApp, Instagram, Messenger, Telegram.
Send a message in an existing Chat / Group
Use the POST /chats/{chat_id}/messages method or the matching SDK method to send a message by providing a chat_id. You can find a chat id by listing chats, or pick it up from the payload when receiving a message on a webhook to automate replies.
curl --request POST \
--url https://api.postpress.ai/v1/chats/9f9uio56sopa456s/messages \
--header 'X-API-KEY: ${POSTPRESS_API_KEY}' \
--header 'accept: application/json' \
--header 'content-type: multipart/form-data' \
--form 'text=Hello world!'chat_id.Send a message to a User
There are two cases where you want to send a message to a User instead of into a Chat:
- You don't have access to the id of the existing chat.
- The connected account does not have a conversation history with this specific user, so there is no existing chat and you must start a new one.
To send a message to a User, use the POST /chats method or the matching SDK method.
In the account_id field, provide the id of the connected account to send the message from. In the attendees_ids field, give one user's provider internal id. Refer to the Users guides for more information about Users and how their ids work.
The method will send a message in a 1-to-1 chat, and:
- If the chat does not exist, it will be created, synced, and returned.
- If the user was not an attendee yet, it will be synced.
curl --request POST \
--url https://api.postpress.ai/v1/chats \
--header 'X-API-KEY: ${POSTPRESS_API_KEY}' \
--header 'accept: application/json' \
--header 'content-type: multipart/form-data' \
--form account_id=Yk08cDzzdsqs9_8ds \
--form 'text=Hello world!' \
--form attendees_ids=ACoAAAcDMMQBODyLwZrRcgYhrkCafURGqva0U4ELinkedIn specific use cases
With LinkedIn, unless you use InMail, you can start new chats only with your Relations. You can use postpress to invite people to become Relations through the contact invitation endpoint.
If you have a Premium LinkedIn account and want to send InMails, set the inmail property to true in the payload. Consider the account type of the user (via the /me route or GET /accounts/{id}) to pick the right API (classic, recruiter, or sales_navigator).
curl --request POST \
--url https://api.postpress.ai/v1/chats \
--header 'X-API-KEY: ${POSTPRESS_API_KEY}' \
--header 'accept: application/json' \
--header 'content-type: multipart/form-data' \
--form account_id=Asdq-j08dsqQS89QSD \
--form 'text=Hello world!' \
--form attendees_ids=ACoAAAcDMMQBODyLwZrRcgYhrkCafURGqva0U4E \
--form linkedin[api]=classic \
--form linkedin[inmail]=trueSend attachments
You can provide an additional attachment to the request body to send files along with your text message.
Limitations may vary depending on the provider, but the standard maximum size is 15 MB. You can send documents in PDF, image, or video formats.
curl --request POST \
--url https://api.postpress.ai/v1/chats \
--header 'X-API-KEY: ${POSTPRESS_API_KEY}' \
--header 'accept: application/json' \
--header 'content-type: multipart/form-data' \
--form account_id=sSR22ds5dd_ds \
--form 'text=Hello world!' \
--form attendees_ids=ACoAAAcDMMQBODyLwZrRcgYhrkCafURGqva0U4E \
--form 'attachments=@C:\Documents\cute_dog.png'Create a group chat
To start a new group chat, use the POST /chats method or the matching SDK method and provide a list of users' provider internal ids in attendees_ids, along with an optional subject for the group name.
The chat and its group participants will be synced.
curl --request POST \
--url https://api.postpress.ai/v1/chats \
--header 'X-API-KEY: ${POSTPRESS_API_KEY}' \
--header 'accept: application/json' \
--header 'content-type: multipart/form-data' \
--form account_id=k0_s8cdss9Dz8ds \
--form 'text=Hello world!' \
--form attendees_ids=33600000000@s.whatsapp.net \
--form attendees_ids=33600000001@s.whatsapp.net \
--form subject=Vacation