How to send a custom Welcome Message?

I’m trying to setup a custom welcome message for a chatbot as described here: https://marketplace.zoom.us/docs/guides/chatbots/installation-and-authentication#configuring-a-dynamic-welcome-message

I’m receiving the bot_installed event and payload, and sending the response, but the message never appears. It just prompts “Say Hi to [App]”

The chat subscription endpoint is set to [host]/command

The code is like this:

app.post('/command', async function (req, res) {
	if (req.body.event == 'bot_installed') {
		res.json({
		  "head": {
			"text": `Welcome ${req.body.payload.userName}!`
		  },
		  "body": [{
			"type": "message",
			"text": "Thanks for installing."
		  }]
		})
		console.log('ok')
	}
})

I can see via ngrok that the response is being sent as so:

HTTP/1.1 200 OK
X-Powered-By: Express
Content-Type: application/json; charset=utf-8
Content-Length: 93
ETag: W/"5d-eoFs5n6rjVUJ+yrf7VxofwIijpk"
Date: Fri, 26 Mar 2021 17:18:35 GMT
Connection: keep-alive
Keep-Alive: timeout=5

{"head":{"text":"Welcome Name!"},"body":[{"type":"message","text":"Thanks for installing."}]}

But it never appears in the client.

The docs are a bit vague and I can’t find any working examples of how this is supposed to work.

Any ideas?

Hey @galadriel,

Thank you for reaching out to the Zoom Developer Forum. Make sure that you are using the Base JSON Structure that is required when sending custom messages. Specifically, make sure that you have the proper IDs and the content object.

Let me know if that helps.

Thanks,
Max

OK thanks, that works.

But why do the docs say NOT to send the base json structure? The part you’ve included above says “respond to the HTTP POST request with a Chatbot Message content object". The content object is within the base json structure, so clearly doesn’t include it.

And the example given is labelled as the “Response body” – ie. the entire response body – and only contains the content object, as is specified in the docs.

If the response needs the base json structure too, then it would be useful if the docs said so, and the example was corrected.

Thanks

Hey @galadriel,

Great! I’m glad to hear that worked for you. I agree that our documentation could be a little clearer on this, thank you for mentioning that. I’ll work with our documentation team to see if we can improve the wording here. We should be clearer that the entire JSON structure is required.

When it comes to the Response Body section - I think it is correct. That should be an example of what you get in response when making your request with the full JSON structure. Let me know if that makes sense.

Thanks,
Max

When it comes to the Response Body section - I think it is correct. That should be an example of what you get in response when making your request with the full JSON structure. Let me know if that makes sense.

I don’t think this is correct. Sending a welcome message is different to sending a normal message.

When sending a normal message, you make a request and would expect a response body.

In this case however, you’re responding to a request from Zoom. It’s more like a webhook action than an API call.

So the response body is what you’re responding with after receiving a bot_installed event. There can be no response to that as it’s already a response itself.

So the example given is incorrect, because it doesn’t include the base json structure which is apparently required.

Hey @galadriel ,

You are correct. I have just tested this and we are working to update the docs. (DEVELOPERS-1091) :slight_smile:

Thank you for reporting this issue!

-Tommy

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.