API Trigger
10 min
1 overview 1 overview the api trigger feature allows you to start a chatbot flow using an api call, without requiring the user to interact with the bot manually this is useful for automating workflows triggering bot actions from external systems passing user data directly into bot flows note this feature is only for whatsapp and rcs channel 2 availability 2 availability api trigger is available in our enterprise plans based on an entitlement, please reach out to support\@engati ai for assistance 3 working mechanism 3 working mechanism a user’s data (e g , phone number, attributes) is sent via an api request the api triggers a specific bot flow (using flow key) the flow executes based on the configured logic a user is created/tracked in the bot with provided details 4 api endpoint 4 api endpoint method post request url https //api engati ai/bot api/v2 0/customer/\<customer id>/bot/\<bot key>/flow/\<flow key> headers authorization basic \<api key> content type application/json whatsapp channel { "user channel" "whatsapp", "user phone no" "\<phone number>", "attribute 1" "value1", "attribute 2" "value2" } required parameters parameter description customer id unique customer identifier bot key bot identifier api key authentication key flow key flow to be triggered user phone no user’s phone number (with country code) where to find keys customer id / bot key / api key → integrations → engati api flow key → click the "i" (path info) icon in the flow builder note for whatsapp, if in any case, the user's name is not present with its phone number then the 'user user name' attribute will capture and store its phone number flow setup create a flow in the bot builder use attributes to receive api data add decision nodes to control logic example if user type = vip → trigger vip flow else → trigger standard flow user tracking when the api will be triggered and the automation flow executed, a user will be created in the dedicated bot containing the details curl version 1 curl location request post 'https //api engati ai/bot api/v1 0/customer/\<cid>/bot/\<bot key>/flow/\<flow key>?user phone no=\<phone number>\&resultcode=123\&operationid=test123' \\ \ header 'authorization basic \<api key>' version 2 when the api will be triggered the attribute data will be passed through the api into the flow and this flow will be executed these attributes can be configured in the request body of api curl location 'https //api engati ai/bot api/v2 0/customer/\<cid>/bot/\<bot key>/flow/\<flow key>' \\ \ header 'authorization basic \<api key>' \\ \ header 'content type application/json' \\ \ data '{ "user channel" "whatsapp", "user phone no" \<to number>, "attribute 1" "this is parameter 1", "attribute 2" "this is parameter 2" }' rcs channel api trigger also works for rcs channel key differences "user channel" "rcs" flow key remains in the url user must have rcs enabled parameters parameter description customer id unique customer identifier bot key bot identifier api key authentication key flow key flow to be triggered user phone no user’s phone number (with country code) note please refer to the whatsapp channel section above for reference example curl request curl location globoff 'https //api engati ai/bot api/v2 0/customer/{customer id}/bot/{bot id}}/flow/{flow key}' \\ \ header 'authorization basic \<api key>' \\ \ header 'content type application/json' \\ \ data '{ "user channel" "rcs", "user phone no" "\<to number>", "attribute 1" "this is parameter 1", "attribute 2" "this is parameter 2" }' important notes the flow key must always be part of the request url the channel must be specified as rcs in the request body the phone number must include the country code the user must have rcs enabled on their device to receive messages in case of issues please reach out to support\@engati ai

