Send a prompt to Grok by xAI
The Send a prompt to Grok by xAi Action allows you to send data to any Grok model for AI-powered processing. This can be useful for generating product descriptions, summarizing customer inquiries, or performing advanced AI-driven tasks within your workflow.
Configuring the Action
To set up the Send to Grok by xAi action, follow these steps:
- Set up the integration following the integration guide.
- In your workflow, add a new action and select Send to Grok by xAi.
- Choose the AI model to use.
- Enter the Prompt field, which serves as the instruction to Claude. You can include tokens to pass in dynamic data.
- (Optional) Click on Advanced xAi Settings to fine-tune AI behavior.
- (Optional) Check the Include Context box to automatically send current product data along with the prompt.
- Under What do you want to do with the response?, choose how to handle the AI’s output.
- Click Save to apply the action.
Handling the AI Response
The action provides multiple ways to process the AI-generated response:
Response Handling Option | Description |
---|---|
Handle the response with Custom Action code | Allows advanced users to process the AI response using custom code. The response is available as {{ response }} . |
Run the response through a workflow | Passes the AI response to a subworkflow for further automation. Additional data can be formatted as JSON. |
Use response in other actions and conditions | Generates a token (e.g., {{ exec["id"].response }} ) that can be used in subsequent actions or conditions. |
Example Configuration
Here’s an example of setting up an AI-generated product description:
- Set the Prompt as:
Generate a short, engaging product description for {{ product.title }}.
- Enable Include Context to provide all product details.
- Choose Use response in other actions and conditions to store the AI output.
- Use the generated token in an email or product update action.
Troubleshooting & Usage Tips
Grok’s response is too long or too short.
Try adjusting your prompt by specifying a desired word count. Example: Write a product description for {{ product.title }} in 50 words or less.
The AI response contains unexpected data.
Ensure that your prompt is clear and structured. Using explicit instructions like “List three benefits of this product” can improve accuracy.
Response token is not working in later actions or conditions.
Make sure that you are using the correct token format, such as {{ exec["id"].response }}
, and that the action has executed successfully before it is referenced.
The token relies on data from the AI action. If the AI action does not run in your test, then it will not have any data to show. Ensure that the AI action runs sequentially before wherever the token is being used. Generally this means live-testing the workflow to ensure the proper result.
Credit Cost
The Send to Grok by xAi action incurs a cost of one Action Credit on Lite plans and is unlimited on Unlimited plans.
Custom Actions
This Action can be implemented within Custom Actions using the ai twig filter. See below.
AI Twig Filter Alternative
The ai Twig filter may be used directly in any text box without the need for this Action at all. This is an excellent option for inline usage of AI capabilities. See documentation for more information.