douglara / chatwoot-botpress-bridge

Connect Chatwoot to Botpress
62 stars 30 forks source link

Connection to cloud botpress #19

Open aturyng opened 8 months ago

aturyng commented 8 months ago

Hey!

First of all, thank you very much for your awesome bridge implementation! I've already given it a star. =)

I have the following question. Is the current could botpress supported, right? According to the documentation here the Cloud API URL is "https://api.botpress.cloud", which I set as BOTPRESS_ENDPOINT env variable. Of course I set the correct BOTPRESS_BOT_ID. I used self-hosted Chatwoot version 3.2.2.

So given the input in the Chatwoot widget screenshot

The bot does not reply, but the communication to the bridge does work. Here are the logs

`Started POST "/chatwoot/webhook" for 18.196.101.121 at 2023-10-26 12:08:49 +0000 Processing by ChatwootController#webhook as JSON Parameters: {"account"=>{"id"=>1, "name"=>"Kitapay"}, "additional_attributes"=>{}, "content_attributes"=>{}, "content_type"=>"text", "content"=>"Hello!", "conversation"=>{"additional_attributes"=>{"browser"=>{"device_name"=>"Unknown", "browser_name"=>"Chrome", "platform_name"=>"Generic Linux", "browser_version"=>"118.0.0.0", "platform_version"=>"0"}, "referer"=>nil, "initiated_at"=>{"timestamp"=>"Thu Oct 26 2023 14:08:48 GMT+0200 (Central European Summer Time)"}, "browser_language"=>"en"}, "can_reply"=>true, "channel"=>"Channel::WebWidget", "contact_inbox"=>{"id"=>20, "contact_id"=>20, "inbox_id"=>2, "source_id"=>"89f186e8-3201-4066-9986-aa84c87865f6", "created_at"=>"2023-10-26T12:08:34.262Z", "updated_at"=>"2023-10-26T12:08:34.262Z", "hmac_verified"=>false, "pubsub_token"=>"[FILTERED]"}, "id"=>7, "inbox_id"=>2, "messages"=>[{"id"=>43, "content"=>"Hello!", "account_id"=>1, "inbox_id"=>2, "conversation_id"=>7, "message_type"=>0, "created_at"=>1698322128, "updated_at"=>"2023-10-26T12:08:48.858Z", "private"=>false, "status"=>"sent", "source_id"=>nil, "content_type"=>"text", "content_attributes"=>{}, "sender_type"=>"Contact", "sender_id"=>20, "external_source_ids"=>{}, "additional_attributes"=>{}, "processed_message_content"=>"Hello!", "sentiment"=>{}, "conversation"=>{"assignee_id"=>nil, "unread_count"=>1, "last_activity_at"=>1698322128, "contact_inbox"=>{"source_id"=>"89f186e8-3201-4066-9986-aa84c87865f6"}}, "sender"=>{"additional_attributes"=>{}, "custom_attributes"=>{}, "email"=>nil, "id"=>20, "identifier"=>nil, "name"=>"falling-cherry-871", "phone_number"=>nil, "thumbnail"=>"", "type"=>"contact"}}], "labels"=>[], "meta"=>{"sender"=>{"additional_attributes"=>{}, "custom_attributes"=>{}, "email"=>nil, "id"=>20, "identifier"=>nil, "name"=>"falling-cherry-871", "phone_number"=>nil, "thumbnail"=>"", "type"=>"contact"}, "assignee"=>nil, "team"=>nil, "hmac_verified"=>false}, "status"=>"pending", "custom_attributes"=>{}, "snoozed_until"=>nil, "unread_count"=>1, "first_reply_created_at"=>nil, "priority"=>nil, "waiting_since"=>1698322128, "agent_last_seen_at"=>0, "contact_last_seen_at"=>0, "timestamp"=>1698322128, "created_at"=>1698322128}, "created_at"=>"2023-10-26T12:08:48.858Z", "id"=>43, "inbox"=>{"id"=>2, "name"=>"TESTING"}, "message_type"=>"incoming", "private"=>false, "sender"=>{"account"=>{"id"=>1, "name"=>"Kitapay"}, "additional_attributes"=>{}, "avatar"=>"", "custom_attributes"=>{}, "email"=>nil, "id"=>20, "identifier"=>nil, "name"=>"falling-cherry-871", "phone_number"=>nil, "thumbnail"=>""}, "source_id"=>nil, "event"=>"message_created", "chatwoot"=>{"account"=>{"id"=>1, "name"=>"Kitapay"}, "additional_attributes"=>{}, "content_attributes"=>{}, "content_type"=>"text", "content"=>"Hello!", "conversation"=>{"additional_attributes"=>{"browser"=>{"device_name"=>"Unknown", "browser_name"=>"Chrome", "platform_name"=>"Generic Linux", "browser_version"=>"118.0.0.0", "platform_version"=>"0"}, "referer"=>nil, "initiated_at"=>{"timestamp"=>"Thu Oct 26 2023 14:08:48 GMT+0200 (Central European Summer Time)"}, "browser_language"=>"en"}, "can_reply"=>true, "channel"=>"Channel::WebWidget", "contact_inbox"=>{"id"=>20, "contact_id"=>20, "inbox_id"=>2, "source_id"=>"89f186e8-3201-4066-9986-aa84c87865f6", "created_at"=>"2023-10-26T12:08:34.262Z", "updated_at"=>"2023-10-26T12:08:34.262Z", "hmac_verified"=>false, "pubsub_token"=>"[FILTERED]"}, "id"=>7, "inbox_id"=>2, "messages"=>[{"id"=>43, "content"=>"Hello!", "account_id"=>1, "inbox_id"=>2, "conversation_id"=>7, "message_type"=>0, "created_at"=>1698322128, "updated_at"=>"2023-10-26T12:08:48.858Z", "private"=>false, "status"=>"sent", "source_id"=>nil, "content_type"=>"text", "content_attributes"=>{}, "sender_type"=>"Contact", "sender_id"=>20, "external_source_ids"=>{}, "additional_attributes"=>{}, "processed_message_content"=>"Hello!", "sentiment"=>{}, "conversation"=>{"assignee_id"=>nil, "unread_count"=>1, "last_activity_at"=>1698322128, "contact_inbox"=>{"source_id"=>"89f186e8-3201-4066-9986-aa84c87865f6"}}, "sender"=>{"additional_attributes"=>{}, "custom_attributes"=>{}, "email"=>nil, "id"=>20, "identifier"=>nil, "name"=>"falling-cherry-871", "phone_number"=>nil, "thumbnail"=>"", "type"=>"contact"}}], "labels"=>[], "meta"=>{"sender"=>{"additional_attributes"=>{}, "custom_attributes"=>{}, "email"=>nil, "id"=>20, "identifier"=>nil, "name"=>"falling-cherry-871", "phone_number"=>nil, "thumbnail"=>"", "type"=>"contact"}, "assignee"=>nil, "team"=>nil, "hmac_verified"=>false}, "status"=>"pending", "custom_attributes"=>{}, "snoozed_until"=>nil, "unread_count"=>1, "first_reply_created_at"=>nil, "priority"=>nil, "waiting_since"=>1698322128, "agent_last_seen_at"=>0, "contact_last_seen_at"=>0, "timestamp"=>1698322128, "created_at"=>1698322128}, "created_at"=>"2023-10-26T12:08:48.858Z", "id"=>43, "inbox"=>{"id"=>2, "name"=>"TESTING"}, "message_type"=>"incoming", "private"=>false, "sender"=>{"account"=>{"id"=>1, "name"=>"Kitapay"}, "additional_attributes"=>{}, "avatar"=>"", "custom_attributes"=>{}, "email"=>nil, "id"=>20, "identifier"=>nil, "name"=>"falling-cherry-871", "phone_number"=>nil, "thumbnail"=>""}, "source_id"=>nil, "event"=>"message_created"}} Started POST "/chatwoot/webhook" for 3.70.207.159 at 2023-10-26 12:08:49 +0000 Processing by ChatwootController#webhook as JSON Parameters: {"account"=>{"id"=>1, "name"=>"Kitapay"}, "additional_attributes"=>{}, "content_attributes"=>{}, "content_type"=>"text", "content"=>"Geben Sie dem Team einen Weg, Sie zu erreichen.", "conversation"=>{"additional_attributes"=>{"browser"=>{"device_name"=>"Unknown", "browser_name"=>"Chrome", "platform_name"=>"Generic Linux", "browser_version"=>"118.0.0.0", "platform_version"=>"0"}, "referer"=>nil, "initiated_at"=>{"timestamp"=>"Thu Oct 26 2023 14:08:48 GMT+0200 (Central European Summer Time)"}, "browser_language"=>"en"}, "can_reply"=>true, "channel"=>"Channel::WebWidget", "contact_inbox"=>{"id"=>20, "contact_id"=>20, "inbox_id"=>2, "source_id"=>"89f186e8-3201-4066-9986-aa84c87865f6", "created_at"=>"2023-10-26T12:08:34.262Z", "updated_at"=>"2023-10-26T12:08:34.262Z", "hmac_verified"=>false, "pubsub_token"=>"[FILTERED]"}, "id"=>7, "inbox_id"=>2, "messages"=>[{"id"=>45, "content"=>"Lassen Sie sich per E-Mail benachrichtigen", "account_id"=>1, "inbox_id"=>2, "conversation_id"=>7, "message_type"=>3, "created_at"=>1698322128, "updated_at"=>"2023-10-26T12:08:48.973Z", "private"=>false, "status"=>"sent", "source_id"=>nil, "content_type"=>"input_email", "content_attributes"=>{}, "sender_type"=>nil, "sender_id"=>nil, "external_source_ids"=>{}, "additional_attributes"=>{}, "processed_message_content"=>"Lassen Sie sich per E-Mail benachrichtigen", "sentiment"=>{}, "conversation"=>{"assignee_id"=>nil, "unread_count"=>1, "last_activity_at"=>1698322128, "contact_inbox"=>{"source_id"=>"89f186e8-3201-4066-9986-aa84c87865f6"}}}], "labels"=>[], "meta"=>{"sender"=>{"additional_attributes"=>{}, "custom_attributes"=>{}, "email"=>nil, "id"=>20, "identifier"=>nil, "name"=>"falling-cherry-871", "phone_number"=>nil, "thumbnail"=>"", "type"=>"contact"}, "assignee"=>nil, "team"=>nil, "hmac_verified"=>false}, "status"=>"pending", "custom_attributes"=>{}, "snoozed_until"=>nil, "unread_count"=>1, "first_reply_created_at"=>nil, "priority"=>nil, "waiting_since"=>1698322128, "agent_last_seen_at"=>0, "contact_last_seen_at"=>0, "timestamp"=>1698322128, "created_at"=>1698322128}, "created_at"=>"2023-10-26T12:08:48.959Z", "id"=>44, "inbox"=>{"id"=>2, "name"=>"TESTING"}, "message_type"=>"template", "private"=>false, "sender"=>nil, "source_id"=>nil, "event"=>"message_created", "chatwoot"=>{"account"=>{"id"=>1, "name"=>"Kitapay"}, "additional_attributes"=>{}, "content_attributes"=>{}, "content_type"=>"text", "content"=>"Geben Sie dem Team einen Weg, Sie zu erreichen.", "conversation"=>{"additional_attributes"=>{"browser"=>{"device_name"=>"Unknown", "browser_name"=>"Chrome", "platform_name"=>"Generic Linux", "browser_version"=>"118.0.0.0", "platform_version"=>"0"}, "referer"=>nil, "initiated_at"=>{"timestamp"=>"Thu Oct 26 2023 14:08:48 GMT+0200 (Central European Summer Time)"}, "browser_language"=>"en"}, "can_reply"=>true, "channel"=>"Channel::WebWidget", "contact_inbox"=>{"id"=>20, "contact_id"=>20, "inbox_id"=>2, "source_id"=>"89f186e8-3201-4066-9986-aa84c87865f6", "created_at"=>"2023-10-26T12:08:34.262Z", "updated_at"=>"2023-10-26T12:08:34.262Z", "hmac_verified"=>false, "pubsub_token"=>"[FILTERED]"}, "id"=>7, "inbox_id"=>2, "messages"=>[{"id"=>45, "content"=>"Lassen Sie sich per E-Mail benachrichtigen", "account_id"=>1, "inbox_id"=>2, "conversation_id"=>7, "message_type"=>3, "created_at"=>1698322128, "updated_at"=>"2023-10-26T12:08:48.973Z", "private"=>false, "status"=>"sent", "source_id"=>nil, "content_type"=>"input_email", "content_attributes"=>{}, "sender_type"=>nil, "sender_id"=>nil, "external_source_ids"=>{}, "additional_attributes"=>{}, "processed_message_content"=>"Lassen Sie sich per E-Mail benachrichtigen", "sentiment"=>{}, "conversation"=>{"assignee_id"=>nil, "unread_count"=>1, "last_activity_at"=>1698322128, "contact_inbox"=>{"source_id"=>"89f186e8-3201-4066-9986-aa84c87865f6"}}}], "labels"=>[], "meta"=>{"sender"=>{"additional_attributes"=>{}, "custom_attributes"=>{}, "email"=>nil, "id"=>20, "identifier"=>nil, "name"=>"falling-cherry-871", "phone_number"=>nil, "thumbnail"=>"", "type"=>"contact"}, "assignee"=>nil, "team"=>nil, "hmac_verified"=>false}, "status"=>"pending", "custom_attributes"=>{}, "snoozed_until"=>nil, "unread_count"=>1, "first_reply_created_at"=>nil, "priority"=>nil, "waiting_since"=>1698322128, "agent_last_seen_at"=>0, "contact_last_seen_at"=>0, "timestamp"=>1698322128, "created_at"=>1698322128}, "created_at"=>"2023-10-26T12:08:48.959Z", "id"=>44, "inbox"=>{"id"=>2, "name"=>"TESTING"}, "message_type"=>"template", "private"=>false, "sender"=>nil, "source_id"=>nil, "event"=>"message_created"}} Completed 200 OK in 0ms (Views: 0.1ms | Allocations: 110)

Started POST "/chatwoot/webhook" for 18.196.101.121 at 2023-10-26 12:08:49 +0000 Processing by ChatwootController#webhook as JSON Parameters: {"account"=>{"id"=>1, "name"=>"Kitapay"}, "additional_attributes"=>{}, "content_attributes"=>{}, "content_type"=>"input_email", "content"=>"Lassen Sie sich per E-Mail benachrichtigen", "conversation"=>{"additional_attributes"=>{"browser"=>{"device_name"=>"Unknown", "browser_name"=>"Chrome", "platform_name"=>"Generic Linux", "browser_version"=>"118.0.0.0", "platform_version"=>"0"}, "referer"=>nil, "initiated_at"=>{"timestamp"=>"Thu Oct 26 2023 14:08:48 GMT+0200 (Central European Summer Time)"}, "browser_language"=>"en"}, "can_reply"=>true, "channel"=>"Channel::WebWidget", "contact_inbox"=>{"id"=>20, "contact_id"=>20, "inbox_id"=>2, "source_id"=>"89f186e8-3201-4066-9986-aa84c87865f6", "created_at"=>"2023-10-26T12:08:34.262Z", "updated_at"=>"2023-10-26T12:08:34.262Z", "hmac_verified"=>false, "pubsub_token"=>"[FILTERED]"}, "id"=>7, "inbox_id"=>2, "messages"=>[{"id"=>45, "content"=>"Lassen Sie sich per E-Mail benachrichtigen", "account_id"=>1, "inbox_id"=>2, "conversation_id"=>7, "message_type"=>3, "created_at"=>1698322128, "updated_at"=>"2023-10-26T12:08:48.973Z", "private"=>false, "status"=>"sent", "source_id"=>nil, "content_type"=>"input_email", "content_attributes"=>{}, "sender_type"=>nil, "sender_id"=>nil, "external_source_ids"=>{}, "additional_attributes"=>{}, "processed_message_content"=>"Lassen Sie sich per E-Mail benachrichtigen", "sentiment"=>{}, "conversation"=>{"assignee_id"=>nil, "unread_count"=>1, "last_activity_at"=>1698322128, "contact_inbox"=>{"source_id"=>"89f186e8-3201-4066-9986-aa84c87865f6"}}}], "labels"=>[], "meta"=>{"sender"=>{"additional_attributes"=>{}, "custom_attributes"=>{}, "email"=>nil, "id"=>20, "identifier"=>nil, "name"=>"falling-cherry-871", "phone_number"=>nil, "thumbnail"=>"", "type"=>"contact"}, "assignee"=>nil, "team"=>nil, "hmac_verified"=>false}, "status"=>"pending", "custom_attributes"=>{}, "snoozed_until"=>nil, "unread_count"=>1, "first_reply_created_at"=>nil, "priority"=>nil, "waiting_since"=>1698322128, "agent_last_seen_at"=>0, "contact_last_seen_at"=>0, "timestamp"=>1698322128, "created_at"=>1698322128}, "created_at"=>"2023-10-26T12:08:48.973Z", "id"=>45, "inbox"=>{"id"=>2, "name"=>"TESTING"}, "message_type"=>"template", "private"=>false, "sender"=>nil, "source_id"=>nil, "event"=>"message_created", "chatwoot"=>{"account"=>{"id"=>1, "name"=>"Kitapay"}, "additional_attributes"=>{}, "content_attributes"=>{}, "content_type"=>"input_email", "content"=>"Lassen Sie sich per E-Mail benachrichtigen", "conversation"=>{"additional_attributes"=>{"browser"=>{"device_name"=>"Unknown", "browser_name"=>"Chrome", "platform_name"=>"Generic Linux", "browser_version"=>"118.0.0.0", "platform_version"=>"0"}, "referer"=>nil, "initiated_at"=>{"timestamp"=>"Thu Oct 26 2023 14:08:48 GMT+0200 (Central European Summer Time)"}, "browser_language"=>"en"}, "can_reply"=>true, "channel"=>"Channel::WebWidget", "contact_inbox"=>{"id"=>20, "contact_id"=>20, "inbox_id"=>2, "source_id"=>"89f186e8-3201-4066-9986-aa84c87865f6", "created_at"=>"2023-10-26T12:08:34.262Z", "updated_at"=>"2023-10-26T12:08:34.262Z", "hmac_verified"=>false, "pubsub_token"=>"[FILTERED]"}, "id"=>7, "inbox_id"=>2, "messages"=>[{"id"=>45, "content"=>"Lassen Sie sich per E-Mail benachrichtigen", "account_id"=>1, "inbox_id"=>2, "conversation_id"=>7, "message_type"=>3, "created_at"=>1698322128, "updated_at"=>"2023-10-26T12:08:48.973Z", "private"=>false, "status"=>"sent", "source_id"=>nil, "content_type"=>"input_email", "content_attributes"=>{}, "sender_type"=>nil, "sender_id"=>nil, "external_source_ids"=>{}, "additional_attributes"=>{}, "processed_message_content"=>"Lassen Sie sich per E-Mail benachrichtigen", "sentiment"=>{}, "conversation"=>{"assignee_id"=>nil, "unread_count"=>1, "last_activity_at"=>1698322128, "contact_inbox"=>{"source_id"=>"89f186e8-3201-4066-9986-aa84c87865f6"}}}], "labels"=>[], "meta"=>{"sender"=>{"additional_attributes"=>{}, "custom_attributes"=>{}, "email"=>nil, "id"=>20, "identifier"=>nil, "name"=>"falling-cherry-871", "phone_number"=>nil, "thumbnail"=>"", "type"=>"contact"}, "assignee"=>nil, "team"=>nil, "hmac_verified"=>false}, "status"=>"pending", "custom_attributes"=>{}, "snoozed_until"=>nil, "unread_count"=>1, "first_reply_created_at"=>nil, "priority"=>nil, "waiting_since"=>1698322128, "agent_last_seen_at"=>0, "contact_last_seen_at"=>0, "timestamp"=>1698322128, "created_at"=>1698322128}, "created_at"=>"2023-10-26T12:08:48.973Z", "id"=>45, "inbox"=>{"id"=>2, "name"=>"TESTING"}, "message_type"=>"template", "private"=>false, "sender"=>nil, "source_id"=>nil, "event"=>"message_created"}} Completed 200 OK in 0ms (Views: 0.1ms | Allocations: 110)

Started POST "/chatwoot/webhook" for 18.196.101.121 at 2023-10-26 12:08:49 +0000 Processing by ChatwootController#webhook as JSON Parameters: {"account"=>{"id"=>1, "name"=>"Kitapay"}, "additional_attributes"=>{}, "content_attributes"=>{}, "content_type"=>"text", "content"=>"Geben Sie dem Team einen Weg, Sie zu erreichen.", "conversation"=>{"additional_attributes"=>{"browser"=>{"device_name"=>"Unknown", "browser_name"=>"Chrome", "platform_name"=>"Generic Linux", "browser_version"=>"118.0.0.0", "platform_version"=>"0"}, "referer"=>nil, "initiated_at"=>{"timestamp"=>"Thu Oct 26 2023 14:08:48 GMT+0200 (Central European Summer Time)"}, "browser_language"=>"en"}, "can_reply"=>true, "channel"=>"Channel::WebWidget", "contact_inbox"=>{"id"=>20, "contact_id"=>20, "inbox_id"=>2, "source_id"=>"89f186e8-3201-4066-9986-aa84c87865f6", "created_at"=>"2023-10-26T12:08:34.262Z", "updated_at"=>"2023-10-26T12:08:34.262Z", "hmac_verified"=>false, "pubsub_token"=>"[FILTERED]"}, "id"=>7, "inbox_id"=>2, "messages"=>[{"id"=>45, "content"=>"Lassen Sie sich per E-Mail benachrichtigen", "account_id"=>1, "inbox_id"=>2, "conversation_id"=>7, "message_type"=>3, "created_at"=>1698322128, "updated_at"=>"2023-10-26T12:08:48.973Z", "private"=>false, "status"=>"sent", "source_id"=>nil, "content_type"=>"input_email", "content_attributes"=>{}, "sender_type"=>nil, "sender_id"=>nil, "external_source_ids"=>{}, "additional_attributes"=>{}, "processed_message_content"=>"Lassen Sie sich per E-Mail benachrichtigen", "sentiment"=>{}, "conversation"=>{"assignee_id"=>nil, "unread_count"=>1, "last_activity_at"=>1698322128, "contact_inbox"=>{"source_id"=>"89f186e8-3201-4066-9986-aa84c87865f6"}}}], "labels"=>[], "meta"=>{"sender"=>{"additional_attributes"=>{}, "custom_attributes"=>{}, "email"=>nil, "id"=>20, "identifier"=>nil, "name"=>"falling-cherry-871", "phone_number"=>nil, "thumbnail"=>"", "type"=>"contact"}, "assignee"=>nil, "team"=>nil, "hmac_verified"=>false}, "status"=>"pending", "custom_attributes"=>{}, "snoozed_until"=>nil, "unread_count"=>1, "first_reply_created_at"=>nil, "priority"=>nil, "waiting_since"=>1698322128, "agent_last_seen_at"=>0, "contact_last_seen_at"=>1698322129, "timestamp"=>1698322128, "created_at"=>1698322128}, "created_at"=>"2023-10-26T12:08:48.959Z", "id"=>44, "inbox"=>{"id"=>2, "name"=>"TESTING"}, "message_type"=>"template", "private"=>false, "sender"=>nil, "source_id"=>nil, "event"=>"message_updated", "chatwoot"=>{"account"=>{"id"=>1, "name"=>"Kitapay"}, "additional_attributes"=>{}, "content_attributes"=>{}, "content_type"=>"text", "content"=>"Geben Sie dem Team einen Weg, Sie zu erreichen.", "conversation"=>{"additional_attributes"=>{"browser"=>{"device_name"=>"Unknown", "browser_name"=>"Chrome", "platform_name"=>"Generic Linux", "browser_version"=>"118.0.0.0", "platform_version"=>"0"}, "referer"=>nil, "initiated_at"=>{"timestamp"=>"Thu Oct 26 2023 14:08:48 GMT+0200 (Central European Summer Time)"}, "browser_language"=>"en"}, "can_reply"=>true, "channel"=>"Channel::WebWidget", "contact_inbox"=>{"id"=>20, "contact_id"=>20, "inbox_id"=>2, "source_id"=>"89f186e8-3201-4066-9986-aa84c87865f6", "created_at"=>"2023-10-26T12:08:34.262Z", "updated_at"=>"2023-10-26T12:08:34.262Z", "hmac_verified"=>false, "pubsub_token"=>"[FILTERED]"}, "id"=>7, "inbox_id"=>2, "messages"=>[{"id"=>45, "content"=>"Lassen Sie sich per E-Mail benachrichtigen", "account_id"=>1, "inbox_id"=>2, "conversation_id"=>7, "message_type"=>3, "created_at"=>1698322128, "updated_at"=>"2023-10-26T12:08:48.973Z", "private"=>false, "status"=>"sent", "source_id"=>nil, "content_type"=>"input_email", "content_attributes"=>{}, "sender_type"=>nil, "sender_id"=>nil, "external_source_ids"=>{}, "additional_attributes"=>{}, "processed_message_content"=>"Lassen Sie sich per E-Mail benachrichtigen", "sentiment"=>{}, "conversation"=>{"assignee_id"=>nil, "unread_count"=>1, "last_activity_at"=>1698322128, "contact_inbox"=>{"source_id"=>"89f186e8-3201-4066-9986-aa84c87865f6"}}}], "labels"=>[], "meta"=>{"sender"=>{"additional_attributes"=>{}, "custom_attributes"=>{}, "email"=>nil, "id"=>20, "identifier"=>nil, "name"=>"falling-cherry-871", "phone_number"=>nil, "thumbnail"=>"", "type"=>"contact"}, "assignee"=>nil, "team"=>nil, "hmac_verified"=>false}, "status"=>"pending", "custom_attributes"=>{}, "snoozed_until"=>nil, "unread_count"=>1, "first_reply_created_at"=>nil, "priority"=>nil, "waiting_since"=>1698322128, "agent_last_seen_at"=>0, "contact_last_seen_at"=>1698322129, "timestamp"=>1698322128, "created_at"=>1698322128}, "created_at"=>"2023-10-26T12:08:48.959Z", "id"=>44, "inbox"=>{"id"=>2, "name"=>"TESTING"}, "message_type"=>"template", "private"=>false, "sender"=>nil, "source_id"=>nil, "event"=>"message_updated"}} Completed 200 OK in 0ms (Views: 0.1ms | Allocations: 108)

Started POST "/chatwoot/webhook" for 3.70.207.159 at 2023-10-26 12:08:49 +0000 Processing by ChatwootController#webhook as JSON Parameters: {"account"=>{"id"=>1, "name"=>"Kitapay"}, "additional_attributes"=>{}, "content_attributes"=>{}, "content_type"=>"input_email", "content"=>"Lassen Sie sich per E-Mail benachrichtigen", "conversation"=>{"additional_attributes"=>{"browser"=>{"device_name"=>"Unknown", "browser_name"=>"Chrome", "platform_name"=>"Generic Linux", "browser_version"=>"118.0.0.0", "platform_version"=>"0"}, "referer"=>nil, "initiated_at"=>{"timestamp"=>"Thu Oct 26 2023 14:08:48 GMT+0200 (Central European Summer Time)"}, "browser_language"=>"en"}, "can_reply"=>true, "channel"=>"Channel::WebWidget", "contact_inbox"=>{"id"=>20, "contact_id"=>20, "inbox_id"=>2, "source_id"=>"89f186e8-3201-4066-9986-aa84c87865f6", "created_at"=>"2023-10-26T12:08:34.262Z", "updated_at"=>"2023-10-26T12:08:34.262Z", "hmac_verified"=>false, "pubsub_token"=>"[FILTERED]"}, "id"=>7, "inbox_id"=>2, "messages"=>[{"id"=>45, "content"=>"Lassen Sie sich per E-Mail benachrichtigen", "account_id"=>1, "inbox_id"=>2, "conversation_id"=>7, "message_type"=>3, "created_at"=>1698322128, "updated_at"=>"2023-10-26T12:08:49.248Z", "private"=>false, "status"=>"read", "source_id"=>nil, "content_type"=>"input_email", "content_attributes"=>{}, "sender_type"=>nil, "sender_id"=>nil, "external_source_ids"=>{}, "additional_attributes"=>{}, "processed_message_content"=>"Lassen Sie sich per E-Mail benachrichtigen", "sentiment"=>{}, "conversation"=>{"assignee_id"=>nil, "unread_count"=>1, "last_activity_at"=>1698322128, "contact_inbox"=>{"source_id"=>"89f186e8-3201-4066-9986-aa84c87865f6"}}}], "labels"=>[], "meta"=>{"sender"=>{"additional_attributes"=>{}, "custom_attributes"=>{}, "email"=>nil, "id"=>20, "identifier"=>nil, "name"=>"falling-cherry-871", "phone_number"=>nil, "thumbnail"=>"", "type"=>"contact"}, "assignee"=>nil, "team"=>nil, "hmac_verified"=>false}, "status"=>"pending", "custom_attributes"=>{}, "snoozed_until"=>nil, "unread_count"=>1, "first_reply_created_at"=>nil, "priority"=>nil, "waiting_since"=>1698322128, "agent_last_seen_at"=>0, "contact_last_seen_at"=>1698322129, "timestamp"=>1698322128, "created_at"=>1698322128}, "created_at"=>"2023-10-26T12:08:48.973Z", "id"=>45, "inbox"=>{"id"=>2, "name"=>"TESTING"}, "message_type"=>"template", "private"=>false, "sender"=>nil, "source_id"=>nil, "event"=>"message_updated", "chatwoot"=>{"account"=>{"id"=>1, "name"=>"Kitapay"}, "additional_attributes"=>{}, "content_attributes"=>{}, "content_type"=>"input_email", "content"=>"Lassen Sie sich per E-Mail benachrichtigen", "conversation"=>{"additional_attributes"=>{"browser"=>{"device_name"=>"Unknown", "browser_name"=>"Chrome", "platform_name"=>"Generic Linux", "browser_version"=>"118.0.0.0", "platform_version"=>"0"}, "referer"=>nil, "initiated_at"=>{"timestamp"=>"Thu Oct 26 2023 14:08:48 GMT+0200 (Central European Summer Time)"}, "browser_language"=>"en"}, "can_reply"=>true, "channel"=>"Channel::WebWidget", "contact_inbox"=>{"id"=>20, "contact_id"=>20, "inbox_id"=>2, "source_id"=>"89f186e8-3201-4066-9986-aa84c87865f6", "created_at"=>"2023-10-26T12:08:34.262Z", "updated_at"=>"2023-10-26T12:08:34.262Z", "hmac_verified"=>false, "pubsub_token"=>"[FILTERED]"}, "id"=>7, "inbox_id"=>2, "messages"=>[{"id"=>45, "content"=>"Lassen Sie sich per E-Mail benachrichtigen", "account_id"=>1, "inbox_id"=>2, "conversation_id"=>7, "message_type"=>3, "created_at"=>1698322128, "updated_at"=>"2023-10-26T12:08:49.248Z", "private"=>false, "status"=>"read", "source_id"=>nil, "content_type"=>"input_email", "content_attributes"=>{}, "sender_type"=>nil, "sender_id"=>nil, "external_source_ids"=>{}, "additional_attributes"=>{}, "processed_message_content"=>"Lassen Sie sich per E-Mail benachrichtigen", "sentiment"=>{}, "conversation"=>{"assignee_id"=>nil, "unread_count"=>1, "last_activity_at"=>1698322128, "contact_inbox"=>{"source_id"=>"89f186e8-3201-4066-9986-aa84c87865f6"}}}], "labels"=>[], "meta"=>{"sender"=>{"additional_attributes"=>{}, "custom_attributes"=>{}, "email"=>nil, "id"=>20, "identifier"=>nil, "name"=>"falling-cherry-871", "phone_number"=>nil, "thumbnail"=>"", "type"=>"contact"}, "assignee"=>nil, "team"=>nil, "hmac_verified"=>false}, "status"=>"pending", "custom_attributes"=>{}, "snoozed_until"=>nil, "unread_count"=>1, "first_reply_created_at"=>nil, "priority"=>nil, "waiting_since"=>1698322128, "agent_last_seen_at"=>0, "contact_last_seen_at"=>1698322129, "timestamp"=>1698322128, "created_at"=>1698322128}, "created_at"=>"2023-10-26T12:08:48.973Z", "id"=>45, "inbox"=>{"id"=>2, "name"=>"TESTING"}, "message_type"=>"template", "private"=>false, "sender"=>nil, "source_id"=>nil, "event"=>"message_updated"}} Completed 200 OK in 0ms (Views: 0.1ms | Allocations: 108)

Botpress response Status code: 404 Body: 404 page not found

Completed 500 Internal Server Error in 560ms (Allocations: 6785)

NoMethodError (undefined method `each' for nil:NilClass):

