Use the chat channel step to send a message for providers like: Slack, WhatsApp, Discord and others.

await step.chat('send-chat', async () => {
  return {
    body: 'A new post has been created',
  };
});

Provider Overrides

Some providers offer a rich DSL for styling the messages. Echo offers a robust API to leverage the provider specific capabilities using the step providers option object.

Let’s see an example of how to send a message to Slack using the providers option objet.

await step.chat('send-chat', async () => {
  return {
    body: 'A new post has been created',
  };
}, {
    providers: {
        slack: ({ inputs }) => ({
            text: 'A new post has been created',
            blocks: [
                {
                    type: 'section',
                    text: {
                        type: 'mrkdwn',
                        text: 'A new post has been created',
                    },
                },
            ],
        }),
    }
});

Default chat body field is still specified as a fallback value in case a provider specific configuration is not used.

Currently we only support Slack provider overrides. We are working on adding more providers.