Sending message on Intercom on user's behalf

4.5k Views Asked by At

does anyone know how to send a message from intercom(https://www.intercom.com/) on user's behalf? I need to set up an event listener that opens intercom chat window and sends a message when a some button is clicked.

i am working with react version of intercom if it helps.

will be very grateful for any hints.

3

There are 3 best solutions below

1
On BEST ANSWER
0
On

For sending messages on the user's behalf, you may check this out https://developers.intercom.com/intercom-api-reference/reference/create-a-conversation

You may need the user's user_id or id from the reference above to create a conversation. For those who are using MobileSDK or intercom_flutter, the id is not provided within the package or SDK. I found a workaround by using this Search for contacts API to get the id.

0
On

If you are using the Intercom chat widget, you can pre-populate a custom message in the widget on the user's behalf like so

const myCustomMessage = 'Hi there!'

window.Intercom('showNewMessage', myCustomMessage)

Of course, the user still has to actually send the message. This might not be exactly what you wanted but it's an alternative in case you want to fully automate everything except the decision to send the message (which is the right UX in a lot of situations).

Documentation is here.