app/use_cases/chatwoot/receive_event.rb:34:in process_event' app/use_cases/chatwoot/receive_event.rb:7:incall!' app/controllers/chatwoot_controller.rb:3:in `webhook' Started POST "/chatwoot/webhook" for 3.70.207.159 at 2023-10-26 12:08:58 +0000 Processing by ChatwootController#webhook as JSON Parameters: {"account"=>{"id"=>1, "name"=>"Kitapay"}, "additional_attributes"=>{}, "content_attributes"=>{"submitted_email"=>"test@company.com"}, "content_type"=>"input_email", "content"=>"Lassen Sie sich per E-Mail benachrichtigen", "conversation"=>{"additional_attributes"=>{"browser"=>{"device_name"=>"Unknown", "browser_name"=>"Chrome", "platform_name"=>"Generic Linux", "browser_version"=>"118.0.0.0", "platform_version"=>"0"}, "referer"=>nil, "initiated_at"=>{"timestamp"=>"Thu Oct 26 2023 14:08:48 GMT+0200 (Central European Summer Time)"}, "browser_language"=>"en"}, "can_reply"=>true, "channel"=>"Channel::WebWidget", "contact_inbox"=>{"id"=>20, "contact_id"=>20, "inbox_id"=>2, "source_id"=>"89f186e8-3201-4066-9986-aa84c87865f6", "created_at"=>"2023-10-26T12:08:34.262Z", "updated_at"=>"2023-10-26T12:08:34.262Z", "hmac_verified"=>false, "pubsub_token"=>"[FILTERED]"}, "id"=>7, "inbox_id"=>2, "messages"=>[{"id"=>45, "content"=>"Lassen Sie sich per E-Mail benachrichtigen", "account_id"=>1, "inbox_id"=>2, "conversation_id"=>7, "message_type"=>3, "created_at"=>1698322128, "updated_at"=>"2023-10-26T12:08:58.586Z", "private"=>false, "status"=>"read", "source_id"=>nil, "content_type"=>"input_email", "content_attributes"=>{"submitted_email"=>"test@company.com"}, "sender_type"=>nil, "sender_id"=>nil, "external_source_ids"=>{}, "additional_attributes"=>{}, "processed_message_content"=>"Lassen Sie sich per E-Mail benachrichtigen", "sentiment"=>{}, "conversation"=>{"assignee_id"=>nil, "unread_count"=>1, "last_activity_at"=>1698322128, "contact_inbox"=>{"source_id"=>"89f186e8-3201-4066-9986-aa84c87865f6"}}}], "labels"=>[], "meta"=>{"sender"=>{"additional_attributes"=>{}, "custom_attributes"=>{}, "email"=>nil, "id"=>20, "identifier"=>nil, "name"=>"falling-cherry-871", "phone_number"=>nil, "thumbnail"=>"", "type"=>"contact"}, "assignee"=>nil, "team"=>nil, "hmac_verified"=>false}, "status"=>"pending", "custom_attributes"=>{}, "snoozed_until"=>nil, "unread_count"=>1, "first_reply_created_at"=>nil, "priority"=>nil, "waiting_since"=>1698322128, "agent_last_seen_at"=>0, "contact_last_seen_at"=>1698322129, "timestamp"=>1698322128, "created_at"=>1698322128}, "created_at"=>"2023-10-26T12:08:48.973Z", "id"=>45, "inbox"=>{"id"=>2, "name"=>"TESTING"}, "message_type"=>"template", "private"=>false, "sender"=>nil, "source_id"=>nil, "event"=>"message_updated", "chatwoot"=>{"account"=>{"id"=>1, "name"=>"Kitapay"}, "additional_attributes"=>{}, "content_attributes"=>{"submitted_email"=>"test@company.com"}, "content_type"=>"input_email", "content"=>"Lassen Sie sich per E-Mail benachrichtigen", "conversation"=>{"additional_attributes"=>{"browser"=>{"device_name"=>"Unknown", "browser_name"=>"Chrome", "platform_name"=>"Generic Linux", "browser_version"=>"118.0.0.0", "platform_version"=>"0"}, "referer"=>nil, "initiated_at"=>{"timestamp"=>"Thu Oct 26 2023 14:08:48 GMT+0200 (Central European Summer Time)"}, "browser_language"=>"en"}, "can_reply"=>true, "channel"=>"Channel::WebWidget", "contact_inbox"=>{"id"=>20, "contact_id"=>20, "inbox_id"=>2, "source_id"=>"89f186e8-3201-4066-9986-aa84c87865f6", "created_at"=>"2023-10-26T12:08:34.262Z", "updated_at"=>"2023-10-26T12:08:34.262Z", "hmac_verified"=>false, "pubsub_token"=>"[FILTERED]"}, "id"=>7, "inbox_id"=>2, "messages"=>[{"id"=>45, "content"=>"Lassen Sie sich per E-Mail benachrichtigen", "account_id"=>1, "inbox_id"=>2, "conversation_id"=>7, "message_type"=>3, "created_at"=>1698322128, "updated_at"=>"2023-10-26T12:08:58.586Z", "private"=>false, "status"=>"read", "source_id"=>nil, "content_type"=>"input_email", "content_attributes"=>{"submitted_email"=>"test@company.com"}, "sender_type"=>nil, "sender_id"=>nil, "external_source_ids"=>{}, "additional_attributes"=>{}, "processed_message_content"=>"Lassen Sie sich per E-Mail benachrichtigen", "sentiment"=>{}, "conversation"=>{"assignee_id"=>nil, "unread_count"=>1, "last_activity_at"=>1698322128, "contact_inbox"=>{"source_id"=>"89f186e8-3201-4066-9986-aa84c87865f6"}}}], "labels"=>[], "meta"=>{"sender"=>{"additional_attributes"=>{}, "custom_attributes"=>{}, "email"=>nil, "id"=>20, "identifier"=>nil, "name"=>"falling-cherry-871", "phone_number"=>nil, "thumbnail"=>"", "type"=>"contact"}, "assignee"=>nil, "team"=>nil, "hmac_verified"=>false}, "status"=>"pending", "custom_attributes"=>{}, "snoozed_until"=>nil, "unread_count"=>1, "first_reply_created_at"=>nil, "priority"=>nil, "waiting_since"=>1698322128, "agent_last_seen_at"=>0, "contact_last_seen_at"=>1698322129, "timestamp"=>1698322128, "created_at"=>1698322128}, "created_at"=>"2023-10-26T12:08:48.973Z", "id"=>45, "inbox"=>{"id"=>2, "name"=>"TESTING"}, "message_type"=>"template", "private"=>false, "sender"=>nil, "source_id"=>nil, "event"=>"message_updated"}} Completed 200 OK in 0ms (Views: 0.1ms | Allocations: 108)

Started POST "/chatwoot/webhook" for 18.196.101.121 at 2023-10-26 12:09:05 +0000 Processing by ChatwootController#webhook as JSON Parameters: {"account"=>{"id"=>1, "name"=>"Kitapay"}, "additional_attributes"=>{}, "content_attributes"=>{}, "content_type"=>"text", "content"=>"This is a test", "conversation"=>{"additional_attributes"=>{"browser"=>{"device_name"=>"Unknown", "browser_name"=>"Chrome", "platform_name"=>"Generic Linux", "browser_version"=>"118.0.0.0", "platform_version"=>"0"}, "referer"=>nil, "initiated_at"=>{"timestamp"=>"Thu Oct 26 2023 14:08:48 GMT+0200 (Central European Summer Time)"}, "browser_language"=>"en"}, "can_reply"=>true, "channel"=>"Channel::WebWidget", "contact_inbox"=>{"id"=>20, "contact_id"=>20, "inbox_id"=>2, "source_id"=>"89f186e8-3201-4066-9986-aa84c87865f6", "created_at"=>"2023-10-26T12:08:34.262Z", "updated_at"=>"2023-10-26T12:08:34.262Z", "hmac_verified"=>false, "pubsub_token"=>"[FILTERED]"}, "id"=>7, "inbox_id"=>2, "messages"=>[{"id"=>46, "content"=>"This is a test", "account_id"=>1, "inbox_id"=>2, "conversation_id"=>7, "message_type"=>0, "created_at"=>1698322144, "updated_at"=>"2023-10-26T12:09:04.745Z", "private"=>false, "status"=>"sent", "source_id"=>nil, "content_type"=>"text", "content_attributes"=>{}, "sender_type"=>"Contact", "sender_id"=>20, "external_source_ids"=>{}, "additional_attributes"=>{}, "processed_message_content"=>"This is a test", "sentiment"=>{}, "conversation"=>{"assignee_id"=>nil, "unread_count"=>2, "last_activity_at"=>1698322144, "contact_inbox"=>{"source_id"=>"89f186e8-3201-4066-9986-aa84c87865f6"}}, "sender"=>{"additional_attributes"=>{}, "custom_attributes"=>{}, "email"=>"test@company.com", "id"=>20, "identifier"=>nil, "name"=>"test", "phone_number"=>nil, "thumbnail"=>"", "type"=>"contact"}}], "labels"=>[], "meta"=>{"sender"=>{"additional_attributes"=>{}, "custom_attributes"=>{}, "email"=>"test@company.com", "id"=>20, "identifier"=>nil, "name"=>"test", "phone_number"=>nil, "thumbnail"=>"", "type"=>"contact"}, "assignee"=>nil, "team"=>nil, "hmac_verified"=>false}, "status"=>"pending", "custom_attributes"=>{}, "snoozed_until"=>nil, "unread_count"=>2, "first_reply_created_at"=>nil, "priority"=>nil, "waiting_since"=>1698322128, "agent_last_seen_at"=>0, "contact_last_seen_at"=>1698322129, "timestamp"=>1698322144, "created_at"=>1698322128}, "created_at"=>"2023-10-26T12:09:04.745Z", "id"=>46, "inbox"=>{"id"=>2, "name"=>"TESTING"}, "message_type"=>"incoming", "private"=>false, "sender"=>{"account"=>{"id"=>1, "name"=>"Kitapay"}, "additional_attributes"=>{}, "avatar"=>"", "custom_attributes"=>{}, "email"=>"test@company.com", "id"=>20, "identifier"=>nil, "name"=>"test", "phone_number"=>nil, "thumbnail"=>""}, "source_id"=>nil, "event"=>"message_created", "chatwoot"=>{"account"=>{"id"=>1, "name"=>"Kitapay"}, "additional_attributes"=>{}, "content_attributes"=>{}, "content_type"=>"text", "content"=>"This is a test", "conversation"=>{"additional_attributes"=>{"browser"=>{"device_name"=>"Unknown", "browser_name"=>"Chrome", "platform_name"=>"Generic Linux", "browser_version"=>"118.0.0.0", "platform_version"=>"0"}, "referer"=>nil, "initiated_at"=>{"timestamp"=>"Thu Oct 26 2023 14:08:48 GMT+0200 (Central European Summer Time)"}, "browser_language"=>"en"}, "can_reply"=>true, "channel"=>"Channel::WebWidget", "contact_inbox"=>{"id"=>20, "contact_id"=>20, "inbox_id"=>2, "source_id"=>"89f186e8-3201-4066-9986-aa84c87865f6", "created_at"=>"2023-10-26T12:08:34.262Z", "updated_at"=>"2023-10-26T12:08:34.262Z", "hmac_verified"=>false, "pubsub_token"=>"[FILTERED]"}, "id"=>7, "inbox_id"=>2, "messages"=>[{"id"=>46, "content"=>"This is a test", "account_id"=>1, "inbox_id"=>2, "conversation_id"=>7, "message_type"=>0, "created_at"=>1698322144, "updated_at"=>"2023-10-26T12:09:04.745Z", "private"=>false, "status"=>"sent", "source_id"=>nil, "content_type"=>"text", "content_attributes"=>{}, "sender_type"=>"Contact", "sender_id"=>20, "external_source_ids"=>{}, "additional_attributes"=>{}, "processed_message_content"=>"This is a test", "sentiment"=>{}, "conversation"=>{"assignee_id"=>nil, "unread_count"=>2, "last_activity_at"=>1698322144, "contact_inbox"=>{"source_id"=>"89f186e8-3201-4066-9986-aa84c87865f6"}}, "sender"=>{"additional_attributes"=>{}, "custom_attributes"=>{}, "email"=>"test@company.com", "id"=>20, "identifier"=>nil, "name"=>"test", "phone_number"=>nil, "thumbnail"=>"", "type"=>"contact"}}], "labels"=>[], "meta"=>{"sender"=>{"additional_attributes"=>{}, "custom_attributes"=>{}, "email"=>"test@company.com", "id"=>20, "identifier"=>nil, "name"=>"test", "phone_number"=>nil, "thumbnail"=>"", "type"=>"contact"}, "assignee"=>nil, "team"=>nil, "hmac_verified"=>false}, "status"=>"pending", "custom_attributes"=>{}, "snoozed_until"=>nil, "unread_count"=>2, "first_reply_created_at"=>nil, "priority"=>nil, "waiting_since"=>1698322128, "agent_last_seen_at"=>0, "contact_last_seen_at"=>1698322129, "timestamp"=>1698322144, "created_at"=>1698322128}, "created_at"=>"2023-10-26T12:09:04.745Z", "id"=>46, "inbox"=>{"id"=>2, "name"=>"TESTING"}, "message_type"=>"incoming", "private"=>false, "sender"=>{"account"=>{"id"=>1, "name"=>"Kitapay"}, "additional_attributes"=>{}, "avatar"=>"", "custom_attributes"=>{}, "email"=>"test@company.com", "id"=>20, "identifier"=>nil, "name"=>"test", "phone_number"=>nil, "thumbnail"=>""}, "source_id"=>nil, "event"=>"message_created"}} Botpress response Status code: 404 Body: 404 page not found

Completed 500 Internal Server Error in 560ms (Allocations: 1104)

NoMethodError (undefined method `each' for nil:NilClass):

