IMChannel
IMChannel is dedicated exclusively to interactions with the Infobip WhatsApp channel. It does not require a connection to MongoDB for settings, as these are provided directly by ctlive. However, it necessitates a connection to Redis, which serves as an in-memory database for storing information.
In the event that a WhatsApp message fails to generate a contact, or if outbound messages are undelivered, it is advisable to consult the IMChannel logs. This protocol applies to any other issues concerning individual WhatsApp messages.
Format
Logs report display the function name in square brakets and after that brackets, followed by a specific message according related to the that function.
Code Block | ||
---|---|---|
| ||
imchannel | [IMCHANNEL] [onMessage] Message received {"results":[{"from":"351927482662","to":"447860099299","integrationType":"WHATSAPP","receivedAt":"2025-02-27T15:44:57.000+0000","messageId":"wamid.HBgMMzUxOTI3NDgyNjYyFQIAEhggNEVERTc4NzZBNzJFNTYyRTJFQjZDQzQ3OTdDRTA0RjIA",
"pairedMessageId":null,"callbackData":null,"message":{"text":"Oh well","type":"TEXT"},"contact":{"name":"Teresa Gomes"},"price":{"pricePerMessage":0,"currency":"SEK"}}],"messageCount":1,"pendingMessageCount":0}
|
Use
...
Cases
Incoming
...
Message
An incoming whatsapp WhatsApp message form the from a customer is reported logged with the onMessage
tag and the following follows this structure:
Code Block | ||
---|---|---|
| ||
imchannel | [IMCHANNEL] [onMessage] Message received {"results":[{"from":"39123456789","to":"44123456789","integrationType":"WHATSAPP","receivedAt":"2025-02-27T15:44:57.000+0000","messageId":"wamid.HBgMMzUxOTI3NDgyNjYyFQIAEhggNEVERTc4NzZBNzJFNTYyRTJFQjZDQzQ3OTdDRTA0RjIA",
"pairedMessageId":null,"callbackData":null,"message":{"text":"Oh well","type":"TEXT"},"contact":{"name":"Username1"},"price":{"pricePerMessage":0,"currency":"SEK"}}],"messageCount":1,"pendingMessageCount":0}
|
It dumps the full log message coming This log captures the complete message received from the provider, including the from sender and to numberrecipient numbers, the timestamp, and the messageId useful to check it directly , which is useful for direct verification on the Infobip portal in the history section.
Outbound
...
Message
To locate the message payload sent to Infobip, search for the sendMessage
tag:
Code Block | ||
---|---|---|
| ||
imchannel | [IMCHANNEL] [sendMessage] request to [https://xxxx.api.infobip.com/omni/1/advanced] Data [{"scenarioKey":"AAAAAAAAAAAABC63903B684B3E46C5DD869","destinations":[{"to":{"phoneNumber":"39123456789"}}],"whatsApp":{"text":"Service Message - Chat Closed Success."}}] with api key header
|
It dumps the full message containing This log reveals the complete message, including the URL (different which varies for each infobip Infobip account), the scenarioKey (different for unique to each whatsapp WhatsApp number), and the whatsapp WhatsApp message to sendbeing sent.
Response
The Infobip response is logged in the following way, reporting if as follows, indicating whether the message requeste request has been accepted.:
Code Block | ||
---|---|---|
| ||
imchannel | [IMCHANNEL] [sendMessage] response of [https://xxxxxx.api.infobip.com/omni/1/advanced]: {"messages":[{"to":{"phoneNumber":"39123456789"},"status":{"groupId":1,"groupName":"PENDING","id":7,"name":"PENDING_ENROUTE","description":"Message sent to next instance"},"messageId":"6920cb18-8b18-4172-9de7-514e2aac9ef1"}]}
|
Outbound
...
Multimedia Messages
Images, documents, and audio files to be sent to the customers are delivered in a two-step wayprocess.
First stepStep: a A message containing only metadata and a URL to retrieve the content, with the response coming from infobipInfobip:
Code Block | ||
---|---|---|
| ||
imchannel | [IMCHANNEL] [sendWhatsAppImageMessage] request to [https://xxxx.api.infobip.com/omni/1/advanced] Data [{"scenarioKey":"a8b1bf3c-492e-4d5e-a467-62450f3469d8","destinations":[{"to":{"phoneNumber":"39123456789"}}],"whatsApp":{"text":"NFO_resized.jpg","imageUrl":"htt pshttps://siotunnel.ei.eilabonline.biz/tenantname/imchannel/getImageMessage/bb8b8717-5b71-45a7-be04-af9cb746661b"}}] with api key header imchannel | [IMCHANNEL] [sendWhatsAppImageMessage] response of [https://6jyz65.api.infobip.com/omni/1/advanced]: {"messages":[{"to":{"phoneNumber":"351927482662"},"status":{"groupId":1,"groupName":"PENDING","id":7,"name":"PENDING_ENROUTE","description":"Message sent to next instance"},"messageId":"a8b1bf3c-492e-4d5e-a467-62450f3469d8"}]} |
Second stepStep: Infobip retrieves the content of the multimedia file. The ID is the one specified into in the URL of the previous message (https://siotunnel.ei.eilabonline.biz/tenantname/imchannel/getImageMessage/bb8b8717-5b71-45a7-be04-af9cb746661b"
) is utilized.
Info |
---|
Infobip always requests always the same message twice, first using the first as HEAD method and then the second as GET method. |
Code Block | ||
---|---|---|
| ||
imchannel | [IMCHANNEL] [onGetImageMessage] Request received for ID [bb8b8717-5b71-45a7-be04-af9cb746661b]
imchannel | [IMCHANNEL] [onGetImageMessage] [REDIS] Get message with key [IMChannel:MultimediaMessage:bb8b8717-5b71-45a7-be04-af9cb746661b]
imchannel | [IMCHANNEL] [onGetImageMessage] Set expire for key [IMChannel:MultimediaMessage:bb8b8717-5b71-45a7-be04-af9cb746661b] 1
imchannel | [IMCHANNEL] [onGetImageMessage] Request received for ID [bb8b8717-5b71-45a7-be04-af9cb746661b]
imchannel | [IMCHANNEL] [onGetImageMessage] [REDIS] Get message with key [IMChannel:MultimediaMessage:bb8b8717-5b71-45a7-be04-af9cb746661b]
imchannel | [IMCHANNEL] [onGetImageMessage] Set expire for key [IMChannel:MultimediaMessage:bb8b8717-5b71-45a7-be04-af9cb746661b] 1
|