app/use_cases/chatwoot/receive_event.rb:34:in process_event' app/use_cases/chatwoot/receive_event.rb:7:incall!' app/controllers/chatwoot_controller.rb:3:in webhook'

Do you know what is the problem? Maybe it is the missing auth token bearer for the cloud botpress? Where can I add it?

Your help is very much appreciated!

Have a nice day.

douglara commented 8 months ago

Hello @aturyng thanks! The logs seem to have a problem with botpress response. I never used botpress cloud version until I checked if it was possible.

aturyng commented 8 months ago

Thanks for a quick response, @douglara !

Can you by any chance maybe test the connection to the cloud version?

I suppose the auth token is missing. Probably it must be implemented first.

shaheer-haider commented 7 months ago

Hi, Did you find any solution??

aturyng commented 7 months ago

@shaheer-haider No, but I implemented my own chatwoot/botpress integration. You can find it here: https://github.com/aturyng/chatwoot-botpress-integration-public

You are welcome to contribute as well if something is missing.

shaheer-haider commented 7 months ago

@shaheer-haider No, but I implemented my own chatwoot/botpress integration. You can find it here: https://github.com/aturyng/chatwoot-botpress-integration-public

You are welcome to contribute as well if something is missing.

Thanks man. This looks promising and exactly what I was looking for. I'll try it today.

aturyng commented 7 months ago

@shaheer-haider Sure, you are welcome!

Please give it a star if you feel it deserves it =)

shaheer-haider commented 7 months ago

@shaheer-haider Sure, you are welcome!

Please give it a star if you feel it deserves it =)

Of course it does man. It worked really well.